本文整理汇总了C++中MultiColumnList::addColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiColumnList::addColumn方法的具体用法?C++ MultiColumnList::addColumn怎么用?C++ MultiColumnList::addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiColumnList
的用法示例。
在下文中一共展示了MultiColumnList::addColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atoi
bool Demo6Sample::handleAddColumn(const CEGUI::EventArgs& e)
{
using namespace CEGUI;
// get access to the widgets that contain details about the column to add
MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
Editbox* idbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/NewColIDBox"));
Editbox* widthbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/NewColWidthBox"));
Editbox* textbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/NewColTextBox"));
// get ID for new column
CEGUI::uint id = atoi(idbox->getText().c_str());
// get width to use for new column (in pixels)
float width = atof(widthbox->getText().c_str());
// get column label text
String text = textbox->getText();
// re-set the widget contents
idbox->setText("");
widthbox->setText("");
textbox->setText("");
// ensure a minimum width of 10 pixels
if (width < 10.0f)
width = 10.0f;
// finally, add the new column to the list.
mcl->addColumn(text, id, cegui_absdim(width));
// event was handled.
return true;
}
示例2: UiTest
UiTest(const uvec2 & ) {
Gui::init(uvec2(100, 200));
gameList = Fics::GameSummary::parseList(Platform::getResourceString(Resource::MISC_GAMELIST_TXT));
try {
WindowManager & wmgr = WindowManager::getSingleton();
rootWindow = wmgr.createWindow("DefaultWindow", "root");
System::getSingleton().getDefaultGUIContext().setRootWindow(rootWindow);
rootWindow->addChild(wmgr.loadLayoutFromFile("Login.layout"));
//rb->setSelected(tc->getTabPanePosition() == TabControl::Top);
//rb->subscribeEvent(
// RadioButton::EventSelectStateChanged,
// Event::Subscriber(&TabControlDemo::handleTabPanePos, this));
// bool handleTabPanePos(const EventArgs& e)
//dumpWindows(rootWindow);
rootWindow->getChild("LoginWindow/Login")->
subscribeEvent(PushButton::EventClicked, [&](const EventArgs& e) -> bool {
return true;
});
#if 0
rootWindow->addChild(wmgr.loadLayoutFromFile("TabControl.layout"));
TabControl* tc = static_cast<TabControl*>(rootWindow->getChild("TabControl"));
//// Add some pages to tab control
tc->addTab(wmgr.loadLayoutFromFile("TabPage1.layout"));
tc->addTab(wmgr.loadLayoutFromFile("TabPage2.layout"));
MultiColumnList* mcl = static_cast<MultiColumnList*>(rootWindow->getChild("TabControl/Page1/MultiColumnList"));
//MultiColumnList* mcl = static_cast<CEGUI::MultiColumnList*>(
// wmgr.createWindow("TaharezLook/MultiColumnList", "WidgetPropertiesDisplay")
//);
//Create the properties display window
//mcl->setSize(CEGUI::USize(cegui_reldim(0.9f), cegui_reldim(0.9f)));
//mcl->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim(0.05f)));
//rootWindow->addChild(mcl);
dumpWindows(rootWindow);
//mcl->setShowHorzScrollbar(false);
//mcl->setUserColumnDraggingEnabled(false);
//mcl->setUserColumnSizingEnabled(true);
//mcl->addColumn("Name", 0, cegui_reldim(0.45f));
//mcl->addColumn("Type ", 1, cegui_reldim(0.25f));
//mcl->addColumn("Value", 2, cegui_reldim(0.8f));
//d_widgetPropertiesDisplayWindow->setSortColumnByID(0);
//d_widgetPropertiesDisplayWindow->setSortDirection(CEGUI::ListHeaderSegment::Ascending);
mcl->addColumn("Id", 0, cegui_reldim(0.05f));
mcl->addColumn("Type", 1, cegui_reldim(0.07f));
mcl->addColumn("Player (White)", 2, cegui_reldim(0.15f));
mcl->addColumn("Rating", 3, cegui_reldim(0.07f));
mcl->addColumn("Player (Black)", 4, cegui_reldim(0.15f));
mcl->addColumn("Rating", 5, cegui_reldim(0.07f));
mcl->addColumn("Private", 6, cegui_reldim(0.05f));
mcl->addColumn("Rated", 7, cegui_reldim(0.05f));
for (int i = 0; i < gameList.size(); ++i) {
Fics::GameSummary & g = gameList[i];
mcl->addRow();
mcl->setItem(new ListboxTextItem(Platform::format("%d", g.id)), 0, i);
mcl->setItem(new ListboxTextItem(g.private_ ? "Y" : "N"), 6, i);
mcl->setItem(new ListboxTextItem(g.rated ? "Y" : "N"), 7, i);
mcl->setItem(new ListboxTextItem(Chess::getTypeName(g.type)), 1, i);
for (int j = 0; j < 2; ++j) {
mcl->setItem(new ListboxTextItem(g.players[j]), 2 + (j * 2), i);
mcl->setItem(new ListboxTextItem(Platform::format("%d", g.ratings[j])), 3 + (j * 2), i);
}
}
// Add some empty rows to the MCL
//multilineColumnList->addRow();
//multilineColumnList->addRow();
//multilineColumnList->addRow();
//multilineColumnList->addRow();
//multilineColumnList->addRow();
//// Set first row item texts for the MCL
//multilineColumnList->setItem(new MyListItem("Laggers World"), 0, 0);
//multilineColumnList->setItem(new MyListItem("yourgame.some-server.com"), 1, 0);
//multilineColumnList->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0);
//// Set second row item texts for the MCL
//multilineColumnList->setItem(new MyListItem("Super-Server"), 0, 1);
//multilineColumnList->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1);
//multilineColumnList->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1);
//// Set third row item texts for the MCL
//multilineColumnList->setItem(new MyListItem("Cray-Z-Eds"), 0, 2);
//multilineColumnList->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2);
//multilineColumnList->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2);
//// Set fourth row item texts for the MCL
//multilineColumnList->setItem(new MyListItem("Fake IPs"), 0, 3);
//multilineColumnList->setItem(new MyListItem("123.320.42.242"), 1, 3);
//.........这里部分代码省略.........
示例3: init_sdlgui
//.........这里部分代码省略.........
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
char buffer [50];
sprintf (buffer, "%s.scheme", skin_layout);
dbg(1,"Loading scheme : %s\n",buffer);
CEGUI::SchemeManager::getSingleton().loadScheme(buffer);
CEGUI::FontManager::getSingleton().createFont("DejaVuSans-10.font");
CEGUI::FontManager::getSingleton().createFont("DejaVuSans-14.font");
CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
dbg(1,"Loading layout : %s\n",buffer);
sprintf (buffer, "%s.layout", skin_layout);
myRoot = CEGUI::WindowManager::getSingleton().loadWindowLayout(buffer);
CEGUI::System::getSingleton().setGUISheet(myRoot);
try {
CEGUI::WindowManager::getSingleton().getWindow("OSD/Quit")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ButtonQuit));
// CEGUI::WindowManager::getSingleton().getWindow("OSD/Quit")->setText(_("Quit"));
CEGUI::WindowManager::getSingleton().getWindow("ZoomInButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ZoomIn));
// CEGUI::WindowManager::getSingleton().getWindow("ZoomInButton")->setText(_("ZoomIn"));
CEGUI::WindowManager::getSingleton().getWindow("ZoomOutButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ZoomOut));
// CEGUI::WindowManager::getSingleton().getWindow("ZoomOutButton")->setText(_("ZoomOut"));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/CountryEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/CountryEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/TownEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/TownEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/StreetEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/StreetEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
CEGUI::WindowManager::getSingleton().getWindow("DestinationButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(DialogWindowSwitch));
CEGUI::WindowManager::getSingleton().getWindow("OSD/ViewMode")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ToggleView));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/GO")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ButtonGo));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/KB")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ShowKeyboard));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Listbox")->subscribeEvent(MultiColumnList::EventSelectionChanged, Event::Subscriber(ItemSelect));
// Translation for StaticTexts (labels)
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Country")->setText(_("Country"));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Town")->setText(_("City"));
CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Street")->setText(_("Street"));
MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("DestinationWindow/Listbox"));
mcl->setSelectionMode(MultiColumnList::RowSingle) ;
mcl->addColumn("Value", 0, cegui_absdim(200.0));
mcl->addColumn("ID", 1, cegui_absdim(70.0));
mcl->addColumn("Assoc", 2, cegui_absdim(70.0));
mcl->addColumn("x", 3, cegui_absdim(70.0));
mcl->addColumn("y", 4, cegui_absdim(70.0));
MultiColumnList* mcl2 = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Roadbook"));
mcl2->setSelectionMode(MultiColumnList::RowSingle) ;
mcl2->addColumn("Instructions", 0, cegui_absdim(700.0));
BuildKeyboard();
CEGUI::WindowManager::getSingleton().getWindow("OSD/Scrollbar1")->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(MoveCamera));
CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch));
CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->setText(_("RoadBook"));
CEGUI::WindowManager::getSingleton().getWindow("OSD/nGhostButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(Switch_to_nGhost));
// this one is maybe not needed anymore
CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton2")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch));
}
catch (CEGUI::Exception& e)
{
fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
printf("Missing control!...\n");
}
}
catch (CEGUI::Exception& e)
{
fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
printf("quiting...\n");
exit(1);
}
}