예제 #1
0
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
0
파일: GUI.cpp 프로젝트: lumenrobot/puspa
bool GUI::handleKeyDown(const EventArgs& eventArgs)
{
    // get the text entry editbox
    Editbox *editbox = static_cast<Editbox *> (guiConsole->getChild(EntryBoxID));
    
    switch (static_cast<const KeyEventArgs&> (eventArgs).scancode) {
        case Key::ArrowUp:
            historyPosition = ceguimax(historyPosition - 1, -1);
            if (historyPosition >= 0) {
                editbox->setText(history[historyPosition]);
                editbox->setCaratIndex(static_cast<size_t> (-1));
            } else
                editbox->setText("");
            
            editbox->activate();
            break;
            
        case Key::ArrowDown:
            historyPosition = ceguimin(historyPosition + 1, static_cast<int> (history.size()));
            if (historyPosition < static_cast<int> (history.size())) {
                editbox->setText(history[historyPosition]);
                editbox->setCaratIndex(static_cast<size_t> (-1));
            } else
                editbox->setText("");
            
            editbox->activate();
            break;
            
        default:
            return false;
	}
    
    return true;
}
예제 #3
0
void GVEvent::UpdateBaseAttrDisplay(const UIData::tagGoodAttr* pGoodAttr)
{
    if(!pGoodAttr)
        return;
    //物品ID
    Editbox *pEditBox = GetEditbox("GoodsTreeFrame/BaseProperty/EditIndex");
    if(pEditBox)
    {
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwIndex));
    }
    //物品名称
    pEditBox = GetEditbox("GoodsTreeFrame/BaseProperty/EditDisName");
    if(pEditBox)
    {
        //std::wstring wstr());
        pEditBox->setText(pGoodAttr->strName.c_str());
    }
    //物品价格
    pEditBox = GetEditbox("GoodsTreeFrame/BaseProperty/EditPrice");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwValue));
    //物品原始名称
    pEditBox = GetEditbox("GoodsTreeFrame/BaseProperty/EditOgriName");
    if(pEditBox)
        pEditBox->setText(pGoodAttr->strOrigName.c_str());
    //物品是否存数据库
    Combobox* cbbo = GetCombobox("GoodsTreeFrame/BaseProperty/CombBoxIsDB");
    if(pGoodAttr->bSave == false)
        cbbo->setItemSelectState(1,true);
    else
        cbbo->setItemSelectState(size_t(0),true);
    //物品类型
    cbbo = GetCombobox("GoodsTreeFrame/BaseProperty/CombboxGoodType");
    cbbo->setItemSelectState(pGoodAttr->dwType,true);
}
예제 #4
0
파일: GUILogin.cpp 프로젝트: JJMoon/CGSF
///////////////////////////////////////////////////////////////////////////////////////////////
//Network Transport 20120618(¿ù)
///////////////////////////////////////////////////////////////////////////////////////////////
bool GUILogin::handleSubmit(const CEGUI::EventArgs&)
{
	using namespace CEGUI;

	// get the text entry editbox
	Editbox* editboxName = static_cast<Editbox*>(d_root->getChild("GameIDInput"));
	// get text out of the editbox
	String edit_text(editboxName->getText());

	if(edit_text.empty())
		return false;

	Editbox* editboxPassword = static_cast<Editbox*>(d_root->getChild("PasswordInput"));
	// get text out of the editbox
	String edit_text2(editboxPassword->getText());

	if(edit_text.empty())
		return false;

	if(edit_text2.empty())
		return false;

	SFProtobufPacket<SFPacketStore::Login> PktLogin(CGSF::Login);
//	PktLogin.SetOwnerSerial(g_engine->GetLocalID());
	PktLogin.GetData().set_username(edit_text.c_str());
	PktLogin.GetData().set_password(edit_text2.c_str());

	g_pCasualGameManager->GetNetwork()->TCPSend(&PktLogin);

	editboxName->setText("");
	editboxPassword->setText("");

	return true;
}
bool TreeDemoSample::handleEventSelectionChanged(const CEGUI::EventArgs& args)
   {
   using namespace CEGUI;

   const TreeEventArgs& treeArgs = static_cast<const TreeEventArgs&>(args);
   Editbox *editBox = (Editbox *)TreeDemoWindow->getChild(EditBoxID);

   // Three different ways to get the item selected.
//   TreeCtrlEntry *selectedItem = theTree->getFirstSelectedItem();      // the first selection in the list (may be more)
//   TreeCtrlEntry *selectedItem = theTree->getLastSelectedItem();       // the last (time-wise) selected by the user
   TreeItem *selectedItem = treeArgs.treeItem;                    // the actual item that caused this event

   if (selectedItem)
      {
#if 0
      // A convoluted way to get the item text.
      // Just here to test findFirstItemWithText.
      selectedItem = theTree->findFirstItemWithText(selectedItem->getText());
      if (selectedItem)
         editBox->setText("Selected: " + selectedItem->getText());
      else
         editBox->setText("findItemWithText failed!");
#else
      // The simple way to do it.
      editBox->setText("Selected: " + selectedItem->getText());
#endif
      }
   else
      editBox->setText("None Selected");

   return true;
   }
예제 #6
0
/*************************************************************************
	Handler for selections made in the drop-list
*************************************************************************/
bool Combobox::droplist_SelectionAcceptedHandler(const EventArgs& e)
{
	// copy the text from the selected item into the edit box
	ListboxItem* item = ((ComboDropList*)((WindowEventArgs&)e).window)->getFirstSelectedItem();

	if (item)
	{
        Editbox* editbox = getEditbox();
		// Put the text from the list item into the edit box
		editbox->setText(item->getText());

		// select text if it's editable, and move caret to end
		if (!isReadOnly())
		{
			editbox->setSelection(0, item->getText().length());
			editbox->setCaretIndex(item->getText().length());
		}

		editbox->setCaretIndex(0);
		editbox->activate();

		// fire off an event of our own
		WindowEventArgs args(this);
		onListSelectionAccepted(args);
	}

	return true;
}
예제 #7
0
bool Demo6Sample::handleDeleteRow(const CEGUI::EventArgs& args)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the row to delete.
    MultiColumnList* mcl = static_cast<MultiColumnList*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("MainList"));
    Editbox* idxbox = static_cast<Editbox*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("ControlPanel/RowControl/DelRowIdxBox"));

    // get index of row to delete.
    CEGUI::uint idx = atoi(idxbox->getText().c_str());

    // attempt to delete the row, ignoring any errors.
    CEGUI_TRY
    {
        mcl->removeRow(idx);
    }
    CEGUI_CATCH (InvalidRequestException)
    {}

    // clear the row index box
    idxbox->setText("");

    // event was handled.
    return true;
}
예제 #8
0
bool Demo6Sample::handleDeleteColumn(const CEGUI::EventArgs& args)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the column to delete
    MultiColumnList* mcl = static_cast<MultiColumnList*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("MainList"));
    Editbox* idbox = static_cast<Editbox*>(static_cast<const WindowEventArgs&>(args).window->getRootWindow()->getChild("ControlPanel/ColumnPanel/DelColIDBox"));

    // obtain the id of the column to be deleted
    CEGUI::uint id = atoi(idbox->getText().c_str());

    // attempt to delete the column, ignoring any errors.
    CEGUI_TRY
    {
        mcl->removeColumnWithID(id);
    }
    CEGUI_CATCH (InvalidRequestException)
    {}

    // reset the delete column ID box.
    idbox->setText("");

    // event was handled.
    return true;
}
예제 #9
0
bool Demo6Sample::handleDeleteRow(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the row to delete.
    MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
    Editbox* idxbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/DelRowIdxBox"));

    // get index of row to delete.
    CEGUI::uint idx = atoi(idxbox->getText().c_str());

    // attempt to delete the row, ignoring any errors.
    try
    {
        mcl->removeRow(idx);
    }
    catch (InvalidRequestException)
    {}

    // clear the row index box
    idxbox->setText("");

    // event was handled.
    return true;
}
예제 #10
0
bool Demo6Sample::handleDeleteColumn(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the column to delete
    MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
    Editbox* idbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/DelColIDBox"));

    // obtain the id of the column to be deleted
    CEGUI::uint id = atoi(idbox->getText().c_str());

    // attempt to delete the column, ignoring any errors.
    try
    {
        mcl->removeColumnWithID(id);
    }
    catch (InvalidRequestException)
    {}

    // reset the delete column ID box.
    idbox->setText("");

    // event was handled.
    return true;
}
bool TreeDemoSample::handleEventBranchClosed(const CEGUI::EventArgs& args)
   {
   using namespace CEGUI;

   const TreeEventArgs& treeArgs = static_cast<const TreeEventArgs&>(args);
   Editbox *editBox = (Editbox *)TreeDemoWindow->getChild(EditBoxID);
   editBox->setText("Closed: " + treeArgs.treeItem->getText());
   return true;
   }
예제 #12
0
bool GUIApplication::onConsoleInput(const CEGUI::EventArgs&)
{
    Editbox* inputBox = static_cast<Editbox*>(m_guiContext->getRootWindow()->getChild("console/input"));
    String consoleCommand = inputBox->getText();
    inputBox->setText("");

    doConsoleCommand(consoleCommand);

    return true;
}
예제 #13
0
bool TreeSample::handleEventSubtreeCollapsed(const CEGUI::EventArgs& args)
{
    using namespace CEGUI;

    const ItemViewEventArgs& treeArgs = static_cast<const ItemViewEventArgs&>(args);
    Editbox *editBox = (Editbox *)d_rootWindow->getChild(EditBoxID);
    TreeWidget* tree = static_cast<TreeWidget*>(treeArgs.window);
    StandardItem* collapsed_item = tree->getModel()->getItemForIndex(treeArgs.d_index);
    editBox->setText("Closed: " + collapsed_item->getText());
    return true;
}
예제 #14
0
bool Demo6Sample::handleSetItem(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the item to be modified
    MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
    Editbox* idbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemIDBox"));
    Editbox* rowbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemRowBox"));
    Editbox* textbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/SetItemTextBox"));

    // get ID of column to be affected
    CEGUI::uint id = atoi(idbox->getText().c_str());
    // get index of row to be affected
    CEGUI::uint row = atoi(rowbox->getText().c_str());
    // get new text for item
    String text = textbox->getText();

    // reset input boxes
    idbox->setText("");
    rowbox->setText("");
    textbox->setText("");

    // create a new ListboxTextItem using the new text string
    ListboxTextItem* item = new ListboxTextItem(text);
    // set the selection brush to be used for this item.
    item->setSelectionBrushImage(&ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("MultiListSelectionBrush"));

    // attempt to set the new item in place
    try
    {
        mcl->setItem(item, id, row);
    }
    // something went wrong, so cleanup the ListboxTextItem.
    catch (InvalidRequestException)
    {
        delete item;
    }

    // event was handled.
    return true;
}
예제 #15
0
    void Spinner::onTextInputModeChanged(WindowEventArgs& e)
    {
        Editbox* editbox = getEditbox();
        // update edit box text to reflect new mode.
        // mute to save doing unnecessary events work.
        bool wasMuted = editbox->isMuted();
        editbox->setMutedState(true);
        // Update text with new value.
        editbox->setText(getTextFromValue());
        // restore previous mute state.
        editbox->setMutedState(wasMuted);

        fireEvent(EventTextInputModeChanged, e, EventNamespace);
    }
예제 #16
0
bool Demo6Sample::handleAddRow(const CEGUI::EventArgs& e)
{
    using namespace CEGUI;

    // get access to the widgets that contain details about the row to add
    MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Demo6/MainList"));
    Editbox* idbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/RowColIDBox"));
    Editbox* textbox = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("Demo6/ControlPanel/ColumnPanel/RowTextBox"));

    // get the ID of the initial column item to set
    CEGUI::uint id = atoi(idbox->getText().c_str());
    // get the text that is to be set initially into the specified column of the new row
    String text = textbox->getText();

    // reset input boxes
    idbox->setText("");
    textbox->setText("");

    // construct a new ListboxTextItem with the required string
    ListboxTextItem* item = new ListboxTextItem(text);
    // set the selection brush to use for this item.
    item->setSelectionBrushImage(&ImagesetManager::getSingleton().getImageset("TaharezLook")->getImage("MultiListSelectionBrush"));

    // attempt to add a new row, using the new ListboxTextItem as the initial content for one of the columns
    try
    {
        mcl->addRow(item, id);
    }
    // something went wrong, so cleanup the ListboxTextItem
    catch (InvalidRequestException)
    {
        delete item;
    }

    // event was handled.
    return true;
}
예제 #17
0
    void Spinner::onTextChanged(WindowEventArgs& e)
    {
        Editbox* editbox = getEditbox();

        // update only if needed
        if (editbox->getText() != d_text)
        {
            // done before doing base class processing so event subscribers see
            // 'updated' version.
            editbox->setText(d_text);
            e.handled = true;

            Window::onTextChanged(e);
        }
    }
예제 #18
0
  CEditBoxString(int id,
		 CEGUI::Window *pParent,
		 float fButtonSize,
		 const CEGUI::String &sTitle,
		 std::string &sstring) 
    : CEditBoxBase(id, pParent, fButtonSize, sTitle),
      m_sString(sstring) {

    using namespace CEGUI;
    Editbox *pEditbox = dynamic_cast<Editbox*>(m_pWindow->
					       createChild("OgreTray/Editbox", "EditString"));
    pEditbox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pEditbox->setSize(USize(UDim(1, 0), UDim(0, fButtonSize)));
    pEditbox->setText(m_sString.c_str());
    m_pEditbox = pEditbox;
  }
예제 #19
0
/*************************************************************************
	Handler for when text changes
*************************************************************************/
void Combobox::onTextChanged(WindowEventArgs& e)
{
    Editbox* editbox = getEditbox();

	// update ourselves only if needed (prevents perpetual event loop & stack overflow)
    if (editbox->getText() != getText())
	{
		// done before doing base class processing so event subscribers see 'updated' version of this.
        editbox->setText(getText());
		++e.handled;

        selectListItemWithEditboxText();

		Window::onTextChanged(e);
	}

}
예제 #20
0
bool GUIApplication::onSendBtnClicked(const EventArgs& args)
{
    Window* myOutput = m_guiContext->getRootWindow()->getChild("chatWindow/output");
    MultiLineEditbox* realOutput = static_cast<MultiLineEditbox*>(myOutput);
    Editbox* realInput = static_cast<Editbox*>(m_guiContext->getRootWindow()->getChild("chatWindow/input"));
    if (realOutput && realInput)
    {
        String newLine = realInput->getText();
        if (newLine.empty())
            newLine = "You clicked me!";
        else
        {
            RemotePeersManager::getManager()->sendChatMessage(newLine.c_str());
        }
        realOutput->appendText(newLine);
        realInput->setText("");
    }
    return true;
}
예제 #21
0
    void Spinner::onValueChanged(WindowEventArgs& e)
    {
        Editbox* editbox = getEditbox();

        // mute to save doing unnecessary events work.
        bool wasMuted = editbox->isMuted();
        editbox->setMutedState(true);

        // Update text with new value.
        // (allow empty and '-' cases to equal 0 with no text change required)
        if (!(d_currentValue == 0 &&
              (editbox->getText().empty() || editbox->getText() == "-")))
        {
            editbox->setText(getTextFromValue());
        }
        // restore previous mute state.
        editbox->setMutedState(wasMuted);

        fireEvent(EventValueChanged, e, EventNamespace);
    }
예제 #22
0
void GVEvent::UpdateClientAttrDisplay(const UIData::tagGoodAttr* pGoodAttr)
{
    if(!pGoodAttr)
        return;
    //客户端界面图形ID
    Editbox* pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwIconId));
    //落地图形ID
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID1");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwGroundId));
    //换装图形ID
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID2");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwEquipID));
    //拾取声音ID
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID3");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwSound));
    //挥动弱势伤害声音ID
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID4");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwSoundID1));
    //特殊击中被击中声音ID
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID5");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwSoundID2));
    //武器动作类型
    pEditBox = GetEditbox("GoodsTreeFrame/ClientProperty/EditGraID51");
    if(pEditBox)
        pEditBox->setText(PropertyHelper::intToString(pGoodAttr->dwWeaponActType));
    //攻击时是否混音
    Combobox* cbbo = GetCombobox("GoodsTreeFrame/BaseProperty/CombBoxIsDB1");
    if(pGoodAttr->bSoundSwitch == false)
        cbbo->setItemSelectState(1,true);
    else
        cbbo->setItemSelectState(size_t(0),true);
    //描述
    MultiLineEditbox* muleditbox = static_cast<MultiLineEditbox*>(m_wnd->getChildRecursive("GoodsTreeFrame/ClientProperty/Content"));
    muleditbox->setText(pGoodAttr->strContent.c_str());
}
예제 #23
0
파일: GUI.cpp 프로젝트: lumenrobot/puspa
bool GUI::handleSubmit(const EventArgs& eventArgs)
{
    // get the text entry editbox
    Editbox *editbox = static_cast<Editbox *> (guiConsole->getChild(EntryBoxID));
    // get text out of the editbox
    CEGUI::String edit_text(editbox->getText());
    // if the string is not empty
    if (!edit_text.empty()) {
        // add this entry to the command history buffer
        history.push_back(edit_text);
        // reset history position
        historyPosition = history.size();
        // this is the member function that the agent uses to send the text to the brain
        agent->handleText(editbox->getText().c_str());
        // erase text in text entry box.
        editbox->setText("");
    }
    
    // re-activate the text entry box
    editbox->activate();
    
    return true;
}
예제 #24
0
bool GVEvent::OnSuitAttrItemSelChanged(const CEGUI::EventArgs &args)
{
    //处理套装属性条目选中消息
    MultiColumnList* mcl = static_cast<MultiColumnList*>(m_wnd->getChildRecursive("GoodsTreeFrame/GroupBoxSuitAtrr/MultiColumnList"));
    MyListItem* lti = static_cast<MyListItem*>(mcl->getFirstSelectedItem());
    if(!lti)
    {
        //更新对应的控件
        //值1
        Editbox* edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox");
        edbox->setText("");
        //值2
        edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox1");
        edbox->setText("");
        //套装件数
        edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox2");
        edbox->setText("");
        return false;
    }
    //获取选中的套装属性名称
    const String &strAttrName = lti->getText();
    //值1
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    const String &strValue1 = lti->getText();
    //值2
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    const String &strValue2 = lti->getText();
    //套装件数
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    const String &strSuitNum = lti->getText();

    //更新对应的控件
    //值1
    Editbox* edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox");
    edbox->setText(strValue1);
    //值2
    edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox1");
    edbox->setText(strValue2);
    //套装件数
    edbox = GetEditbox("GoodsTreeFrame/GroupBoxSuitAtrr/EditBox2");
    edbox->setText(strSuitNum);
    return true;
}
예제 #25
0
void GuiConfig::Build(ZProtoGUI *pGUI)
{
	mGUI = (ZProtoGUI*)pGUI;
	root = mGUI->root;
	mFontArial8 = mGUI->mFontArial8;
	mFontArial24 = mGUI->mFontArial24;


	// Create a FrameWindow in the TaharezLook style, and name it 'Demo Window'
	mCondigWindow = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Config Window");
	mCondigWindow->setTitleBarEnabled(false);
	mCondigWindow->setCloseButtonEnabled(false);
	mCondigWindow->setSizingEnabled(false);
	root->addChildWindow(mCondigWindow);
	mCondigWindow->setAlpha(0.6f);
	mCondigWindow ->hide();
	mCondigWindow->setSizingEnabled(false);


	FrameWindow* wnd1 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage0");
	wnd1->setTitleBarEnabled(false);
	wnd1->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd1->setCloseButtonEnabled(false);
	wnd1->setText(GLoc->GetString("PLAYER").c_str());


	FrameWindow* wnd2 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage1");
	wnd2->setTitleBarEnabled(false);
	wnd2->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd2->setCloseButtonEnabled(false);
	wnd2->setText(GLoc->GetString("Controls").c_str());


	FrameWindow* wnd3 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage2");
	wnd3->setTitleBarEnabled(false);
	wnd3->setCloseButtonEnabled(false);
	wnd3->setText(GLoc->GetString("Graphics").c_str());
	wnd3->setFrameEnabled(false);//

	FrameWindow* wnd4 = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "tabPage3");
	wnd4->setTitleBarEnabled(false);
	wnd4->setFrameEnabled(false);//>setTitleBarEnabled(false);
	wnd4->setCloseButtonEnabled(false);
	wnd4->setText(GLoc->GetString("SOUND").c_str());
	//wnd->addChildWindow (winMgr.loadWindowLayout ("TabControlDemo.layout", "TabControlDemo/"));

	TabControl *tc = (TabControl *)winMgr.createWindow("TaharezLook/TabControl", "Config/Tabs");

	mCondigWindow->setPosition(UVector2(cegui_reldim(0.f), cegui_reldim( 0.f)));
	mCondigWindow->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 0.9f)));
	tc->setArea(UVector2(cegui_reldim(0.1f), cegui_reldim( 0.05f)), UVector2(cegui_reldim(0.9f), cegui_reldim( 0.85f)) );



	// Add some pages to tab control
	tc->addTab (wnd1);
	tc->addTab (wnd2);
	tc->addTab (wnd3);
	tc->addTab (wnd4);

	tc->setTabHeight(UDim (0.06f, 0.13f));
	tc->setTabTextPadding(UDim (0.06f, 0.1f));


	mCondigWindow->addChildWindow(tc);

	mCondigWindow->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0.15f)));
	mCondigWindow->setSize(UVector2(cegui_reldim(1.1f), cegui_reldim( 0.70f)));
	mCondigWindow->setAlpha(0.88f);


	wnd1->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd1->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd2->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd2->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd3->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd3->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	wnd4->setPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
	wnd4->setSize(UVector2(cegui_reldim(1.f), cegui_reldim( 1.f)));

	// controls


	for (int allCtrl = 0;allCtrl<sizeof(aCtrlList)/sizeof(CTRLEntry); allCtrl++)
	{
		static const float interligne = 0.06f*1.6f;
		static const float intersize = 0.05f*1.4f;
		tstring numb;
		numb.Printf("%d", allCtrl);

		Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", String(aCtrlList[allCtrl].mName)+String("CtrlLib")+String(numb.c_str()));

		txtlib->setText(GLoc->GetString(aCtrlList[allCtrl].mName).c_str());
		txtlib->setProperty("FrameEnabled", "false");
		txtlib->setProperty("BackgroundEnabled", "false");
		//txtlib->setHorizontalAlignment(HA_CENTRE);
		txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.01f + interligne*allCtrl)));
		txtlib->setSize(UVector2(cegui_reldim(0.19f), cegui_reldim( intersize )));

		wnd2->addChildWindow(txtlib);



		PushButton* txtBut = (PushButton*)winMgr.createWindow("TaharezLook/Button", String(aCtrlList[allCtrl].mName)+String("CtrlBut")+String(numb.c_str()));
		txtBut->setPosition(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.01f + interligne*allCtrl)));
		txtBut->setSize(UVector2(cegui_reldim(0.50f), cegui_reldim( intersize )));

		SetBindedControlString(allCtrl, txtBut);


		//txtBut->setText("A or PAD Button 1");
		txtBut->setHorizontalAlignment(HA_CENTRE);

		wnd2->addChildWindow(txtBut);

		txtBut->subscribeEvent ( PushButton::EventClicked,
			Event::Subscriber (&GuiConfig::handleConfigControlsBut, this));

		txtBut->setID(allCtrl);
		aCtrlList[allCtrl].mWindow = (Window*)txtBut;

	}
	// -- PLAYER

	Editbox* playerName = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "CONFIGPLAYERNAME"));
	wnd1->addChildWindow(playerName);
	playerName->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
	playerName->setSize(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.08f)));
	//playerName->setValidationString("*");
	playerName->setText(GConfig->GetPlayerName());

	Window* txtlib = winMgr.createWindow("TaharezLook/StaticText", "CONFIGPLAYERNAMESTATIC");

	txtlib->setText(GLoc->GetString("PLAYERNAME").c_str());
	txtlib->setProperty("FrameEnabled", "false");
	txtlib->setProperty("BackgroundEnabled", "false");
	txtlib->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
	txtlib->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));

	wnd1->addChildWindow(txtlib);



	// --

	// -- SOUND

	Scrollbar* sfxslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "SFXVOLUME"));
	sfxslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.05f)));
	sfxslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f)));
	sfxslider->setDocumentSize (100);
	sfxslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleSFXVolChanged, this));
	sfxslider->setScrollPosition(float(GConfig->GetQuality("SFXVOLUME")));
	wnd4->addChildWindow(sfxslider);


	Window* txtlibsfx = winMgr.createWindow("TaharezLook/StaticText", "SFXVOLUMESTATIC");
	txtlibsfx->setText(GLoc->GetString("SFXVOLUME").c_str());
	txtlibsfx->setProperty("FrameEnabled", "false");
	txtlibsfx->setProperty("BackgroundEnabled", "false");
	txtlibsfx->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.05f)));
	txtlibsfx->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd4->addChildWindow(txtlibsfx);



	Scrollbar* musicslider = static_cast<Scrollbar*>(winMgr.createWindow("TaharezLook/HorizontalScrollbar", "MUSICVOLUME"));
	musicslider->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.15f)));
	musicslider->setSize(UVector2(cegui_reldim(0.6f), cegui_reldim( 0.08f)));
	musicslider->setDocumentSize (100);
	musicslider->subscribeEvent ( Scrollbar::EventScrollPositionChanged, Event::Subscriber (&GuiConfig::handleMusicVolChanged, this));
	musicslider->setScrollPosition(float(GConfig->GetQuality("MUSICVOLUME")));
	wnd4->addChildWindow(musicslider);


	Window* txtlibmusic = winMgr.createWindow("TaharezLook/StaticText", "MUSICVOLUMESTATIC");
	txtlibmusic->setText(GLoc->GetString("MUSICVOLUME").c_str());
	txtlibmusic->setProperty("FrameEnabled", "false");
	txtlibmusic->setProperty("BackgroundEnabled", "false");
	txtlibmusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.15f)));
	txtlibmusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd4->addChildWindow(txtlibmusic);


    Checkbox* checkMusic = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMUSIC"));
    wnd4->addChildWindow(checkMusic);
	checkMusic->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f)));
	checkMusic->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkMusic->setText(GLoc->GetString("CHKMUSIC").c_str());
	checkMusic->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleChkMusicChanged, this));
	checkMusic->setSelected (GConfig->IsEnable("CHKMUSIC"));

	// --

	// -- VIDEO


    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"));
    wnd3->addChildWindow(cbshad);
    cbshad->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.25f)));
    cbshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbshad->setReadOnly(true);

	Window* txtshad = winMgr.createWindow("TaharezLook/StaticText", "SHADOWQUALITYTXT");
	txtshad->setText(GLoc->GetString("SHADOWQUALITY").c_str());
	txtshad->setProperty("FrameEnabled", "false");
	txtshad->setProperty("BackgroundEnabled", "false");
	txtshad->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.25f)));
	txtshad->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtshad);

	cbshad->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbshad->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));

	cbshad->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleShadowQualityChanged, this));
	CEGUICBSel(cbshad, GConfig->GetQuality("SHADOWQUALITY"));
	// --

    Combobox* cbrefl = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "REFLECTIONQUALITY"));
    wnd3->addChildWindow(cbrefl);
    cbrefl->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.35f)));
    cbrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbrefl->setReadOnly(true);

	Window* txtrefl = winMgr.createWindow("TaharezLook/StaticText", "REFLECTIONQUALITYTXT");
	txtrefl->setText(GLoc->GetString("REFLECTIONQUALITY").c_str());
	txtrefl->setProperty("FrameEnabled", "false");
	txtrefl->setProperty("BackgroundEnabled", "false");
	txtrefl->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.35f)));
	txtrefl->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtrefl);

	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("DISABLED").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbrefl->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));
	cbrefl->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleReflectionQualityChanged, this));
	CEGUICBSel(cbrefl, GConfig->GetQuality("REFLECTIONQUALITY"));
	// --
    Combobox* cbwater = static_cast<Combobox*>(winMgr.createWindow("TaharezLook/Combobox", "WATERQUALITY"));
    wnd3->addChildWindow(cbwater);
    cbwater->setPosition(UVector2(cegui_reldim(0.3f), cegui_reldim( 0.45f)));
    cbwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.33f)));
	cbwater->setReadOnly(true);

	Window* txtwater = winMgr.createWindow("TaharezLook/StaticText", "WATERQUALITYTXT");
	txtwater->setText(GLoc->GetString("WATERQUALITY").c_str());
	txtwater->setProperty("FrameEnabled", "false");
	txtwater->setProperty("BackgroundEnabled", "false");
	txtwater->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.45f)));
	txtwater->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	wnd3->addChildWindow(txtwater);

	cbwater->addItem (new ListboxTextItem(GLoc->GetString("LOW").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("MEDIUM").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("HIGH").c_str()));
	cbwater->addItem (new ListboxTextItem(GLoc->GetString("VERYHIGH").c_str()));
	cbwater->subscribeEvent ( Combobox::EventListSelectionAccepted, Event::Subscriber (&GuiConfig::handleWaterQualityChanged, this));
	CEGUICBSel(cbwater, GConfig->GetQuality("WATERQUALITY"));
	// --

    Checkbox* checkDOF = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKDOF"));
    wnd3->addChildWindow(checkDOF);
	checkDOF->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.55f)));
	checkDOF->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkDOF->setText(GLoc->GetString("DEPTHOFFIELD").c_str());
	checkDOF->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleDOFChanged, this));
	checkDOF->setSelected (GConfig->IsEnable("CHKDOF"));

    Checkbox* checkMBLUR = static_cast<Checkbox*>(winMgr.createWindow("TaharezLook/Checkbox", "CHKMBLUR"));
    wnd3->addChildWindow(checkMBLUR);
	checkMBLUR->setPosition(UVector2(cegui_reldim(0.05f), cegui_reldim( 0.65f)));
	checkMBLUR->setSize(UVector2(cegui_reldim(0.24f), cegui_reldim( 0.08f )));
	checkMBLUR->setText(GLoc->GetString("MOTIONBLUR").c_str());
	checkMBLUR->subscribeEvent ( Checkbox::EventCheckStateChanged, Event::Subscriber (&GuiConfig::handleMBLURChanged, this));
	checkMBLUR->setSelected (GConfig->IsEnable("CHKMBLUR"));
/*
	Resolution

	Enable FullScreen

	shadows quality (disabled, medium, high, ultrahigh)
	0, 1024, 2048, 4096
	reflection quality (disabled, low, medium, high)
	0, 256, 512, 1024
	water quality (low, medium, high, ultra high)

	enable Depth of field
	enable motion blur

	*/

	// --
	PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "configOK"));
	mCondigWindow->addChildWindow(btn);
	btn->setPosition(UVector2(cegui_reldim(0.77f), cegui_reldim( 0.90f)));
	btn->setSize(UVector2(cegui_reldim(0.20f), cegui_reldim( 0.065f)));
	btn->setText("OK");
	btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GuiConfig::HandleConfigOK, this));

}
예제 #26
0
/*************************************************************************
    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");
    label->setPosition(UVector2(cegui_reldim(0.44f), cegui_reldim( 0.2f)));
    label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
    label->setText("Caption:");

    PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/ControlPanel/ColumnPanel/AddColButton"));
    st->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.81f), cegui_reldim( 0.32f)));
    btn->setSize(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.2f)));
    btn->setText("Add");

    Editbox* ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/NewColIDBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");
    ebox->setText("Test -- ");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/NewColWidthBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.23f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/NewColTextBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.44f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.36f), cegui_reldim( 0.2f)));
    ebox->setValidationString(".*");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label4");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.55f)));
    label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
    label->setText("ID Code:");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/DelColIDBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.67f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/ControlPanel/ColumnPanel/DelColButton"));
    st->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.25f), cegui_reldim( 0.67f)));
    btn->setSize(UVector2(cegui_reldim(0.4f), cegui_reldim( 0.2f)));
    btn->setText("Delete Column");

    // Row control box
    st = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/RowControl");
    fwnd->addChildWindow(st);
    st->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.38f)));
    st->setSize(UVector2(cegui_reldim(0.96f), cegui_reldim( 0.25f)));
    st->setText("Row Control");
    st->setProperty("VertFormatting", "TopAligned");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label5");
    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("Col ID:");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label6");
    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.55f), cegui_reldim( 0.12f)));
    label->setText("Item Text:");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/RowColIDBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/RowTextBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.23f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.55f), cegui_reldim( 0.2f)));
    ebox->setValidationString(".*");

    btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/ControlPanel/ColumnPanel/AddRowButton"));
    st->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.81f), cegui_reldim( 0.32f)));
    btn->setSize(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.2f)));
    btn->setText("Add");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label7");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.55f)));
    label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
    label->setText("Row Idx:");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/DelRowIdxBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.67f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/ControlPanel/ColumnPanel/DelRowButton"));
    st->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.25f), cegui_reldim( 0.67f)));
    btn->setSize(UVector2(cegui_reldim(0.4f), cegui_reldim( 0.2f)));
    btn->setText("Delete Row");

    // set item box
    st = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/SetItemPanel");
    fwnd->addChildWindow(st);
    st->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.65f)));
    st->setSize(UVector2(cegui_reldim(0.96f), cegui_reldim( 0.25f)));
    st->setText("Item Modification");
    st->setProperty("VertFormatting", "TopAligned");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label8");
    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("Row Idx:");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label9");
    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("Col ID:");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/Label10");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.44f), cegui_reldim( 0.2f)));
    label->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.12f)));
    label->setText("Item Text:");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/SetItemRowBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/SetItemIDBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.23f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.2f), cegui_reldim( 0.2f)));
    ebox->setValidationString("\\d*");

    ebox = static_cast<Editbox*>(winMgr.createWindow("TaharezLook/Editbox", "Demo6/ControlPanel/ColumnPanel/SetItemTextBox"));
    st->addChildWindow(ebox);
    ebox->setPosition(UVector2(cegui_reldim(0.44f), cegui_reldim( 0.32f)));
    ebox->setSize(UVector2(cegui_reldim(0.36f), cegui_reldim( 0.2f)));
    ebox->setValidationString(".*");

    btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/ControlPanel/ColumnPanel/SetItemButton"));
    st->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.81f), cegui_reldim( 0.32f)));
    btn->setSize(UVector2(cegui_reldim(0.15f), cegui_reldim( 0.2f)));
    btn->setText("Set");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/RowCount");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.55f)));
    label->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 0.12f)));
    label->setText("Current Row Count:");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/ColCount");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.67f)));
    label->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 0.12f)));
    label->setText("Current Column Count:");

    label = winMgr.createWindow("TaharezLook/StaticText", "Demo6/ControlPanel/SelCount");
    st->addChildWindow(label);
    label->setProperty("FrameEnabled", "false");
    label->setProperty("BackgroundEnabled", "false");
    label->setPosition(UVector2(cegui_reldim(0.02f), cegui_reldim( 0.79f)));
    label->setSize(UVector2(cegui_reldim(1.0f), cegui_reldim( 0.12f)));
    label->setText("Current Selected Count:");

    btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Demo6/QuitButton"));
    fwnd->addChildWindow(btn);
    btn->setPosition(UVector2(cegui_reldim(0.25f), cegui_reldim( 0.93f)));
    btn->setSize(UVector2(cegui_reldim(0.50f), cegui_reldim( 0.05f)));
    btn->setText("Quit This Demo!");
}
예제 #27
0
bool GVEvent::OnAddAttrItemSelChanged(const CEGUI::EventArgs &args)
{
    //处理附加属性条目选中消息
    MultiColumnList* mcl = static_cast<MultiColumnList*>(m_wnd->getChildRecursive("GoodsTreeFrame/AddProperty/MultiColumnList"));
    MyListItem* lti = static_cast<MyListItem*>(mcl->getFirstSelectedItem());
    if(!lti)
    {
        //更新对应的控件
        //是否有效
        Combobox* cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox1");
        cbbo->setItemSelectState(1,false);
        cbbo->setItemSelectState((size_t)0,false);
        //是否隐藏
        cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox11");
        cbbo->setItemSelectState(1,false);
        cbbo->setItemSelectState((size_t)0,false);
        //值1
        Editbox* edbox = GetEditbox("GoodsTreeFrame/AddProperty/EditBoxValue1");
        edbox->setText("");
        //值2
        edbox = GetEditbox("GoodsTreeFrame/AddProperty/EditBoxValue11");
        edbox->setText("");
        return false;
    }
    //获取选中的附加属性名称
    const String &strAttrName = lti->getText();
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    //获取选中的附加属性是否有效
    const String &strEnable = lti->getText();
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    //是否隐藏
    const String &strHide = lti->getText();
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    //值1
    const String &strValue1 = lti->getText();
    lti = static_cast<MyListItem*>(mcl->getNextSelected(lti));
    //值2
    const String &strValue2 = lti->getText();

    //更新对应的控件
    Combobox* cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox1");
    bool b = PropertyHelper::stringToBool(strEnable);
    //是否有效
    if( b == false)
        cbbo->setItemSelectState(1,true);
    else
        cbbo->setItemSelectState((size_t)0,true);
    b = PropertyHelper::stringToBool(strHide);
    cbbo = GetCombobox("GoodsTreeFrame/AddProperty/GroupBox11");
    //是否隐藏
    if(b == false)
        cbbo->setItemSelectState(1,true);
    else
        cbbo->setItemSelectState((size_t)0,true);
    //值1
    Editbox* edbox = GetEditbox("GoodsTreeFrame/AddProperty/EditBoxValue1");
    edbox->setText(strValue1);
    //值2
    edbox = GetEditbox("GoodsTreeFrame/AddProperty/EditBoxValue11");
    edbox->setText(strValue2);
    return true;
}