本文整理汇总了C++中Combobox::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ Combobox::addItem方法的具体用法?C++ Combobox::addItem怎么用?C++ Combobox::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combobox
的用法示例。
在下文中一共展示了Combobox::addItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitIsSoundSwitchCombobox
void GVEvent::InitIsSoundSwitchCombobox()
{
//攻击时是否混音
Combobox* cbbo = GetCombobox("GoodsTreeFrame/BaseProperty/CombBoxIsDB1");
ListboxTextItem* itm;
itm = new ListboxTextItem("True",0);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
itm = new ListboxTextItem("False",1);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
}
示例2: CEditBoxExit
CEditBoxExit(int id,
CEGUI::Window *pParent,
float fButtonSize,
const CEGUI::String &sTitle,
CExit &exit)
: CEditBoxBase(id, pParent, fButtonSize, sTitle),
m_Exit(exit),
m_BackupExit(exit) {
using namespace CEGUI;
Combobox *pComboBox = dynamic_cast<Combobox*>(m_pWindow->createChild("OgreTray/Combobox", "ExitSelect"));
m_pCombobox = pComboBox;
pComboBox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
pComboBox->setSize(USize(UDim(1, 0), UDim(0, 3 * fButtonSize)));
pComboBox->addItem(new ListboxTextItem("Region"));
pComboBox->addItem(new ListboxTextItem("Enemy death"));
pComboBox->setAutoSizeListHeightToContent(true);
pComboBox->setReadOnly(true);
pComboBox->subscribeEvent(Combobox::EventListSelectionAccepted,
Event::Subscriber(&CEditBoxExit::onListSelectionChanged, this));
// id
m_pContentId = m_pWindow->createChild("DefaultWindow", "id");
m_pContentId->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
m_pContentId->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));
Window *pLabel = m_pContentId->createChild("OgreTray/Label", "Exitidlabel");
pLabel->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
pLabel->setSize(USize(UDim(0, fButtonSize), UDim(0, fButtonSize)));
pLabel->setText("id");
Window *pEditBox = m_pContentId->createChild("OgreTray/Editbox", "Exitid");
pEditBox->setPosition(UVector2(UDim(0, fButtonSize), UDim(0, 0)));
pEditBox->setSize(USize(UDim(1, -fButtonSize), UDim(0, fButtonSize)));
pEditBox->setText(m_Exit.getID());
m_pContentId->setVisible(m_Exit.getExitType() == EXIT_ENEMY_DEATH);
// region
m_pContentRegion = m_pWindow->createChild("DefaultWindow", "region");
m_pContentRegion->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
m_pContentRegion->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));
createVector(m_pContentRegion, "pos", m_Exit.getBoundingBox().getPosition().x, m_Exit.getBoundingBox().getPosition().y, fButtonSize, 0);
createVector(m_pContentRegion, "size", m_Exit.getBoundingBox().getSize().x, m_Exit.getBoundingBox().getSize().y, fButtonSize, fButtonSize);
m_pContentRegion->setVisible(m_Exit.getExitType() == EXIT_REGION);
// default selected exit type
m_pCombobox->setItemSelectState(m_Exit.getExitType(), true);
}
示例3: InitAddAttrValueSelCombobox
void GVEvent::InitAddAttrValueSelCombobox()
{
//是否有效
Combobox* cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox1");
ListboxTextItem* itm;
itm = new ListboxTextItem("True",0);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
itm = new ListboxTextItem("False",1);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
//是否隐藏
cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox11");
itm = new ListboxTextItem("True",0);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
itm = new ListboxTextItem("False",1);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
}
示例4: InitSuitAttrCombobox
void GVEvent::InitSuitAttrCombobox()
{
//套装属性
Combobox* cbbo = GetCombobox("GoodsTreeFrame/GroupBoxSuitAtrr/CombBoxSuitAttr");
ListboxTextItem* itm;
for(size_t i = 0 ; i < m_GoodsOP.GetGoodItemTypeSize(); ++i)
{
itm = new ListboxTextItem(m_GoodsOP.GetGoodItemType(i).c_str(),(CEGUI::uint)i);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
}
}
示例5: InitGoodTypeCombobox
void GVEvent::InitGoodTypeCombobox()
{
//物品类型条目的初始化
Combobox* cbbo = GetCombobox("GoodsTreeFrame/BaseProperty/CombboxGoodType");
ListboxTextItem* itm = NULL;
for(int i = 0 ; i < UIData::gGoodsTypeNum ; ++i)
{
itm = new ListboxTextItem(m_GoodsOP.GetGoodsType(i).c_str(),i);
itm->setSelectionBrushImage(IMAGES_FILE_NAME,MULTILISTSEL_BRUSH_NAME);
cbbo->addItem(itm);
}
}
示例6: MyListItem
void CEGUISample9App::createListContent()
{
using namespace CEGUI;
WindowManager& winMgr = WindowManager::getSingleton();
Combobox * cbobox = static_cast<Combobox*>(winMgr.getWindow("Demo7/Window2/Combobox"));
// add items to the combobox list
cbobox->addItem(new MyListItem("Combobox Item 1"));
cbobox->addItem(new MyListItem("Combobox Item 2"));
cbobox->addItem(new MyListItem("Combobox Item 3"));
cbobox->addItem(new MyListItem("Combobox Item 4"));
cbobox->addItem(new MyListItem("Combobox Item 5"));
cbobox->addItem(new MyListItem("Combobox Item 6"));
cbobox->addItem(new MyListItem("Combobox Item 7"));
cbobox->addItem(new MyListItem("Combobox Item 8"));
cbobox->addItem(new MyListItem("Combobox Item 9"));
cbobox->addItem(new MyListItem("Combobox Item 10"));
//
// Multi-Column List setup
//
MultiColumnList* mclbox = static_cast<MultiColumnList*>(winMgr.getWindow("Demo7/Window2/MultiColumnList"));
// Add some empty rows to the MCL
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
// Set first row item texts for the MCL
mclbox->setItem(new MyListItem("Laggers World"), 0, 0);
mclbox->setItem(new MyListItem("yourgame.some-server.com"), 1, 0);
mclbox->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0);
// Set second row item texts for the MCL
mclbox->setItem(new MyListItem("Super-Server"), 0, 1);
mclbox->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1);
mclbox->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1);
// Set third row item texts for the MCL
mclbox->setItem(new MyListItem("Cray-Z-Eds"), 0, 2);
mclbox->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2);
mclbox->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2);
// Set fourth row item texts for the MCL
mclbox->setItem(new MyListItem("Fake IPs"), 0, 3);
mclbox->setItem(new MyListItem("123.320.42.242"), 1, 3);
mclbox->setItem(new MyListItem("[colour='FFFFFF00']63ms"), 2, 3);
// Set fifth row item texts for the MCL
mclbox->setItem(new MyListItem("Yet Another Game Server"), 0, 4);
mclbox->setItem(new MyListItem("abc.abcdefghijklmn.org"), 1, 4);
mclbox->setItem(new MyListItem("[colour='FFFF6600']284ms"), 2, 4);
mclbox->setProperty("Font", "fkp-16");
}
示例7: ListboxTextItem
/*************************************************************************
Create the windows and widgets for the demo
*************************************************************************/
void Demo6Sample::createDemoWindows(void)
{
using namespace CEGUI;
ListboxTextItem* itm;
WindowManager& winMgr = WindowManager::getSingleton();
Window* root = winMgr.getWindow("root_wnd");
// create the main list.
MultiColumnList* mcl = static_cast<MultiColumnList*>(winMgr.createWindow("TaharezLook/MultiColumnList", "Demo6/MainList"));
root->addChildWindow(mcl);
mcl->setPosition(UVector2(cegui_reldim(0.01f), cegui_reldim( 0.1f)));
mcl->setSize(UVector2(cegui_reldim(0.5f), cegui_reldim( 0.8f)));
// create frame window for control panel
FrameWindow* fwnd = static_cast<FrameWindow*>(winMgr.createWindow("TaharezLook/FrameWindow", "Demo6/ControlPanel"));
root->addChildWindow(fwnd);
fwnd->setPosition(UVector2(cegui_reldim(0.53f), cegui_reldim( 0.03f)));
fwnd->setMaxSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
fwnd->setSize(UVector2(cegui_reldim(0.44f), cegui_reldim( 0.94f)));
fwnd->setText("Demo 6 - Control Panel");
// create combo-box.
Combobox* cbbo = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "Demo6/ControlPanel/SelModeBox"));
fwnd->addChildWindow(cbbo);
cbbo->setPosition(UVector2(cegui_reldim(0.04f), cegui_reldim( 0.06f)));
cbbo->setSize(UVector2(cegui_reldim(0.66f), cegui_reldim( 0.33f)));
//cbbo->setSortingEnabled(true);
// populate combobox with possible selection modes
const CEGUI::Image* sel_img = &ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("MultiListSelectionBrush");
itm = new ListboxTextItem("Full Row (Single)", 0);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Full Row (Multiple)", 1);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Full Column (Single)", 2);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Full Column (Multiple)", 3);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Single Cell (Single)", 4);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Single Cell (Multiple)", 5);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Nominated Column (Single)", 6);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Nominated Column (Multiple)", 7);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
ListboxTextItem* pStore = itm;
itm = new ListboxTextItem("Nominated Row (Single)", 8);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
itm = new ListboxTextItem("Nominated Row (Multiple)", 9);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
cbbo->setReadOnly(true);
// Now change the text to test the sorting
pStore->setText("Abracadabra");
//cbbo->setSortingEnabled(false);
cbbo->setSortingEnabled(true);
//cbbo->handleUpdatedListItemData();
// column control section
Window* st = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/ColumnPanel");
fwnd->addChildWindow(st);
st->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.12f)));
st->setSize(UVector2(cegui_reldim(0.96f), cegui_reldim( 0.25f)));
st->setText("Column Control");
st->setProperty("VertFormatting", "TopAligned");
Window* label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label1");
st->addChildWindow(label);
label->setProperty("FrameEnabled", "false");
label->setProperty("BackgroundEnabled", "false");
label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.2f)));
label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
label->setText("ID Code:");
label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label2");
st->addChildWindow(label);
label->setProperty("FrameEnabled", "false");
label->setProperty("BackgroundEnabled", "false");
label->setPosition(UVector2(cegui_reldim(0.23f), cegui_reldim( 0.2f)));
label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
label->setText("Width:");
label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label3");
st->addChildWindow(label);
label->setProperty("FrameEnabled", "false");
label->setProperty("BackgroundEnabled", "false");
//.........这里部分代码省略.........
示例8: USize
vis_settings_panel_impl::vis_settings_panel_impl( const app::zones_t &zones, const app::settings_t& s )
{
GUIContext& context = System::getSingleton().getDefaultGUIContext();
CEGUI::Window* root = context.getRootWindow();
WindowManager& winMgr = WindowManager::getSingleton();
FrameWindow* mainWindow = static_cast<FrameWindow*>(
CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", "MainWindow") );
mainWindow->setPosition(UVector2(cegui_reldim(0.01f), cegui_reldim(0.5f)));
//demoWindow->setSize(USize(cegui_reldim(0.3f), cegui_reldim(0.3f)));
mainWindow->setMinSize(USize(cegui_reldim(0.1f), cegui_reldim(0.1f)));
mainWindow->setText( "Choose Zone" );
auto fn_exit = [=](const CEGUI::EventArgs& args)->bool
{
CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
CEGUI::Window* root = context.getRootWindow();
root->getChild("MainWindow")->setVisible(false);
return true;
};
mainWindow->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked,Event::Subscriber(fn_exit));
#if 0
PushButton* btnExit = static_cast<PushButton*>(
WindowManager::getSingleton().createWindow("TaharezLook/Button", btn_exit_name) );
root->addChild(btnExit);
btnExit->setPosition(UVector2(cegui_reldim(0.95f), cegui_reldim(0.95f)));
btnExit->setSize( USize(cegui_reldim(0.04f), cegui_reldim(0.02f)) );
btnExit->setText( "Exit" );
btnExit->subscribeEvent(PushButton::EventClicked,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
exit_app_signal_();
return true;
})
);
#endif
Combobox* cbbo = static_cast<Combobox*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Combobox", combo_name));
cbbo->setPosition(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.1f)));
//cbbo->setSize(USize(cegui_reldim(0.66f), cegui_reldim( 0.33f)));
mainWindow->addChild(cbbo);
root->addChild( mainWindow );
mainWindow->setVisible(false);
ListboxTextItem* itm;
CEGUI::Win32StringTranscoder stc;
const CEGUI::Image* sel_img = &ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
for (auto it = zones.begin(); it!=zones.end();++it)
{
itm = new ListboxTextItem(stc.stringFromStdWString(it->second), it->first);
itm->setSelectionBrushImage(sel_img);
cbbo->addItem(itm);
}
cbbo->subscribeEvent(Combobox::EventListSelectionAccepted,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
Combobox* combo = static_cast<Combobox*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("MainWindow/" + combo_name));
ListboxItem* item = combo->findItemWithText(combo->getText(), 0);
if (item)
{
zone_changed_signal_( item->getID());
}
return true;
})
);
cbbo->setReadOnly(true);
cbbo->setSortingEnabled(false);
//cbbo->handleUpdatedListItemData();
CEGUI::ToggleButton* checkbox = static_cast<ToggleButton*>( CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Checkbox", tb_name));
checkbox->setSelected(true);
checkbox->setText( "Lights" );
mainWindow->addChild(checkbox);
auto settingsWindow = winMgr.loadLayoutFromFile("vis_settings.layout");
root->addChild(settingsWindow);
subscribeEvent(setting_dlg + "/Settings/chkLights", ToggleButton::EventSelectStateChanged,
Event::Subscriber([=](const CEGUI::EventArgs& args)->bool
{
bool wrap = isCheckboxSelected(setting_dlg + "/Settings/chkLights");
set_lights_signal_(wrap);
//.........这里部分代码省略.........
示例9: Build
//.........这里部分代码省略.........
Combobox* cbresolution = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "RESOLUTION"));
wnd3->addChildWindow(cbresolution);
cbresolution->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
cbresolution->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.75f)));
cbresolution->setReadOnly(true);
Window* txtres = winMgr.createWindow("TaharezLook/StaticText", "RESOLUTIONTXT");
txtres->setText(GLoc->GetString("RESOLUTION").c_str());
txtres->setProperty("FrameEnabled", "false");
txtres->setProperty("BackgroundEnabled", "false");
txtres->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
txtres->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
wnd3->addChildWindow(txtres);
int optWidth = GConfig->GetQuality("Width");
int optHeight = GConfig->GetQuality("Height");
int awidth = -1, aheight = -1;
int avresolutions = 0;
for (unsigned int rs = 0;rs<GDD->GetNbPossibleResolutions(); rs++)
{
char tmps[512];
int width, height;
GDD->GetResolution(rs, width, height);
if ((awidth != width) || (aheight != height))
{
awidth = width;
aheight = height;
mResolutions.push_back(resval_t(width, height));
snprintf(tmps, 512, "%d x %d", width, height);
cbresolution->addItem (new ListboxTextItem(tmps));
if ((width == optWidth)&&(height == optHeight))
CEGUICBSel(cbresolution, avresolutions);
avresolutions++;
}
}
// --
Checkbox* checkFS = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBFS"));
wnd3->addChildWindow(checkFS);
checkFS->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f)));
checkFS->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
checkFS->setText(GLoc->GetString("FULLSCREEN").c_str());
//checkFS->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleFSChanged, this));
checkFS->setSelected (GConfig->IsEnable("CHKBFS"));
Checkbox* checkVSync = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKBVSYNC"));
wnd3->addChildWindow(checkVSync);
checkVSync->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.75f)));
checkVSync->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
checkVSync->setText(GLoc->GetString("VSYNC").c_str());
//checkVSync->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleVSYNCChanged, this));
checkVSync->setSelected (GConfig->IsEnable("CHKBVSYNC"));
// --
Combobox* cbshad = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "SHADOWQUALITY"));