void TouchScreenCircleButton::draw(bool pressed){
    unsigned int cx = _x+(_w/2);
    unsigned int cy = _y+(_h/2);
    unsigned int radius = _w<=_h?(_w/2):(_h/2);
    
    if(pressed){
        _controller->drawCircle(cx, cy, radius, getForeColor(), true);
        _controller->drawCircle(cx, cy, radius, getBackColor(), false);
    }else{
        _controller->drawCircle(cx, cy, radius, getBackColor(), true);
        _controller->drawCircle(cx, cy, radius, getForeColor(), false);
    }
}
void TouchScreenButton::draw(bool pressed){
    unsigned int x, y, w, h;
    getDims(&x, &y, &w, &h);
    
    if(pressed){
        _controller->drawRectangle(x, y, w, h, getForeColor(),true);
        _controller->drawRectangle(x, y, w, h, getBackColor(),false);
        _controller->drawString(getText(), x + _padding, y + _padding, _fontSize, getBackColor());
    }else{
        _controller->drawRectangle(x, y, w, h, getBackColor(),true);
        _controller->drawRectangle(x, y, w, h, getForeColor(),false);
        _controller->drawString(getText(), x + _padding, y + _padding, _fontSize, getForeColor());
    }
}
Ejemplo n.º 3
0
	void ScrollPane::paintBackground( const PaintEvent &paintEvent )
	{
		//draw background
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),getBackColor());

		Color  Top = Color(110,110,110);
		Color  Left = Color(110,110,110);
		Color  Bottom = Color(110,110,110);
		Color  Right = Color(110,110,110);


		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),Top);
		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),Left);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),Right);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
			Point(getSize().getWidth(),getSize().getHeight()),Bottom);
	}
Ejemplo n.º 4
0
  void TabbedPane::paintBackground( const PaintEvent &paintEvent )
  {
    int szMinusH = getSize().getHeight() - tabContainer->getSize().getHeight()
      + getMargin(SIDE_TOP);

    paintEvent.graphics()->drawFilledRectangle(Rectangle(0,tabContainer->getSize().getHeight(),
      getSize().getWidth(),szMinusH),
      getBackColor());


    Color  Top = Color(133,133,133);
    Color  Left = Color(133,133,133);
    Color  Bottom = Color(133,133,133);
    Color  Right = Color(133,133,133);


    //top
    paintEvent.graphics()->drawLine(Point(0,tabContainer->getSize().getHeight() + 
      getMargin(SIDE_TOP)),
      Point(getSize().getWidth(),
      tabContainer->getSize().getHeight() + getMargin(SIDE_TOP)),Top);
    //left
    paintEvent.graphics()->drawLine(Point(1,tabContainer->getSize().getHeight() + 
      getMargin(SIDE_TOP)),
      Point(1,getSize().getHeight()),Left);

    //right
    paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,
      tabContainer->getSize().getHeight() + getMargin(SIDE_TOP)),
      Point(getSize().getWidth() ,getSize().getHeight()),Right);

    //bottom
    paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
      Point(getSize().getWidth(),getSize().getHeight()),Bottom);
  }
OWindow& OWindow::getPresentation(pPresParms presentation)
{
 presentation->Fore = getForeColor();
 presentation->Back = getBackColor();
 strcpy(presentation->Font, getFont());
 return(*this);
}
Ejemplo n.º 6
0
	void TextField::paintComponent( const PaintEvent &paintEvent )
	{
		int caretLoc = getCaretLocation();
		int textLoc = getTextOffset();

		Rectangle sideclip = getInnerRectangle();
		sideclip = Rectangle(sideclip.getX() + getLeftPadding() ,
			sideclip.getY() + 2,sideclip.getSize().getWidth() - getLeftPadding()
			- getRightPadding() + 1, sideclip.getHeight() - 4);

		

		if(isReadOnly())
		{
			paintEvent.graphics()->drawFilledRectangle(
				getSizeRectangle(),frameColor);
		}
		else
		{
			paintEvent.graphics()->drawFilledRectangle(
				getSizeRectangle(),getBackColor());
		}
		

		paintEvent.graphics()->pushClippingRect(sideclip);

		if(getSelectionStart() != getSelectionEnd() && (isFocused() || !isHidingSelection()) )
		{
			Rectangle selRect = Rectangle(
				getSelectionLocation(),
				(getInnerHeight() / 2) - 
				(getFont()->getLineHeight() / 2),
				getSelectionWidth(),
				getFont()->getLineHeight());

			paintEvent.graphics()->drawFilledRectangle(
				selRect,getSelectionBackColor());
		}


			paintEvent.graphics()->drawText(Point(textLoc, +
				((getInnerSize().getHeight() - getFont()->getLineHeight()) / 2)),getText().c_str(),
				getFontColor(),getFont());
		

			if(isFocused())
			{
				if(isBlinking())
					paintEvent.graphics()->drawLine(Point(caretLoc + 1,
					((getInnerSize().getHeight() / 2) + (getFont()->getLineHeight() / 2))),
					Point(caretLoc + 1, ((getInnerSize().getHeight() / 2) - 
					(getFont()->getLineHeight() / 2))),
					Color(0,0,0));
			}


		paintEvent.graphics()->popClippingRect();

		
	}
void TouchScreenArrowButton::drawRight(bool pressed){
    unsigned int x, y, w, h;
    getDims(&x, &y, &w, &h);
    
    if(pressed){
        _controller->drawRectangle(x, y, w, h, getForeColor(),true);
        _controller->drawRectangle(x, y, w, h, getBackColor(),false);
        _controller->drawLine(x + _padding, y + _padding, x + w -1 - _padding, y + (h/2), getBackColor()); //top side
        _controller->drawLine(x + _padding, y + h - 1 - _padding, x + w - 1 - _padding, y + (h/2), getBackColor()); //bottom side
        _controller->drawLine(x + _padding, y + _padding, x + _padding, y + h - 1 - _padding, getBackColor()); //left side
    }else{
        _controller->drawRectangle(x, y, w, h, getBackColor(),true);
        _controller->drawRectangle(x, y, w, h, getForeColor(),false);
        _controller->drawLine(x + _padding, y + _padding, x + w -1 - _padding, y + (h/2), getForeColor()); //top side
        _controller->drawLine(x + _padding, y + h - 1 - _padding, x + w - 1 - _padding, y + (h/2), getForeColor()); //bottom side
        _controller->drawLine(x + _padding, y + _padding, x + _padding, y + h - 1 - _padding, getForeColor()); //left side
    }
}
Ejemplo n.º 8
0
	void Button::paintBackground( const PaintEvent &paintEvent )
	{
		Color color = getBackColor();

		switch (getButtonState())
		{
		case HOVERED:
			color = Color((float)(color.getR() + 0.075f), 
				(float)(color.getG() + 0.075f),
				(float)(color.getB() + 0.075f), 
				(float)(color.getA() ));
			break;
		case CLICKED:
			color = Color((float)(color.getR() - 0.075f), 
				(float)(color.getG() - 0.075f),
				(float)(color.getB() - 0.075f), (float)(color.getA() ));
			break;
		default:
			break;
		}

		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),color);

		Color shadow = Color(
			color.getR() - 0.2f,
			color.getG() - 0.2f,
			color.getB() - 0.2f);

		Color highlight = Color(
			color.getR() + 0.2f,
			color.getG() + 0.2f,
			color.getB() + 0.2f);

		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),highlight);
		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),highlight);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight() ),
			Point(getSize().getWidth(),getSize().getHeight() ),shadow);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),shadow);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight() - 1 ),
			Point(getSize().getWidth(),getSize().getHeight() - 1 ),shadow);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth()  - 1,0),
			Point(getSize().getWidth() - 1 ,getSize().getHeight()),shadow);

	}
Ejemplo n.º 9
0
void button::layoutControl(mainWin* mw)
{
	//如果由控件图标,就用图标
	/*if(icon){
	}else{
		LCD_SetTextColor(getBackColor());
		LCD_DrawFullRect(getWinXpos()+mw->getWinXpos(),getWinYpos()+mw->getWinYpos(),getWinWidth(),getWinHigh());
	}*/
	//先这么用
	LCD_SetTextColor(getBackColor());
	LCD_DrawFullRect(getWinXpos()+mw->getWinXpos(),getWinYpos()+mw->getWinYpos(),getWinWidth(),getWinHigh());
}
void TouchScreenSlider::draw(bool pressed){
    unsigned int x, y, w, h;
    getDims(&x, &y, &w, &h);
    
    if(pressed){
        _controller->drawRectangle(x, y, w, h, getForeColor(),true);
        _controller->drawRectangle(x, y, w, h, getBackColor(),false);
        if(_layout==HORIZONTAL){
            unsigned int thumbSize = map((int)(_value*100), 0, 100, 1, w - (_padding*2));
            _controller->drawRectangle(x + _padding, y + _padding, thumbSize, h - (_padding*2), getBackColor(),true);
            for(int lx=x+_padding+10;lx<w - (_padding*2) + x;lx+=10){ 
                _controller->drawVerticalLine(lx, y + _padding, h - (_padding*2), getForeColor());
            }
        }else if(_layout==VERTICAL){
            unsigned int thumbSize = map((int)(_value*100), 0, 100, 1, h - (_padding*2));
            _controller->drawRectangle(x + _padding, y + _padding + ((h - (_padding*2))-thumbSize), w - (_padding*2), thumbSize,  getBackColor(),true);
            for(int ly=y+_padding+10;ly<h - (_padding*2) + y;ly+=10){ 
                _controller->drawHorizontalLine(x + _padding, ly, w - (_padding*2), getForeColor());
            }
        }
    }else{
        _controller->drawRectangle(x, y, w, h, getBackColor(),true);
        _controller->drawRectangle(x, y, w, h, getForeColor(),false);
        if(_layout==HORIZONTAL){
            unsigned int thumbSize = map((int)(_value*100), 0, 100, 1, w - (_padding*2));
            _controller->drawRectangle(x + _padding, y + _padding, thumbSize, h - (_padding*2), getForeColor(),true);
            for(int lx=x+_padding+10;lx<w - (_padding*2) + x;lx+=10){ 
                _controller->drawVerticalLine(lx, y + _padding, h - (_padding*2), getBackColor());
            }
        }else if(_layout==VERTICAL){
            unsigned int thumbSize = map((int)(_value*100), 0, 100, 1, h - (_padding*2));
            _controller->drawRectangle(x + _padding, y + _padding + ((h - (_padding*2))-thumbSize), w - (_padding*2), thumbSize,  getForeColor(),true);
            for(int ly=y+_padding+10;ly<h - (_padding*2) + y;ly+=10){ 
                _controller->drawHorizontalLine(x + _padding, ly, w - (_padding*2), getBackColor());
            }
        }
    }
}
Ejemplo n.º 11
0
	void TextField::paintBackground( const PaintEvent &paintEvent )
	{
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),getBackColor());

		Color  Top = Color(171,171,171);
		Color  Left = Color(227,227,227);
		Color  Bottom = Color(231,231,231);
		Color  Right = Color(222,222,222);


		if(isFocused())
		{
			Top = Color(63,123,173);
			Left = Color(181,207,231);
			Bottom = Color(183,217,237);
			Right = Color(164,201,227);
		}



		//top
		paintEvent.graphics()->drawLine(Point(0,1),
			Point(getSize().getWidth(),1),Top);

		//left
		paintEvent.graphics()->drawLine(Point(1,1),
			Point(1,getSize().getHeight()),Left);

		//right
		paintEvent.graphics()->drawLine(Point(getSize().getWidth() ,1),
			Point(getSize().getWidth() ,getSize().getHeight()),Right);

		//bottom
		paintEvent.graphics()->drawLine(Point(0,getSize().getHeight()),
			Point(getSize().getWidth(),getSize().getHeight()),Bottom);
	}
Ejemplo n.º 12
0
FXWindow*
MFXAddEditTypedTable::getControlForItem(FXint r, FXint c) {
    register FXTableItem* item = cells[r * ncols + c];
    if (item == NULL) {
        return 0;
//         cells[r * ncols + c] = item = createItem("", NULL, NULL);
//         if (isItemSelected(r, c)) {
//             item->setSelected(FALSE);
//         }
    }
    delete editor;
    editor = NULL;
    switch (getCellType(c)) {
        case CT_UNDEFINED:
        case CT_STRING: {
            register FXTextField* field;
            register FXuint justify = 0;
            field = new FXTextField(this, 1, NULL, 0, TEXTFIELD_ENTER_ONLY, 0, 0, 0, 0, getMarginLeft(), getMarginRight(), getMarginTop(), getMarginBottom());
            // !!! if(state&LEFT) justify|=JUSTIFY_LEFT;
            // !!! if(state&RIGHT) justify|=JUSTIFY_RIGHT;
            // !!! if(state&TOP) justify|=JUSTIFY_TOP;
            // !!! if(state&BOTTOM) justify|=JUSTIFY_BOTTOM;
            field->create();
            field->setJustify(justify);
            field->setFont(getFont());
            field->setBackColor(getBackColor());
            field->setTextColor(getTextColor());
            field->setSelBackColor(getSelBackColor());
            field->setSelTextColor(getSelTextColor());
            field->setText(item->getText());
            field->selectAll();
            return field;
        }
        case CT_REAL:
//        return myNumberEditor;
        case CT_INT: {
            register FXRealSpinDial* field;
            //register FXuint justify=0;
            field = new FXRealSpinDial(this, 1, NULL, 0, TEXTFIELD_ENTER_ONLY, 0, 0, 0, 0, getMarginLeft(), getMarginRight(), getMarginTop(), getMarginBottom());
            // !!! if(state&LEFT) justify|=JUSTIFY_LEFT;
            // !!! if(state&RIGHT) justify|=JUSTIFY_RIGHT;
            // !!! if(state&TOP) justify|=JUSTIFY_TOP;
            // !!! if(state&BOTTOM) justify|=JUSTIFY_BOTTOM;
            field->create();
//            field->setJustify(justify);
            field->setFont(getFont());
            field->setBackColor(getBackColor());
            field->setTextColor(getTextColor());
            field->setSelBackColor(getSelBackColor());
            field->setSelTextColor(getSelTextColor());
            NumberCellParams p = getNumberCellParams(c);
            if (p.format != "undefined") {
                field->setFormatString((char*) p.format.c_str());
                field->setIncrements(p.steps1, p.steps2, p.steps3);
                field->setRange(p.min, p.max);
            }
            try {
                if (getCellType(c) == CT_REAL) {
                    field->setValue(TplConvert::_2SUMOReal(item->getText().text()));
                } else {
                    field->setValue(TplConvert::_2int(item->getText().text()));
                }
            } catch (NumberFormatException&) {
                field->setValue(0);
            }
            field->selectAll();
            return field;
        }
        case CT_BOOL:
//        return myBoolEditor;
        case CT_ENUM:
//        return myEnumEditor;
        default:
            throw 1;
    }
}
void TouchScreenController::clearScreen(){
    getTft()->fillRectangle(0, 0, getScreenWidth(), getScreenHeight(), getBackColor());
}    
Ejemplo n.º 14
0
	void HScrollBar::paintBackground( const PaintEvent &paintEvent )
	{
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),
			getBackColor());

	}
Ejemplo n.º 15
0
void virKeyboardWin::keyBoardInit()
{
	char* keyb[] ={"`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+","delete",
	 "tab" ,"q","w","e","r","t","y","u","i","o","p","[{","]}","\\|",
		"caps lock" ,"a","s","d","f","g","h","j","k","l",";:","'\"", "return" ,
	 "shift" ,"z","x","c","v","b","n","m",",<",".>","/?","shift",
	 "ctrl" , "alt" ,"space", "alt" ,"ctrl" };
	int i,j,temp;
	setRwNum(60);
	comboBoxInit();
	uint16_t w = (getWinWidth()- getWinWidth()/29)/14;
	uint16_t h = getWinHigh()/6;
	uint8_t n ;//中间按键数量
	uint16_t x;//x的位置
	uint16_t wt;
	for(i=0;i<4;i++) //1-3 line
	{
		wt = w ;
		switch(i)
		{
			case 0:{n = 12;temp = 0;}break;
			case 1:{
				wt += w/2;
				n = 12;
			} ;break;
			case 2:{
				wt += w*3/4;
				n = 11;
			}break;
			case 3:{
				wt += w+w/4;
				n = 10;
			}break;
			default:break;
		}	
		getRwList()[temp] = new buttonWin(0,i*h,wt,h,keyb[temp],this,getQueue());
		((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
		((controlWin*)getRwList()[temp])->setBackColor(getBackColor());
		getRwList()[temp]->setWinProc(keyboardProc);
		getRwList()[temp]->registerWin();
		for(j=0;j<n;j++)
		{
			temp ++;
			getRwList()[temp] = new buttonWin(wt,i*h,w,h,keyb[temp],this,getQueue());
			((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
			((controlWin*)getRwList()[temp])->setBackColor(getBackColor());
			getRwList()[temp]->setWinProc(keyboardProc);
			getRwList()[temp]->registerWin();
			wt += w;	
		}
		x = wt;
		temp ++;//每一行最后一个
		wt = w;
		switch(i)
		{
			case 0:{wt += w/2;}break;
			case 1:{wt = w;}break;
			case 2:{wt += w*3/4;}break;
			case 3:{wt += w+w/4;}break;
			default:break;
		}	
		getRwList()[temp] = new buttonWin(x,i*h,wt,h,keyb[temp],this,getQueue());
		((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
		((controlWin*)getRwList()[temp])->setBackColor(getBackColor());
		getRwList()[temp]->setWinProc(keyboardProc);
		getRwList()[temp]->registerWin();
		temp ++;
	}
	//line 4
	x = 2*w;
	for(i=0;i<5;i++)
	{
		if(i==2)
		{
			getRwList()[temp] = new buttonWin(x,4*h,w*5,h,keyb[temp],this,getQueue());
			((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
			((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor());
			getRwList()[temp]->setWinProc(keyboardProc);
			getRwList()[temp]->registerWin();
			x+=w*5;
		}else{
			getRwList()[temp] = new buttonWin(x,4*h,w,h,keyb[temp],this,getQueue());
			((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
			((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor());
			getRwList()[temp]->setWinProc(keyboardProc);
			getRwList()[temp]->registerWin();
			x += w;
		}
		temp++;
	}
	getRwList()[temp] = new buttonWin(0,4*h,2*w,h,"V",this,getQueue());
	((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
	((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor());
	getRwList()[temp]->setWinProc(keyboardProc);
	getRwList()[temp]->registerWin();
	temp++;
	getRwList()[temp] = new buttonWin(x,4*h,3*w+w/2,h,"V",this,getQueue());
	((controlWin*)getRwList()[temp])->setTextColor(getTextColor());
	((controlWin*)getRwList()[temp]) ->setBackColor(getBackColor());
	getRwList()[temp]->setWinProc(keyboardProc);
	getRwList()[temp]->registerWin();
	temp++;
		
}
Ejemplo n.º 16
0
	void EmptyWidget::paintBackground( const PaintEvent &paintEvent )
	{
		if(getBackColor().getA() > 0.0f)
		paintEvent.graphics()->drawFilledRectangle(getSizeRectangle(),getBackColor());
	}