当前位置: 首页>>代码示例>>C++>>正文


C++ drawButton函数代码示例

本文整理汇总了C++中drawButton函数的典型用法代码示例。如果您正苦于以下问题:C++ drawButton函数的具体用法?C++ drawButton怎么用?C++ drawButton使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drawButton函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: buttons

/*!
  Handles paint events for buttons.  Small and typically complex
  buttons (less than 300x100 pixels) are painted double-buffered to
  reduce flicker. The actually drawing is done in the virtual functions
  drawButton() and drawButtonLabel().

  \sa drawButton(), drawButtonLabel()
*/
void QButton::paintEvent( QPaintEvent *event )
{
    if ( event &&
	 width() <= drawingPixWidth &&
	 height() <= drawingPixHeight &&
	 backgroundMode() != X11ParentRelative ) {
	makeDrawingPixmap(); // makes file-static drawpm variable
	if ( backgroundOrigin() == ParentOrigin && !isTopLevel() )
	    drawpm->fill( this, x(), y() );
	else
	    drawpm->fill( this, 0, 0 );
	QPainter paint;
	paint.begin( drawpm, this );
	drawButton( &paint );
	paint.end();

	paint.begin( this );
	paint.drawPixmap( 0, 0, *drawpm );
	paint.end();
    } else {
	erase( event->region() );
	QPainter paint( this );
	drawButton( &paint );
    }
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:33,代码来源:qbutton.cpp

示例2: alphaRenderButton

void alphaRenderButton(uint8_t alphaPage, uint8_t col, uint8_t row, bool selected)
{
  char c = alphaKeys[alphaPage][row][col];
  char key[2] = { alphaKeys[alphaPage][row][col], '\0' };
  // Handle special characters
  switch (c)
  {
    case '<':
      // Backspace
      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, "<", selected); 
      break;
    case '*':
      // Page Shift
      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, "^", selected); 
      break;
    case '>':
      // OK
      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, "OK", selected); 
      break;
    default:
      // Standard character
      drawButton (alphaBtnX[col], alphaBtnY[row], ALPHA_BTN_WIDTH, ALPHA_BTN_HEIGHT, &dejaVuSans9ptFontInfo, 7, key, selected); 
      break;
  }
}
开发者ID:pal73,项目名称:fat470,代码行数:25,代码来源:alphanumeric.c

示例3: drawButton

void HardwareButtons::drawButtons(int highlighted_group) const
{
    drawButton(0, 0 == highlighted_group, *display::graphics.screen(), 8, _y);
    drawButton(1, 1 == highlighted_group, *display::graphics.screen(), 84, _y);
    drawButton(2, 2 == highlighted_group, *display::graphics.screen(), 165, _y);
    drawButton(3, 3 == highlighted_group, *display::graphics.screen(), 246, _y);
}
开发者ID:BlastarIndia,项目名称:raceintospace,代码行数:7,代码来源:hardware_buttons.cpp

示例4: showPauseMenu

extern void showPauseMenu(MI0283QT9 lcd){
	lcd.fillScreen(BACKGROUND);
	
	while(1){
		
		
		lcd.drawText(centerText("Pause", 3), 15, "Pause", OBJECTCOLOR, BACKGROUND, 3);
		if(drawButton(lcd, "Resume Game", 20, 75, 200, 40)){	
			showDefaultLayout(lcd);
			break;
		}
		if(drawButton(lcd, "Restart Game", 20, 135, 200, 40)){
			restartGame = 1;
			break;
		}	
		if(drawButton(lcd, "Settings", 20, 195, 200, 40)){
			showSettingMenu(lcd);
		}
		if(drawButton(lcd, "Main Menu", 20, 255, 200, 40)){
			returnToMain = 1;
			break;
		}
		
	}
}
开发者ID:kleinemichiel,项目名称:racegameInc,代码行数:25,代码来源:PauseMenu.cpp

示例5: renderDemo

void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height,
				float t, int blowup, struct DemoData* data)
{
	float x,y,popy;

	drawEyes(vg, width - 250, 50, 150, 100, mx, my, t);
	drawParagraph(vg, width - 450, 50, 150, 100, mx, my);
	drawGraph(vg, 0, height/2, width, height/2, t);
	drawColorwheel(vg, width - 300, height - 300, 250.0f, 250.0f, t);

	// Line joints
	drawLines(vg, 50, height-50, 600, 50, t);

	// Line caps
	drawWidths(vg, 10, 50, 30);

	// Line caps
	drawCaps(vg, 10, 300, 30);

	nvgSave(vg);
	if (blowup) {
		nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
		nvgScale(vg, 2.0f, 2.0f);
	}

	// Widgets
	drawWindow(vg, "Widgets `n Stuff", 50, 50, 300, 400);
	x = 60; y = 95;
	drawSearchBox(vg, "Search", x,y,280,25);
	y += 40;
	drawDropDown(vg, "Effects", x,y,280,28);
	popy = y + 14;
	y += 45;

	// Form
	drawLabel(vg, "Login", x,y, 280,20);
	y += 25;
	drawEditBox(vg, "Email",  x,y, 280,28);
	y += 35;
	drawEditBox(vg, "Password", x,y, 280,28);
	y += 38;
	drawCheckBox(vg, "Remember me", x,y, 140,28);
	drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255));
	y += 45;

	// Slider
	drawLabel(vg, "Diameter", x,y, 280,20);
	y += 25;
	drawEditBoxNum(vg, "123.00", "px", x+180,y, 100,28);
	drawSlider(vg, 0.4f, x,y, 170,28);
	y += 55;

	drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255));
	drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0));

	// Thumbnails box
	drawThumbnails(vg, 365, popy-30, 160, 300, data->images, 12, t);

	nvgRestore(vg);
}
开发者ID:jacereda,项目名称:nanovg,代码行数:60,代码来源:demo.c

示例6: drawButton

void ButtonWaiterButton::draw(Renderer *renderer, const FontID defaultFont, const SamplerStateID linearClamp, const BlendStateID blendSrcAlpha, const DepthStateID depthState){
	if (waitingForButton){
		drawButton(renderer, "<Press button>", defaultFont, linearClamp, blendSrcAlpha, depthState);
	} else {
		drawButton(renderer, text, defaultFont, linearClamp, blendSrcAlpha, depthState);
	}
}
开发者ID:dtrebilco,项目名称:PreMulAlpha,代码行数:7,代码来源:Button.cpp

示例7: QBrush

/*!\reimp
 */
void
QWindowsStyle::drawPushButton( QPushButton* btn, QPainter *p)
{
#ifndef QT_NO_PUSHBUTTON
    QColorGroup g = btn->colorGroup();
    int x1, y1, x2, y2;

    btn->rect().coords( &x1, &y1, &x2, &y2 );	// get coordinates

    p->setPen( g.foreground() );
    p->setBrush( QBrush(g.button(),NoBrush) );

    int diw = buttonDefaultIndicatorWidth();
    if ( btn->isDefault() || btn->autoDefault() ) {
	if ( btn->isDefault() ) {
	    p->setPen( g.shadow() );
	    p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
	}
	x1 += diw;
	y1 += diw;
	x2 -= diw;
	y2 -= diw;
    }

    bool clearButton = TRUE;
    if ( btn->isDown() ) {
	if ( btn->isDefault() ) {
	    p->setPen( g.dark() );
	    p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
	} else {
	    drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE,
			&g.brush( QColorGroup::Button ) );
	}
    } else {
	if ( btn->isToggleButton() && btn->isOn() && btn->isEnabled() ) {
	    QBrush fill(g.light(), Dense4Pattern );
	    drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE, &fill );
	    clearButton = FALSE;
	} else {
	    if ( !btn->isFlat() )
		drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, btn->isOn(),
			&g.brush( QColorGroup::Button ) );
	}
    }
    if ( clearButton ) {
	if (btn->isDown())
	    p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
	p->fillRect( x1+2, y1+2, x2-x1-3, y2-y1-3,
		     g.brush( QColorGroup::Button ) );
	if (btn->isDown())
	    p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
    }

    if ( p->brush().style() != NoBrush )
	p->setBrush( NoBrush );

#endif
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:60,代码来源:qwindowsstyle.cpp

示例8: showSettingMenu

//main menu with buttons for accesing sub menus 
extern void showSettingMenu(MI0283QT9 lcd){
	
	lcd.fillScreen(BACKGROUND);
	
	while(1){
		if(returnToMain){
			returnToMain=0;
			lcd.fillScreen(BACKGROUND);
			break;
		}
		
		char title[] = "Settings";
		uint8_t lengthOfString = (strlen(title) * 26); 
		uint8_t x = (240 - lengthOfString);
		
		lcd.drawText(x, 15, title, OBJECTCOLOR, BACKGROUND, 3);
		
		//button for opening sub menu difficulty
		if(drawButton(lcd, "Player", 20, 75, 200, 40))
		{
			lcd.fillScreen(BACKGROUND);
			ShowPlayerSettings(lcd);
		}
		
		//button for opening sub menu generator
		if(drawButton(lcd, "Generator", 20, 135, 200, 40))
		{
			lcd.fillScreen(BACKGROUND);
			showGenerator(lcd);
		}
		
		//button for resetting score
		if(drawButton(lcd, "Reset Score", 20, 195, 200, 40)){
			EEPROM.write(171, 0);
			EEPROM.write(174, 'A');
			EEPROM.write(175, 'A');
			EEPROM.write(176, 'A');
			
			EEPROM.write(172, 0);
			EEPROM.write(177, 'A');
			EEPROM.write(178, 'A');
			EEPROM.write(179, 'A');
			
			EEPROM.write(173, 0);
			EEPROM.write(180, 'A');
			EEPROM.write(181, 'A');
			EEPROM.write(182, 'A');
		}
		
		//button to return to main menu
		if(drawButton(lcd, "Back", 20, 270, 200, 40)){
			lcd.fillScreen(BACKGROUND);
			break;
		}
	}
}
开发者ID:kleinemichiel,项目名称:racegameInc,代码行数:57,代码来源:SettingsMenu.cpp

示例9: showGameOverMenuMP

void showGameOverMenuMP(MI0283QT9 lcd, uint16_t score, uint8_t won){
	lcd.fillScreen(BACKGROUND);
	exitMultiplayer();
	while(1){
		if(won){
			char title[] = "You Won!";
			
			lcd.drawText(centerText(title,3), 15, title, OBJECTCOLOR, BACKGROUND, 3);
			
			
			lcd.drawText(centerText("Your Score:", 2), 60, "Your Score:", OBJECTCOLOR, BACKGROUND, 2);
			
			lcd.drawInteger(70, 100, score, DEC, OBJECTCOLOR, BACKGROUND, 3);
			
			
			if(drawButton(lcd, "Restart", 20, 220, 200, 40))
			{
				showMpMenu(lcd);
			}
			
			//return to main menu. You will first break to the game loop. In the game loop is an if statement. If return to main = 1 then you will break to the main menu.
			if(drawButton(lcd, "Main Menu", 20, 270, 200, 40))
			{
				lcd.fillScreen(BACKGROUND);
				returnToMain = 1;
				break;
			}
			
		}else if(!won){
			char title[] = "You Lost!";
			
			lcd.drawText(centerText(title,3), 15, title, OBJECTCOLOR, BACKGROUND, 3);
			
			
			lcd.drawText(centerText("Your Score:", 2), 60, "Your Score:", OBJECTCOLOR, BACKGROUND, 2);
			
			lcd.drawInteger(70, 100, score, DEC, OBJECTCOLOR, BACKGROUND, 3);
			
			
			if(drawButton(lcd, "Restart", 20, 220, 200, 40))
			{
				showMpMenu(lcd);
			}
			
			//return to main menu. You will first break to the game loop. In the game loop is an if statement. If return to main = 1 then you will break to the main menu.
			if(drawButton(lcd, "Main Menu", 20, 270, 200, 40))
			{
				lcd.fillScreen(BACKGROUND);
				returnToMain = 1;
				break;
			}
		}
	}
}
开发者ID:kleinemichiel,项目名称:racegameInc,代码行数:54,代码来源:GameOverMenu.cpp

示例10: drawButton

	void TitleBar::drawButtons() const
	{
		if (!m_hasTitleBar)
		{
			return;
		}

		drawButton(TBII_MINIMIZE_BUTTON, DFCS_CAPTIONMIN);
		drawButton(TBII_MAXIMIZE_BUTTON, IsZoomed(m_hwnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX);
		drawButton(TBII_HELP_BUTTON, DFCS_CAPTIONHELP);
		drawButton(TBII_CLOSE_BUTTON, DFCS_CAPTIONCLOSE);
	}
开发者ID:narzoul,项目名称:DDrawCompat,代码行数:12,代码来源:TitleBar.cpp

示例11: showGameOverMenuMP

void showGameOverMenuMP(MI0283QT9 lcd, uint16_t score){
	while(1){
		if(true /*you won */){
			char title[] = "You Won!";
			
			lcd.drawText(centerText(title,3), 15, title, OBJECTCOLOR, BACKGROUND, 3);
			
			
			lcd.drawText(centerText("Your Score:", 2), 60, "Your Score:", OBJECTCOLOR, BACKGROUND, 2);
			
			lcd.drawInteger(70, 100, score, DEC, OBJECTCOLOR, BACKGROUND, 3);
			
			
			if(drawButton(lcd, "Restart", 20, 220, 200, 40))
			{
				showMpMenu(lcd);
			}
			
			//button for opening sub menu generator
			if(drawButton(lcd, "Main Menu", 20, 270, 200, 40))
			{
				lcd.fillScreen(BACKGROUND);
				returnToMain = 1;
				break;
			}
			
		}else{
			char title[] = "You Lost!";
			
			lcd.drawText(centerText(title,3), 15, title, OBJECTCOLOR, BACKGROUND, 3);
			
			
			lcd.drawText(centerText("Your Score:", 2), 60, "Your Score:", OBJECTCOLOR, BACKGROUND, 2);
			
			lcd.drawInteger(70, 100, score, DEC, OBJECTCOLOR, BACKGROUND, 3);
			
			
			if(drawButton(lcd, "Restart", 20, 220, 200, 40))
			{
				showMpMenu(lcd);
			}
			
			//button for opening sub menu generator
			if(drawButton(lcd, "Main Menu", 20, 270, 200, 40))
			{
				lcd.fillScreen(BACKGROUND);
				returnToMain = 1;
				break;
			}
		}
	}
}
开发者ID:kleinemichiel,项目名称:racegameInc,代码行数:52,代码来源:GameOverMenu.cpp

示例12: drawButton

void ItemView::drawButtons(const Cairo::RefPtr<Cairo::Context>& cr, const int width, const int height)
{
    cr->save();

    cr->set_antialias(Cairo::ANTIALIAS_NONE);

    if (isSelected())
    {
        drawButton(cr, Resources::res->imgBtnDelete, rectBtnDelete);
        drawButton(cr, Resources::res->imgBtnEdit, rectBtnEdit);
    }

    cr->restore();
}
开发者ID:pzagawa,项目名称:myagenda,代码行数:14,代码来源:NoteItemView.cpp

示例13: setForeground

void SaveDialog::onExpose(XEvent& /* event */) {
    setForeground(getBackground());
    fillRectangle(m_IWinRect);

    setForeground(textColor);
    drawString(
        editor->leftMargin,
        editor->statusLineMargin + editor->ascent,
        "A text has been changed, save it?"
    );

    drawButton(yesButtonRect, "Yes");
    drawButton(noButtonRect, "No");
    drawButton(cancelButtonRect, "Cancel");
}
开发者ID:tokar1,项目名称:mech-math,代码行数:15,代码来源:TextEdit.cpp

示例14: drawButton

void UI_ArduinoPhone::drawButtons()
{
    for(int i = 0; i<12; i++)        
    {
        drawButton(pgm_read_word(&__xyButton[i][0]), pgm_read_word(&__xyButton[i][1]));
    }
}
开发者ID:0xPIT,项目名称:ArduinoPhone,代码行数:7,代码来源:UI_ArduinoPhone.cpp

示例15: yet

void CInput::renderOverlay()
{
#ifdef USE_OPENGL // only ogl supported yet (and probably worth)
#if defined(MOUSEWRAPPER)
	static bool showControls = true;
	static bool buttonShowHideCtrlWasDown = false;

	TouchButton* phoneButtons = getPhoneButtons(InputCommand);

	for(int i = phoneButtonN - 1; i >= 0; --i) {
		TouchButton& b = phoneButtons[i];
		bool down = phoneButton_MouseIndex[i].size() > 0;
        if(i==0)
        {
            if (phoneButton_MouseIndex[1].size() > 0 || phoneButton_MouseIndex[7].size() > 0)
                down = true;
        }
        if(i==2 || i==4 || i == 6)
        {
            if (phoneButton_MouseIndex[i-1].size() > 0 || phoneButton_MouseIndex[i+1].size() > 0)
                down = true;
        }
		if((showControls && !b.invisible) || b.immediateIndex == KSHOWHIDECTRLS) drawButton(b, down);

		if(b.immediateIndex == KSHOWHIDECTRLS) {
			if(buttonShowHideCtrlWasDown && !down)
				showControls = !showControls;
			buttonShowHideCtrlWasDown = down;
		}
	}
#endif
#endif
}
开发者ID:carstene1ns,项目名称:Commander-Genius,代码行数:33,代码来源:CInput.cpp


注:本文中的drawButton函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。