_MEMBER_FUNCTION_IMPL(GUICheckBox, setChecked) { SQBool sqbChecked; sq_getbool(pVM, -1, &sqbChecked); CEGUI::Checkbox * pWindow = sq_getinstance<CEGUI::Checkbox *>(pVM); if(!pWindow) { sq_pushbool(pVM, false); return 1; } pWindow->setSelected(sqbChecked != 0); sq_pushbool(pVM, true); return 1; }
void ArrayEditor<ElementType>::SetupWidget(Model* model) { // Set dimensions CEGUI::UDim dimLeft = model->IsShareable() ? cegui_absdim(16) : cegui_absdim(0); // Setup label widget CEGUI::Window* labelWidget = mHeaderWidget->getChildAtIdx(0); labelWidget->setArea(CEGUI::URect(dimLeft, cegui_absdim(0), CEGUI::UDim(0.5f, -2), cegui_reldim(1))); labelWidget->setText(utf8StringToCEGUI(model->GetName())); labelWidget->setTooltipText(model->GetTooltip()); // Setup buttons if (model->IsReadOnly()) { mButtonAddElement->setEnabled(false); mButtonSave->setEnabled(false); mButtonRevert->setEnabled(false); } else { mButtonAddElement->setEnabled(true); mButtonSave->setEnabled(false); mButtonRevert->setEnabled(false); } // Setup is-shared checkbox CEGUI::Checkbox* isSharedCheckbox = static_cast<CEGUI::Checkbox*>(mHeaderWidget->getChildAtIdx(4)); if (model->IsShareable()) { isSharedCheckbox->setVisible(true); isSharedCheckbox->setPosition(CEGUI::UVector2(cegui_absdim(0), cegui_absdim(0))); isSharedCheckbox->setSelected(model->IsShared()); } else { isSharedCheckbox->setVisible(false); } // Setup body widget mEditorWidget->getChildAtIdx(1)->setHeight(cegui_absdim(0)); mBodyLayout->Clear(); }
/*********************************************************** set if the server is on or not ***********************************************************/ void LoginGUI::SetServrOn(bool ServerOn) { try { CEGUI::Window * lt = static_cast<CEGUI::Window *> ( CEGUI::WindowManager::getSingleton().getWindow("ServerOnLabel")); lt->setText((ServerOn ? "Server: ON" : "Server: OFF")); if(!ServerOn) { CEGUI::Checkbox* cb = static_cast<CEGUI::Checkbox *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginPlayLocalCb")); cb->setSelected(true); } } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception trying to set server state from the gui: ") + ex.getMessage().c_str()); } }
void cRandom_Sound::Editor_Activate(void) { CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton(); // filename CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_filename")); Editor_Add(UTF8_("Filename"), UTF8_("Sound filename"), editbox, 200); editbox->setText(m_filename.c_str()); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Filename_Text_Changed, this)); // continuous CEGUI::Checkbox* checkbox = static_cast<CEGUI::Checkbox*>(wmgr.createWindow("TaharezLook/Checkbox", "editor_sound_continuous")); Editor_Add(UTF8_("Continuous"), UTF8_("Check if the sound should be played continuously instead of randomly"), checkbox, 50); checkbox->setSelected(m_continuous); checkbox->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Continuous_Changed, this)); // delay min editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_delay_min")); Editor_Add(UTF8_("Delay Minimum"), UTF8_("Minimal delay until played again"), editbox, 90); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(m_delay_min)); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Delay_Min_Text_Changed, this)); // delay max editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_delay_max")); Editor_Add(UTF8_("Maximum"), UTF8_("Maximal delay until played again"), editbox, 90, 28, 0); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(m_delay_max)); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Delay_Max_Text_Changed, this)); // volume min editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_volume_min")); Editor_Add(UTF8_("Volume Minimum"), UTF8_("Minimal random volume for each play"), editbox, 90); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(static_cast<int>(m_volume_min))); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Volume_Min_Text_Changed, this)); // volume max editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_volume_max")); Editor_Add(UTF8_("Maximum"), UTF8_("Maximal random volume for each play"), editbox, 90, 28, 0); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(static_cast<int>(m_volume_max))); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Volume_Max_Text_Changed, this)); // volume reduction begin editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_volume_reduction_begin")); Editor_Add(UTF8_("Volume Reduction Begin"), UTF8_("Volume reduction begins gradually at this distance"), editbox, 90); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(static_cast<int>(m_volume_reduction_begin))); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Volume_Reduction_Begin_Text_Changed, this)); // volume reduction end editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_sound_volume_reduction_end")); Editor_Add(UTF8_("End"), UTF8_("Volume reduction ends at this distance. Sound is not played beyond this."), editbox, 90, 28, 0); editbox->setValidationString("^[+]?\\d*$"); editbox->setText(int_to_string(static_cast<int>(m_volume_reduction_end))); editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cRandom_Sound::Editor_Volume_Reduction_End_Text_Changed, this)); // init Editor_Init(); }
CSettingsMenu::CSettingsMenu(void) { assert(!m_pSingleton); // Set our singleton m_pSingleton = this; // Set up the GUI CGUI * pGUI = g_pClient->GetGUI(); float fWidth = (float)pGUI->GetDisplayWidth(); float fHeight = (float)pGUI->GetDisplayHeight(); m_GUIElements.pWindow = pGUI->CreateGUIFrameWindow(); m_GUIElements.pWindow->setText("Settings"); m_GUIElements.pWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0, 520), CEGUI::UDim(0, 390))); m_GUIElements.pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, fWidth/2-260), CEGUI::UDim(0, fHeight/2-190))); m_GUIElements.pWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnCloseClick, this)); m_GUIElements.pWindow->setVisible(false); m_GUIElements.pTabControl = pGUI->CreateGUITabControl(); m_GUIElements.pWindow->addChildWindow( m_GUIElements.pTabControl ); m_GUIElements.pTabControl->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(0.8f, 0))); m_GUIElements.pGeneralPane = pGUI->CreateGUITabContentPane(); m_GUIElements.pGeneralPane->setText("General"); m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pGeneralPane ); m_GUIElements.pGeneralPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0))); m_GUIElements.pChatPane = pGUI->CreateGUITabContentPane(); m_GUIElements.pChatPane->setText("Chat"); m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pChatPane ); m_GUIElements.pChatPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0))); m_GUIElements.pNickStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane); m_GUIElements.pNickStaticText->setText("Name"); m_GUIElements.pNickStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pNickStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0))); m_GUIElements.pNickStaticText->setProperty("FrameEnabled", "false"); m_GUIElements.pNickStaticText->setProperty("BackgroundEnabled", "false"); m_GUIElements.pNickStaticText->setFont(pGUI->GetFont("tahoma-bold")); m_GUIElements.pNickEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pGeneralPane); m_GUIElements.pNickEditBox->setText(CGUI::AnsiToCeguiFriendlyString(g_pClient->GetNick())); m_GUIElements.pNickEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pNickEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0))); m_GUIElements.pWindowedStaticText= pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane); m_GUIElements.pWindowedStaticText->setText("Windowed"); m_GUIElements.pWindowedStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pWindowedStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pWindowedStaticText->setProperty("FrameEnabled", "false"); m_GUIElements.pWindowedStaticText->setProperty("BackgroundEnabled", "false"); m_GUIElements.pWindowedStaticText->setFont(pGUI->GetFont("tahoma-bold")); m_GUIElements.pWindowedCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane); CEGUI::Checkbox * pCheckBox = (CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox; pCheckBox->setSelected(g_pClient->IsWindowedMode()); m_GUIElements.pWindowedCheckBox->setText(""); m_GUIElements.pWindowedCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pWindowedCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pFPSStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane); m_GUIElements.pFPSStaticText->setText("Show FPS"); m_GUIElements.pFPSStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pFPSStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.6f, 0))); m_GUIElements.pFPSStaticText->setProperty("FrameEnabled", "false"); m_GUIElements.pFPSStaticText->setProperty("BackgroundEnabled", "false"); m_GUIElements.pFPSStaticText->setFont(pGUI->GetFont("tahoma-bold")); m_GUIElements.pFPSCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane); CEGUI::Checkbox * pCheckBox2 = (CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox; pCheckBox2->setSelected(g_pClient->GetFPSToggle()); m_GUIElements.pFPSCheckBox->setText(""); m_GUIElements.pFPSCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pFPSCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.6f, 0))); m_GUIElements.pChatFontSizeStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane); m_GUIElements.pChatFontSizeStaticText->setText("Chatfont/Fontsize"); m_GUIElements.pChatFontSizeStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatFontSizeStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0))); m_GUIElements.pChatFontSizeStaticText->setProperty("FrameEnabled", "false"); m_GUIElements.pChatFontSizeStaticText->setProperty("BackgroundEnabled", "false"); m_GUIElements.pChatFontSizeStaticText->setFont(pGUI->GetFont("tahoma-bold")); m_GUIElements.pChatFontEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatFontEditBox->setText(CVAR_GET_STRING("chatfont").Get()); m_GUIElements.pChatFontEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatFontEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0))); m_GUIElements.pChatFontSizeEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatFontSizeEditBox->setText(CVAR_GET_EX("chatsize").Get()); m_GUIElements.pChatFontSizeEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatFontSizeEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.3f, 0))); m_GUIElements.pChatBackgroundStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane); m_GUIElements.pChatBackgroundStaticText->setText("Background (A,R,G,B)"); m_GUIElements.pChatBackgroundStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatBackgroundStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.4f, 0))); m_GUIElements.pChatBackgroundStaticText->setProperty("FrameEnabled", "false"); m_GUIElements.pChatBackgroundStaticText->setProperty("BackgroundEnabled", "false"); m_GUIElements.pChatBackgroundStaticText->setFont(pGUI->GetFont("tahoma-bold")); m_GUIElements.pChatBGColorAEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatBGColorAEditBox->setText(CVAR_GET_EX("chatbga").Get()); m_GUIElements.pChatBGColorAEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatBGColorAEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pChatBGColorREditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatBGColorREditBox->setText(CVAR_GET_EX("chatbgr").Get()); m_GUIElements.pChatBGColorREditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatBGColorREditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.35f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pChatBGColorGEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatBGColorGEditBox->setText(CVAR_GET_EX("chatbgg").Get()); m_GUIElements.pChatBGColorGEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatBGColorGEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pChatBGColorBEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane); m_GUIElements.pChatBGColorBEditBox->setText(CVAR_GET_EX("chatbgb").Get()); m_GUIElements.pChatBGColorBEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pChatBGColorBEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.5f, 0))); m_GUIElements.pSaveButton = pGUI->CreateGUIButton(m_GUIElements.pWindow); m_GUIElements.pSaveButton->setText("Save"); m_GUIElements.pSaveButton->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0))); m_GUIElements.pSaveButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.8f, 0))); m_GUIElements.pSaveButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnSaveButtonClick, this)); m_bVisible = false; }