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


C++ Menu::SetText方法代码示例

本文整理汇总了C++中Menu::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ Menu::SetText方法的具体用法?C++ Menu::SetText怎么用?C++ Menu::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Menu的用法示例。


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

示例1: Window

/**
*  @brief
*    Constructor
*/
TestWindow::TestWindow(Widget *pParent) : Window(pParent),
	EventHandlerTrayClicked(&TestWindow::TrayClicked, this),
	EventHandlerClicked(&TestWindow::ButtonClicked, this),
	EventHandlerPressed(&TestWindow::ButtonPressed, this),
	EventHandlerReleased(&TestWindow::ButtonReleased, this),
	EventHandlerMenu(&TestWindow::MenuClicked, this),
	m_pLabel(nullptr),
	m_pButton(nullptr),
	m_pToggleButton(nullptr),
	m_pClickTest(nullptr),
	m_pPressedTest(nullptr),
	m_pBitmapButton(nullptr),
	m_pBitmapToggleButton(nullptr),
	m_cMenu(*GetGui()),
	m_pMenuBar(nullptr),
//	m_pTabBar(nullptr),
	m_pPopupMenu(nullptr),
	m_cTrayIcon(*GetGui()),
	m_bClicked(false)
{
	// Create a tray icon
	m_cTrayIcon.SetTooltip(L"Hallo!!");
	m_cTrayIcon.SetIcon(Image(*Gui::GetSystemGui()));
	m_cTrayIcon.EventMouseButtonDown.Connect(EventHandlerTrayClicked);

	// Create some widgets
	m_pLabel = new Label(GetContentWidget());
		m_pLabel->SetText("Hallo!");
		m_pLabel->SetPos(Vector2i(10, 30));
		m_pLabel->SetSize(Vector2i(200, 32));
		m_pLabel->SetVisible(true);
	m_pButton = new Button(GetContentWidget());
		m_pButton->SetImage(Image(*Gui::GetSystemGui(), "PLGui/copy.png"));
		m_pButton->SetText("Button");
		m_pButton->SetPos(Vector2i(10, 70));
		m_pButton->SetSize(Vector2i(120, 32));
		m_pButton->SetVisible(true);
		m_pButton->SetRepeat(true);
		m_pButton->SetRepeatDelay(1000);
		m_pButton->SetRepeatInterval(250);
	m_pToggleButton = new ToggleButton(GetContentWidget());
		m_pToggleButton->SetText("Toggle");
		m_pToggleButton->SetPos(Vector2i(10, 110));
		m_pToggleButton->SetSize(Vector2i(120, 32));
		m_pToggleButton->SetVisible(true);
	m_cCheckGroup.SetExclusive(false);
	for (int i=0; i<4; i++) {
		m_pCheckBoxes[i] = new CheckBox(GetContentWidget());
			m_pCheckBoxes[i]->SetGroup(&m_cCheckGroup);
			m_pCheckBoxes[i]->SetPartiallyAllowed(true);
			m_pCheckBoxes[i]->SetState(PartiallyChecked);
			m_pCheckBoxes[i]->SetText(String("Check Box ") + i);
			m_pCheckBoxes[i]->SetPos(Vector2i(10, 150 + i*20));
			m_pCheckBoxes[i]->SetSize(Vector2i(100, 20));
			m_pCheckBoxes[i]->SetVisible(true);
		m_pRadioButtons[i] = new RadioButton(GetContentWidget());
			m_pRadioButtons[i]->SetGroup(&m_cRadioGroup);
			m_pRadioButtons[i]->SetState(Checked);
			m_pRadioButtons[i]->SetText(String("Radio Button ") + i);
			m_pRadioButtons[i]->SetPos(Vector2i(150, 150 + i*20));
			m_pRadioButtons[i]->SetSize(Vector2i(100, 20));
			m_pRadioButtons[i]->SetVisible(true);
	}

	m_pClickTest = new Widget(GetContentWidget());
		m_pClickTest->SetBackgroundColor(Color4::Red);
		m_pClickTest->SetPos(Vector2i(150, 70));
		m_pClickTest->SetSize(Vector2i(32, 32));
		m_pClickTest->SetVisible(true);
	m_pPressedTest = new Widget(GetContentWidget());
		m_pPressedTest->SetBackgroundColor(Color4::Blue);
		m_pPressedTest->SetPos(Vector2i(200, 70));
		m_pPressedTest->SetSize(Vector2i(32, 32));
		m_pPressedTest->SetVisible(true);
	m_pBitmapButton = new BitmapButton(GetContentWidget());
		m_pBitmapButton->SetImageEnabled (Image(*Gui::GetSystemGui(), "PLGui/button.png"));
		m_pBitmapButton->SetImageDisabled(Image(*Gui::GetSystemGui(), "PLGui/button-inactive.png"));
		m_pBitmapButton->SetImageSelected(Image(*Gui::GetSystemGui(), "PLGui/button-over.png"));
		m_pBitmapButton->SetImagePressed (Image(*Gui::GetSystemGui(), "PLGui/button-pressed.png"));
		m_pBitmapButton->SetPos(Vector2i(10, 230));
		m_pBitmapButton->SetSize(Vector2i(64, 64));
		m_pBitmapButton->SetVisible(true);
	m_pBitmapToggleButton = new BitmapToggleButton(GetContentWidget());
		m_pBitmapToggleButton->SetImageDisabled  (Image(*Gui::GetSystemGui(), "PLGui/button-inactive.png"));
		m_pBitmapToggleButton->SetImageUnselected(NotChecked,		Image(*Gui::GetSystemGui(), "PLGui/button-off.png"));
		m_pBitmapToggleButton->SetImageUnselected(PartiallyChecked,	Image(*Gui::GetSystemGui(), "PLGui/button-on.png"));
		m_pBitmapToggleButton->SetImageUnselected(Checked,			Image(*Gui::GetSystemGui(), "PLGui/button-on.png"));
		m_pBitmapToggleButton->SetImageSelected  (NotChecked,		Image(*Gui::GetSystemGui(), "PLGui/button-over-off.png"));
		m_pBitmapToggleButton->SetImageSelected  (PartiallyChecked,	Image(*Gui::GetSystemGui(), "PLGui/button-over-on.png"));
		m_pBitmapToggleButton->SetImageSelected  (Checked,			Image(*Gui::GetSystemGui(), "PLGui/button-over-on.png"));
		m_pBitmapToggleButton->SetPos(Vector2i(10, 300));
		m_pBitmapToggleButton->SetSize(Vector2i(64, 64));
		m_pBitmapToggleButton->SetVisible(true);

	// Connect event handlers to button
	m_pButton->SignalClicked .Connect(EventHandlerClicked);
//.........这里部分代码省略.........
开发者ID:ByeDream,项目名称:pixellight,代码行数:101,代码来源:TestWindow.cpp


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