Пример #1
0
void t_chessGui::initServer()
{
   CEGUI::FrameWindow *server = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("server.layout"));
   myRoot->addChildWindow(server);
   server->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeServer,server,_1)));


   CEGUI::MenuItem *serverItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/New"));
   serverItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openServer,server,_1)));


   CEGUI::MultiColumnList *testing = static_cast<CEGUI::MultiColumnList *>(wmgr->getWindow("Lols3"));
   testing->addColumn("Names",0,CEGUI::UDim(.25,0));
   testing->addColumn("Action",1,CEGUI::UDim(.25,0));
   testing->addColumn("Wins",2,CEGUI::UDim(.25,0));
   testing->addColumn("Losses",3,CEGUI::UDim(.25,0));

   testing->addRow();
   testing->addRow();

   testing->setItem(new CEGUI::ListboxTextItem("What, wow,"),0u,0u);

   server->hide();
}
    void PropertiesWindow::addPropertyArray(const Property& prop, const CeGuiString& key)
    {
        // Create the new MultiColumnList with two columns
        // Type and Value and set tab text to key
        int tabCount = mTabPane->getTabCount();
        CEGUI::MultiColumnList* newTable = static_cast<CEGUI::MultiColumnList*>
            (CEGUI::WindowManager::getSingleton().createWindow("RastullahLook/MultiColumnList",
            "PropertiesWindow/PropertiesTabControl/" + key));

        // Set table properties
        newTable->setText(key);
        newTable->setPosition(CEGUI::UVector2(
            CEGUI::UDim(0,0),
            CEGUI::UDim(0,0)));
        newTable->setSize(CEGUI::UVector2(
            CEGUI::UDim(1,0),
            CEGUI::UDim(1,0)));
        newTable->setUserSortControlEnabled(false);
        newTable->setFont("Vera Serif-8");

        newTable->addColumn("Type", 0, cegui_reldim(0.3));
        newTable->addColumn("Value", 1, cegui_reldim(0.7));

        // Add the MultiColumnList to the tab pane
        mTabPane->addTab(newTable);

        // Get access to the vector
        PropertyArray vProp = prop.toArray();

        // Iterate through the vector entries and add them
        // to the table
        for(PropertyArray::const_iterator it = vProp.begin(); it != vProp.end(); it++)
        {
            // Check for Int
            if (it->isInt() )
            {
                addPropertyInt(*it, newTable);
            }
            // Check for IntPair
            else if (it->isIntPair() )
            {
                addPropertyIntPair(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for IntTriple
            else if (it->isIntTriple() )
            {
                addPropertyIntTriple(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for String
            else if (it->isString() )
            {
                addPropertyString(*it, newTable);
            }
            // Check for Bool
            else if (it->isBool() )
            {
                addPropertyBool(*it, newTable);
            }
            // Check for Real
            else if (it->isReal() )
            {
                addPropertyReal(*it, newTable);
            }
            // Check for Vector3
            else if (it->isVector3() )
            {
                addPropertyArray3(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for Quaternion
            else if (it->isQuaternion() )
            {
                addPropertyQuaternion(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
        }
        newTable->autoSizeColumnHeader(0);
        newTable->autoSizeColumnHeader(1);
    }