本文整理汇总了C++中ToolBar::addWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolBar::addWidget方法的具体用法?C++ ToolBar::addWidget怎么用?C++ ToolBar::addWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolBar
的用法示例。
在下文中一共展示了ToolBar::addWidget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildGui
void buildGui() {
// status bar
new StatusBar(0,0,CON_WIDTH,1);
VBox *vbox=new VBox(0,2,1);
// stats
ToolBar *stats = new ToolBar(0,0,21,"Stats","Statistics about the current dungeon");
stats->addWidget(new Label(0,0,wallRatioTxt,"Ratio of wall cells / total number of cells"));
stats->addWidget(new Label(0,0,seedTxt,"Current random seed used to build the map"));
vbox->addWidget(stats);
}
示例2: Application
//-------------------------------------------------------------------------------------------------
// Main application
//-------------------------------------------------------------------------------------------------
App::App(int argc, char* argv[])
: Application(&argc, &argv, OptDaleAuto),
_sipComponent(NULL),
_pid(0)
{
setLayout(new HBoxLayout());
setMargins(5, 5, 5, 5);
//-------------------------------------------------------------------------------------------------
// Create toolbar
//-------------------------------------------------------------------------------------------------
ToolBar* bar = new ToolBar();
setToolbar(bar);
_baresip = new ToolButton("Offline");
_baresip->setIcon(StyleHint::Network);
_baresip->setInputMethod(NoInput);
_baresip->setDrawFrame(false);
bar->addWidget(_baresip);
bar->addWidget(new Spacer(Horizontal));
_contactsButton = new ToolBarButton("Contacts");
_contactsButton->setIcon(StyleHint::Contacts2);
_contactsButton->sigClicked.connect(sigc::bind<int>(sigc::mem_fun(this, &App::showScreen), 0));
bar->addWidget(_contactsButton);
_historyButton = new ToolBarButton("Call Log");
_historyButton->setIcon(StyleHint::Contacts1);
_historyButton->sigClicked.connect(sigc::bind<int>(sigc::mem_fun(this, &App::showScreen), 1));
bar->addWidget(_historyButton);
_settingsButton = new ToolBarButton("Settings");
_settingsButton->setIcon(StyleHint::Settings);
_settingsButton->sigClicked.connect(sigc::bind<int>(sigc::mem_fun(this, &App::showScreen), 2));
bar->addWidget(_settingsButton);
_holdButton = new ToolBarButton("Hold");
_holdButton->setVisible(false);
_holdButton->setIcon(StyleHint::Pause);
_holdButton->sigClicked.connect(sigc::mem_fun(this, &App::holdCall));
bar->addWidget(_holdButton);
_muteButton = new ToolBarButton("Mute");
_muteButton->setVisible(false);
_muteButton->setIcon(StyleHint::VolumeMuted);
_muteButton->sigClicked.connect(sigc::mem_fun(this, &App::muteCall));
bar->addWidget(_muteButton);
_hangupButton = new ToolBarButton("Hang Up");
_hangupButton->setVisible(false);
_hangupButton->setIcon(StyleHint::Hangup);
_hangupButton->sigClicked.connect(sigc::mem_fun(this, &App::hangupCall));
bar->addWidget(_hangupButton);
//-------------------------------------------------------------------------------------------------
// Create views
//-------------------------------------------------------------------------------------------------
_manager = new ContactManager();
_contacts = new Contacts(_manager);
_contacts->sigCall.connect(sigc::mem_fun(this, &App::callContact));
addWidget(_contacts);
_history = new History();
_history->sigCall.connect(sigc::mem_fun(this, &App::callContact));
_history->setVisible(false);
addWidget(_history);
_settings = new Settings();
_settings->setVisible(false);
addWidget(_settings);
_call = new Call();
_call->setVisible(false);
_call->sigHangup.connect(sigc::mem_fun(this, &App::hangupCall));
addWidget(_call);
_rightPanel = new VBoxLayout();
addWidget(_rightPanel);
_dialer = new Dialer();
_rightPanel->addWidget(_dialer);
_status = new Status();
_rightPanel->addWidget(_status);
//-------------------------------------------------------------------------------------------------
// Incoming call dialog
//-------------------------------------------------------------------------------------------------
_incomingCall = new Dialog("Incoming Call", Dialog::YesNoButtonOption);
_incomingCall->setLayout(new VBoxLayout());
_caller = new Label("");
Size s = _caller->preferredSize();
_caller->setMinimumSize(PlatformManager::instance().getLayerSize().width() - 200, s.height());
_incomingCall->addWidget(_caller);
_incomingCall->addWidget(new Label("Do you wish to accept?"));
//.........这里部分代码省略.........
示例3: Application
WidgetsDemo::WidgetsDemo(int argc, char* argv[])
: Application(&argc, &argv, (AppOptions) (OptDaleAuto | OptSound))
{
setMargins(5, 5, 5, 5);
setLayout(new VBoxLayout());
// ToolBar
ToolBar* bar = new ToolBar();
bar->addWidget(new Label("ilixi_widgets"));
bar->addWidget(new Spacer(Horizontal));
ToolBarButton* barButton = new ToolBarButton("Quit");
barButton->setIcon(StyleHint::Cross);
barButton->sigClicked.connect(sigc::ptr_fun(WidgetsDemo::quit));
bar->addWidget(barButton);
setToolbar(bar);
// TabPanel
TabPanel* tab = new TabPanel();
// tab->surface()->setSurfaceFlag(Surface::SubSurface);
// tab->surface()->unsetSurfaceFlag(Surface::SharedSurface);
addWidget(tab);
// Buttons Tab
VBoxLayout* vBox = new VBoxLayout();
tab->addTab(vBox, "Tab 1");
// Label
vBox->addWidget(createLabelGroup());
vBox->addWidget(new LineSeperator());
// CheckBox and RadioButton
HBoxLayout* box1 = new HBoxLayout();
box1->addWidget(createCheckGroup());
box1->addWidget(createRadioGroup());
vBox->addWidget(box1);
vBox->addWidget(new LineSeperator());
// PushButton
vBox->addWidget(createPBGroup());
vBox->addWidget(new LineSeperator());
// ToolButton
vBox->addWidget(createTBGroup());
vBox->addWidget(new LineSeperator());
// ButtonGroup
DirectionalButton* db1 = new DirectionalButton("Left");
DirectionalButton* db2 = new DirectionalButton("1");
DirectionalButton* db3 = new DirectionalButton("2");
DirectionalButton* db4 = new DirectionalButton("3");
DirectionalButton* db5 = new DirectionalButton("Right");
ButtonGroup* bg = new ButtonGroup(Horizontal);
bg->addButton(db1);
bg->addButton(db2);
bg->addButton(db3);
bg->addButton(db4);
bg->addButton(db5);
vBox->addWidget(bg);
vBox->addWidget(new Spacer(Vertical));
// Disabled
VBoxLayout* vBox4 = new VBoxLayout();
tab->addTab(vBox4, "Tab 2");
tab->setTabEnabled(1, false);
// LineInput Tab
VBoxLayout* vBox2 = new VBoxLayout();
tab->addTab(vBox2, "Tab 3");
LineInput *li1 = new LineInput("123...");
li1->sigTextEntered.connect(sigc::mem_fun(this, &WidgetsDemo::print));
vBox2->addWidget(li1);
vBox2->addWidget(new Spacer(Vertical));
LineInput *li2 = new LineInput("Line input has some text...");
vBox2->addWidget(li2);
vBox2->addWidget(new Spacer(Vertical));
LineInput *li3 = new LineInput("Line input has some text...");
vBox2->addWidget(li3);
vBox2->addWidget(new Spacer(Vertical));
LineInput *li4 = new LineInput("Line input has some text...");
vBox2->addWidget(li4);
li4->setDisabled();
vBox2->addWidget(new Spacer(Vertical));
LineInput *li5 = new LineInput("Line input has some text...");
vBox2->addWidget(li5);
VBoxLayout* vBox3 = new VBoxLayout();
tab->addTab(vBox3, "Tab 4");
ProgressBar* bar1 = new ProgressBar();
bar1->setValue(5);
vBox3->addWidget(bar1);
ProgressBar* bar1d = new ProgressBar();
//.........这里部分代码省略.........
示例4: buildGui
void buildGui() {
// status bar
new StatusBar(0,0,HM_WIDTH,1);
VBox *vbox=new VBox(0,2,1);
// stats
ToolBar *stats = new ToolBar(0,0,21,"Stats","Statistics about the current map");
stats->addWidget(new Label(0,0,landMassTxt,"Ratio of land surface / total surface"));
stats->addWidget(new Label(0,0,minZTxt,"Minimum z value in the map"));
stats->addWidget(new Label(0,0,maxZTxt,"Maximum z value in the map"));
stats->addWidget(new Label(0,0,seedTxt,"Current random seed used to build the map"));
vbox->addWidget(stats);
// tools
ToolBar *tools=new ToolBar(0,0,15,"Tools","Tools to modify the heightmap");
tools->addWidget(new Button("cancel","Delete the selected operation",cancelCbk,NULL));
tools->addWidget(new Button("clear","Remove all operations and reset all heightmap values to 0.0",clearCbk,NULL));
tools->addWidget(new Button("reseed","Replay all operations with a new random seed",reseedCbk,NULL));
// operations
tools->addSeparator("Operations","Apply a new operation to the map");
addOperationButton(tools,Operation::NORM,normalizeCbk);
addOperationButton(tools,Operation::ADDFBM,addFbmCbk);
addOperationButton(tools,Operation::SCALEFBM,scaleFbmCbk);
addOperationButton(tools,Operation::ADDHILL,addHillCbk);
addOperationButton(tools,Operation::RAIN,rainErosionCbk);
addOperationButton(tools,Operation::SMOOTH,smoothCbk);
addOperationButton(tools,Operation::VORONOI,voronoiCbk);
addOperationButton(tools,Operation::NOISELERP,noiseLerpCbk);
addOperationButton(tools,Operation::ADDLEVEL,raiseLowerCbk);
// display
tools->addSeparator("Display","Change the type of display");
RadioButton::setDefaultGroup(1);
RadioButton *colormap=new RadioButton("colormap","Enable colormap mode",colorMapCbk,NULL);
tools->addWidget(colormap);
colormap->select();
tools->addWidget(new RadioButton("slope","Enable slope mode",slopeCbk,NULL));
tools->addWidget(new RadioButton("greyscale","Enable greyscale mode",greyscaleCbk,NULL));
tools->addWidget(new RadioButton("normal","Enable normal map mode",normalCbk,NULL));
tools->addWidget(new Button("change colormap","Modify the colormap used by hmtool", changeColorMapCbk,NULL));
// change colormap gui
colorMapGui=new ToolBar(0,0,"Colormap","Select the color and position of the keys in the color map");
colorMapGui->setVisible(false);
// in/out
tools->addSeparator("In/Out","Import/Export stuff");
tools->addWidget(new Button("export C","Generate the C code for this heightmap in ./hm.c",exportCCbk,NULL));
tools->addWidget(new Button("export CPP","Generate the CPP code for this heightmap in ./hm.cpp",exportCppCbk,NULL));
tools->addWidget(new Button("export PY","Generate the python code for this heightmap in ./hm.py",exportPyCbk,NULL));
tools->addWidget(new Button("export bmp","Save this heightmap as a bitmap in ./hm.bmp",exportBmpCbk,NULL));
vbox->addWidget(tools);
// params box
params = new ToolBar(0,0,"Params","Parameters of the current tool");
vbox->addWidget(params);
params->setVisible(false);
// history
history = new ToolBar(0,tools->y+1+tools->h,15,"History","History of operations");
vbox->addWidget(history);
}
示例5: drawMainInterface
void GraphicsTCOD::drawMainInterface()
{
Widget::setConsole(output);
HBox *hMenu=new HBox(12,-1,0);
ToolBar *menuToolbar = new ToolBar(0,0,6,NULL,NULL);
menuToolbar->addWidget(new Button("Menu",NULL,menuCbk,NULL));
hMenu->addWidget(menuToolbar);
ToolBar *playerToolbar = new ToolBar(0,0,6, NULL, NULL);
playerToolbar->addWidget(new Button("Player", NULL, NULL, NULL));
hMenu->addWidget(playerToolbar);
ToolBar *socialToolbar = new ToolBar(0,0,6, NULL, NULL);
socialToolbar->addWidget(new Button("Social", NULL, NULL, NULL));
hMenu->addWidget(socialToolbar);
ToolBar *worldToolbar = new ToolBar(0,0,6, NULL, NULL);
worldToolbar->addWidget(new Button("World", NULL, NULL, NULL));
hMenu->addWidget(worldToolbar);
ToolBar *toolsToolbar = new ToolBar(0,0,6, NULL, NULL);
toolsToolbar->addWidget(new Button("Tools", NULL, NULL, NULL));
hMenu->addWidget(toolsToolbar);
ToolBar *helpToolbar = new ToolBar(0,0,6, NULL, NULL);
helpToolbar->addWidget(new Button("Help", NULL, NULL, NULL));
hMenu->addWidget(helpToolbar);
hMenu->setBackgroundColor(TCODColor(0,0,0), TCODColor(128,128,128));
chatBox = new ScrollBox(0, 0, textOutputConsole->getWidth(), textOutputConsole->getHeight(), 512, textOutputConsole, cMap, this);
serverBox = new ScrollBox(0, 0, serverConsole->getWidth(), serverConsole->getHeight()-2, 512, serverConsole, cMap, this);
//serverBox->setConsole(serverConsole);
chatBox->setRealPosition(0, 32);
chatBox->takeCommands(true);
commandConsole = chatBox;
serverBox->setRealPosition(MAIN_WIDTH/2, 32);
serverBox->takeCommands(true);
serverBox->insertText("Welcome to The ASCII Project");
serverBox->insertText(" Version 0.0.0o ");
serverBox->insertText(" ");
serverBox->insertText("Tip: all server input begins with ");
serverBox->insertText("The / character.");
serverBox->insertText(" ");
serverBox->insertText(" ");
serverBox->insertText(" ");
serverBox->insertText("Please /connect to continue...");
sConsole = chatBox;
inputText = new TCODText(1, serverConsole->getHeight()-2, serverConsole->getWidth()-2, 1, serverConsole->getWidth()-2);
inputText->setProperties(32, 1000, "$>", 1);
inputText->setColors(TCODColor(0,255,0), TCODColor(0,0,0), 1.0f);
inputText->render(serverConsole);
//offscreenConsole->print(0,0, "Welcome To The ASCII Project");
serverConsole->hline(0,serverConsole->getHeight()-1, serverConsole->getWidth());
serverConsole->hline(0,serverConsole->getHeight()-3, serverConsole->getWidth());
serverConsole->vline(0,0, serverConsole->getHeight());
serverConsole->vline(serverConsole->getWidth()-1,0, serverConsole->getHeight());
bool textInput = false;
bool popupOpen = false;
//bool placeActionMode = false;
unpacking = true;
connected = false;
loggedIn = false;
commandMode = false;
APIinQueue = false;
chatMessageInQueue = false;
actionMode = "placeFloor";
chatText = "";
boost::asio::io_service pri_io_service;
tcp::resolver pri_resolver(pri_io_service);
if(DEBUG_MODE)
{
tcp::resolver::query pri_query("localhost", "5250");
tcp::resolver::iterator iterator = pri_resolver.resolve(pri_query);
//.........这里部分代码省略.........
示例6: drawMenu
void GraphicsTCOD::drawMenu()
{
Widget::setConsole(output);
//new StatusBar(0,0,MAP_WINDOW_WIDTH,1);
VBox *vbox=new VBox(MAIN_WIDTH/2 - 7,MAIN_HEIGHT/2 + 10,0);
ToolBar *mainMenu = new ToolBar(MAIN_WIDTH/2 - 7,MAIN_HEIGHT/2 + 10,15,NULL,NULL);
//stats->addWidget(new Label(MAP_WINDOW_WIDTH/2 - 7,MAP_WINDOW_HEIGHT/2 - 6,"Login","Login"));
mainMenu->addWidget(new Button("Connect",NULL,loginCbk,NULL));
//stats->addWidget(new Label(MAP_WINDOW_WIDTH/2 - 7,MAP_WINDOW_HEIGHT/2 - 5,"New Account","New Account"));
//stats->addWidget(new Button("New Account",NULL,newAccountCbk,NULL));
//stats->addWidget(new Label(MAP_WINDOW_WIDTH/2 - 7,MAP_WINDOW_HEIGHT/2 - 4,"Options","Options"));
mainMenu->addWidget(new Button("Options",NULL,NULL,NULL));
//stats->addWidget(new Label(MAP_WINDOW_WIDTH/2 - 7,MAP_WINDOW_HEIGHT/2 - 3,"Quit","Quit"));
mainMenu->addWidget(new Button("Quit",NULL,quitCbk,NULL));
vbox->addWidget(mainMenu);
Widget::setBackgroundColor(TCODColor(0,0,0), TCODColor(128,128,128));
Widget::setForegroundColor(TCODColor(255,255,255), TCODColor(255,255,255));
Widget::renderWidgets();
TCODMouse::showCursor(true);
TCODImage *image = new TCODImage("data/images/MenuBackground.png");
// bool quit = false;
while(!TCODConsole::isWindowClosed())
{
TCOD_key_t key;
TCOD_mouse_t mouse;
TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS|TCOD_EVENT_MOUSE,&key,&mouse);
Widget::updateWidgets(key,mouse);
Widget::renderWidgets();
render();
image->blitRect(output, 2, 0);
output->setDefaultForeground(TCODColor(255, 255, 255));
output->print(MAIN_WIDTH-26, MAIN_HEIGHT-3, (const char*)"The ASCII Project 0.0.0o", TCOD_LEFT);
output->print(MAIN_WIDTH-29, MAIN_HEIGHT-2, (const char*)"TheASCIIProject.com (c)2012", TCOD_LEFT);
output->rect(0, 0, 20, 1, true);
if(drawLogin || key.vk == TCODK_ENTER)
{
break;
}
else if( key.vk == TCODK_ESCAPE)
{
exit(0);
}
}
vbox->removeWidget(mainMenu);
delete vbox;
output->setDefaultBackground(TCODColor(0, 0, 0));
output->clear();
render();
}