Exemple #1
0
// --------------------------------------------------------------------------------------------------------
void KIconButton::render ()
{
    glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT);

    if (getFGColor()) getFGColor()->glColor();
    
    KWidget::render();
    
    KPosition iconPos(1, -size.h);
    switch (type)
    {
        case KDL_ICONBUTTON_CROSS: 	kDisplayXPMIcon (KDS_BUTTONICON_CROSS,		iconPos); break;
        case KDL_ICONBUTTON_ARROW_UP: 	kDisplayXPMIcon (KDS_BUTTONICON_ARROW_UP,	iconPos); break;
        case KDL_ICONBUTTON_ARROW_DOWN: 	kDisplayXPMIcon (KDS_BUTTONICON_ARROW_DOWN,	iconPos); break;
        case KDL_ICONBUTTON_ARROW_LEFT: 	kDisplayXPMIcon (KDS_BUTTONICON_ARROW_LEFT,	iconPos); break;
        case KDL_ICONBUTTON_ARROW_RIGHT: 	kDisplayXPMIcon (KDS_BUTTONICON_ARROW_RIGHT,	iconPos); break;
        case KDL_ICONBUTTON_SINGLE_UP: 	kDisplayXPMIcon (KDS_BUTTONICON_UP,		iconPos); break;
        case KDL_ICONBUTTON_SINGLE_DOWN: 	kDisplayXPMIcon (KDS_BUTTONICON_DOWN,		iconPos); break;
        case KDL_ICONBUTTON_DOUBLE_UP: 	kDisplayXPMIcon (KDS_BUTTONICON_DOUBLE_UP,	iconPos); break;
        case KDL_ICONBUTTON_DOUBLE_DOWN: 	kDisplayXPMIcon (KDS_BUTTONICON_DOUBLE_DOWN,	iconPos); break;
        case KDL_ICONBUTTON_TOP: 		kDisplayXPMIcon (KDS_BUTTONICON_TOP,		iconPos); break;
        case KDL_ICONBUTTON_BOTTOM: 	kDisplayXPMIcon (KDS_BUTTONICON_BOTTOM,		iconPos); break;
        case KDL_ICONBUTTON_CLEAR: 	kDisplayXPMIcon (KDS_BUTTONICON_CLEAR,		iconPos); break;
        default: break;
    };

    glPopAttrib();
}
void Scrollable::setPattern(int _matrix[])
{
  Serial.println("Setting Pattern!");
  //    int pattern[] = {
  //      0,0,0,
  //      0,1,0,
  //      1,0,1,
  //      1,1,1,
  //      1,0,1,
  //      1,0,1,
  //    };
  //int numDots = 18;
  //int numCols = 3;
  //columns.clear();

  //for (int i = 0; i < numCols; i++)
  //{
  //  columns.push_back(new Column());
  //}

  //for (int i = 0; i < numDots; i++)
  //{
  //  CRGB* color = (pattern[i] != 0) ? getFGColor() : getBGColor();
  //  columns[numDots%numCols]->pushPixel(color);
  //}

  Column* c1 = new Column();
  c1->pushPixel(getBGColor());
  c1->pushPixel(getBGColor());
  c1->pushPixel(getFGColor());
  c1->pushPixel(getFGColor());
  c1->pushPixel(getFGColor());
  c1->pushPixel(getFGColor());
  columns.push_back(c1);

  Column* c2 = new Column();
  c2->pushPixel(getBGColor());
  c2->pushPixel(getFGColor());
  c2->pushPixel(getBGColor());
  c2->pushPixel(getFGColor());
  c2->pushPixel(getBGColor());
  c2->pushPixel(getBGColor());
  columns.push_back(c2);

  Column* c3 = new Column();
  c3->pushPixel(getBGColor());
  c3->pushPixel(getBGColor());
  c3->pushPixel(getFGColor());
  c3->pushPixel(getFGColor());
  c3->pushPixel(getFGColor());
  c3->pushPixel(getFGColor());
  columns.push_back(c3);

  Serial.println("Done Setting Pattern!");
}
Exemple #3
0
// --------------------------------------------------------------------------------------------------------
void KToggleButton::render ()
{
    glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT);

    if (getFGColor()) getFGColor()->glColor();

    KLabel::render();

    if (picked)
    {
        glBegin(GL_LINES);
        glVertex3f(0.0,       0.0, 0.0);
        glVertex3f(size.w, -size.h, 0.0);
        glVertex3f(0.0,   -size.h, 0.0);
        glVertex3f(size.w,     0.0, 0.0);
        glEnd();
    }
    glPopAttrib();
}
Exemple #4
0
// --------------------------------------------------------------------------------------------------------
void KWidget::display ()
{   
    if (flags[KDL_WIDGET_FLAG_VISIBLE] == false) return;

    glPushAttrib (GL_CURRENT_BIT);
    glPushMatrix();
    glMultMatrixf (matrix);
    
    if (getFGColor()) getFGColor()->glColor();
    
    render ();
    
    for (PickableVector::iterator iter = children.begin(); iter != children.end(); iter++)
    {
        ((KWidget*)*iter)->display();
    }
    
    glPopMatrix();
    glPopAttrib();
}
void fp_EmbedRun::_draw(dg_DrawArgs* pDA)
{
	GR_Graphics *pG = pDA->pG;
#if 0
	UT_DEBUGMSG(("Draw with class %x \n",pG));
	UT_DEBUGMSG(("Contents of fp EmbedRun \n %s \n",m_sEmbedML.utf8_str()));
#endif
	FV_View* pView = _getView();
	UT_return_if_fail(pView);

	// need to draw to the full height of line to join with line above.
	UT_sint32 xoff= 0, yoff=0, DA_xoff = pDA->xoff;

	getLine()->getScreenOffsets(this, xoff, yoff);

	// need to clear full height of line, in case we had a selection

	UT_sint32 iFillHeight = getLine()->getHeight();
	UT_sint32 iFillTop = pDA->yoff - getLine()->getAscent();

	UT_uint32 iSelAnchor = pView->getSelectionAnchor();
	UT_uint32 iPoint = pView->getPoint();

	UT_uint32 iSel1 = UT_MIN(iSelAnchor, iPoint);
	UT_uint32 iSel2 = UT_MAX(iSelAnchor, iPoint);

	UT_ASSERT(iSel1 <= iSel2);

	UT_uint32 iRunBase = getBlock()->getPosition() + getOffsetFirstVis();

	// Fill with background, then redraw.

	UT_sint32 iLineHeight = getLine()->getHeight();
	bool bIsSelected = false;
	if ( !pG->queryProperties(GR_Graphics::DGP_PAPER) && 
	    (isInSelectedTOC() || (iSel1 <= iRunBase && iSel2 > iRunBase))
		)
	{
	  // Need the painter lock to be released at the end of this block
	        GR_Painter painter(pG);
		painter.fillRect(_getView()->getColorSelBackground(), /*pDA->xoff*/DA_xoff, iFillTop, getWidth(), iFillHeight);
		bIsSelected = true;

		getEmbedManager()->setColor(m_iEmbedUID,_getView()->getColorSelForeground());

	}
	else
	{
		Fill(getGraphics(),pDA->xoff, pDA->yoff - getAscent(), getWidth()+getGraphics()->tlu(1), iLineHeight+getGraphics()->tlu(1));
		getEmbedManager()->setColor(m_iEmbedUID,getFGColor());
	}

	UT_Rect rec;
	rec.left = pDA->xoff;
	rec.top = pDA->yoff;
	rec.height = getHeight();
	rec.width = getWidth();
	if(getEmbedManager()->isDefault())
	{
	  rec.top -= _getLayoutPropFromObject("ascent");
	}
	UT_DEBUGMSG(("Draw Embed object top %d \n",rec.top));
	getEmbedManager()->render(m_iEmbedUID,rec);
	if(m_bNeedsSnapshot && !getEmbedManager()->isDefault() && getGraphics()->queryProperties(GR_Graphics::DGP_SCREEN)  )
	{
	  UT_Rect myrec = rec;
	  myrec.top -= getAscent();
	  if(!bIsSelected)
	  {
	    getEmbedManager()->makeSnapShot(m_iEmbedUID,myrec);
	    m_bNeedsSnapshot = false;
	  }
	}
	if(bIsSelected)
	{
	  UT_Rect myrec = rec;
	  if(!getEmbedManager()->isDefault())
	  {
	    myrec.top -= getAscent();
	  }
	  _drawResizeBox(myrec);
	}
}