_MEMBER_FUNCTION_IMPL(GUICheckBox, isChecked)
{
	CEGUI::Checkbox * pWindow = sq_getinstance<CEGUI::Checkbox *>(pVM);

	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	sq_pushbool(pVM, pWindow->isSelected());
	return 1;
}
//-----------------------------------------------------------------------------------
    bool ItemSelectorViewManager::handleCheckStateChanged(const CEGUI::EventArgs& e)
    {
        // activate controller if set
        if (mItemSelectorController)
        {
            CEGUI::Checkbox* checkbox = static_cast<CEGUI::Checkbox*>(
                static_cast<const CEGUI::WindowEventArgs&>(e).window);
            mItemSelectorController->itemStateChanged(checkbox->getID(), checkbox->isSelected());
            float selectColour = checkbox->isSelected() ? 0.0f : 1.0f;
            checkbox->setProperty("NormalTextColour",
                CEGUI::PropertyHelper::colourToString(CEGUI::colour(selectColour, 1.0f, selectColour)));
        }
        return true;
    }
_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;
}
Example #4
0
	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();
	}
Example #5
0
/***********************************************************
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());
	}
}
Example #6
0
bool OgreSample13App::handleCheckboxs(const CEGUI::EventArgs & args)
{
	CEGUI::Checkbox * cb = static_cast<CEGUI::Checkbox *>(static_cast<const CEGUI::WindowEventArgs&>(args).window);
	if (cb->getName() == CEGUI::String("OgreSample13/checkbox2"))
	{
		if (cb->isSelected())
		{
			mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);
			mSceneMgr->setShadowFarDistance(1000.0f);
		}
		else
		{
			mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE);
		}
	}
	else
	{
		CompositorManager::getSingleton().setCompositorEnabled(mCameraMan->getCamera()->getViewport(),"Bloom",cb->isSelected());
	}
	return true;
}
Example #7
0
/***********************************************************
handle connect button event
***********************************************************/
bool LoginGUI::HandleConnect(const CEGUI::EventArgs& e)
{
	try
	{
		CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame")->hide();

		CEGUI::Editbox * lt = static_cast<CEGUI::Editbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("LoginText"));
		CEGUI::Editbox * pt = static_cast<CEGUI::Editbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("PasswordText"));

		CEGUI::Checkbox * cbl = static_cast<CEGUI::Checkbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("LoginPlayLocalCb"));


		if(lt && pt && cbl)
		{
			bool seleplaylo = cbl->isSelected();
			std::string txtl = lt->getText().c_str();
			std::string txtt = pt->getText().c_str();
			if((txtl != "") && (txtl.size() <= 20) && (txtt.size() <= 20))
			{
				std::string samples = "Data/Samples/lba2launcherblob.wav";
				MusicHandler::getInstance()->PlaySample(samples, 0);
				ConfigurationManager::GetInstance()->SetString("Player.Name", txtl);
				pt->setText("");
				ThreadSafeWorkpile::getInstance()->AddEvent(new LoginEvent(txtl, txtt, seleplaylo));
			}
		}
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception trying to get connection info from the gui: ") + ex.getMessage().c_str());
		return false;
	}

	return true;
}
//-----------------------------------------------------------------------------------
    void ItemSelectorViewManager::addItemSelector(const Ogre::String& displayText)
    {
        // add a new item selector
        // determine new index for item
        assert(mScrollablePane);
        const size_t idx = mItemSelectorContainer.size();
        mItemSelectorContainer.push_back(ItemSelector());
        ItemSelector& item = mItemSelectorContainer.back();
        // create new checkbox
        CEGUI::Checkbox* checkbox = item.CheckBoxWidget = (CEGUI::Checkbox*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Checkbox",
                                    ( ("ItemCheckbox" + Ogre::StringConverter::toString(idx)).c_str() ));
        // set checkbox ID to selector ID
        checkbox->setID(idx);
        checkbox->setSize(CEGUI::UVector2(CEGUI::UDim(0, 140), CEGUI::UDim(0, ITEM_YSIZE)));
        checkbox->setText(displayText.c_str());
        checkbox->setProperty("HoverTextColour", CEGUI::PropertyHelper::colourToString(CEGUI::colour(1.0, 1.0, 0.0)));
        // add event handler for when checkbox state changes
        checkbox->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&ItemSelectorViewManager::handleCheckStateChanged, this ));
        checkbox->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 12 + (ITEM_YSIZE + ITEM_YSPACING)* static_cast<float>(idx))));
        // add checkbox to the scroll pane
        mScrollablePane->addChildWindow(checkbox);
    }
Example #9
0
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();
}
Example #10
0
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;
}
Example #11
0
	void ArrayEditor<ElementType>::InitWidget()
	{
		static unsigned int editorCounter = 0;
		OC_DASSERT(mEditorWidget == 0);

		CEGUI::String editorName = "Editor/EntityWindow/ValueEditors/ArrayEditor" + string(Reflection::PropertyTypes::GetStringName(Reflection::PropertyTypes::GetTypeID<ElementType>())) +  Utils::StringConverter::ToString(editorCounter++);
		
		// Create main editor widget
		mEditorWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName);
		mMainLayout = new GUISystem::VerticalLayout(mEditorWidget, 0, true);
		
		// Create header widget
		mHeaderWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName + "/Header");
		mHeaderWidget->setHeight(CEGUI::UDim(0, GetEditboxHeight()));
		mMainLayout->AddChildWindow(mHeaderWidget);

		// Create label widget
		CEGUI::Window* labelWidget = this->CreateLabelWidget(editorName + "/Header/Label");
		labelWidget->setArea(CEGUI::URect(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0), CEGUI::UDim(0.5f, -2), CEGUI::UDim(0, GetEditboxHeight())));
		mHeaderWidget->addChildWindow(labelWidget);

		// Create add element button
		mButtonAddElement = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/AddElementButton"));
		mButtonAddElement->setProperty("NormalImage", "set:EditorToolbar image:btnAddNormal");
		mButtonAddElement->setProperty("HoverImage", "set:EditorToolbar image:btnAddHover");
		mButtonAddElement->setProperty("PushedImage", "set:EditorToolbar image:btnAddPushed");
		mButtonAddElement->setProperty("DisabledImage", "set:EditorToolbar image:btnAddDisabled");
		mButtonAddElement->setWantsMultiClickEvents(false);
		mButtonAddElement->setTooltipText(TR("entity_editor_add_hint"));
		mButtonAddElement->setVisible(true);
		mButtonAddElement->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonAddElement->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -80), CEGUI::UDim(0, 0)));
		mButtonAddElement->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonAddPressed, this));
		mHeaderWidget->addChildWindow(mButtonAddElement);

		// Create revert button
		mButtonRevert = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/RevertButton"));
		mButtonRevert->setProperty("NormalImage", "set:EditorToolbar image:btnCancelNormal");
		mButtonRevert->setProperty("HoverImage", "set:EditorToolbar image:btnCancelHover");
		mButtonRevert->setProperty("PushedImage", "set:EditorToolbar image:btnCancelPushed");
		mButtonRevert->setProperty("DisabledImage", "set:EditorToolbar image:btnCancelDisabled");
		mButtonRevert->setWantsMultiClickEvents(false);
		mButtonRevert->setTooltipText(TR("entity_editor_revert_hint"));
		mButtonRevert->setVisible(true);
		mButtonRevert->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonRevert->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -52), CEGUI::UDim(0, 0)));
		mButtonRevert->setEnabled(false);
		mButtonRevert->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonRevertPressed, this));
		mHeaderWidget->addChildWindow(mButtonRevert);

		// Create save button
		mButtonSave = static_cast<CEGUI::PushButton*>(gGUIMgr.CreateWindow("Editor/ImageButton", editorName + "/Header/SaveButton"));
		mButtonSave->setProperty("NormalImage", "set:EditorToolbar image:btnSaveNormal");
		mButtonSave->setProperty("HoverImage", "set:EditorToolbar image:btnSaveHover");
		mButtonSave->setProperty("PushedImage", "set:EditorToolbar image:btnSavePushed");
		mButtonSave->setProperty("DisabledImage", "set:EditorToolbar image:btnSaveDisabled");
		mButtonSave->setWantsMultiClickEvents(false);
		mButtonSave->setTooltipText(TR("entity_editor_save_hint"));
		mButtonSave->setVisible(true);
		mButtonSave->setSize(CEGUI::UVector2(cegui_absdim(24), cegui_absdim(24)));
		mButtonSave->setPosition(CEGUI::UVector2(CEGUI::UDim(1, -24), CEGUI::UDim(0, 0)));
		mButtonSave->setEnabled(false);
		mButtonSave->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Editor::ArrayEditor<ElementType>::OnEventButtonSavePressed, this));
		mHeaderWidget->addChildWindow(mButtonSave);

		// Create is-shared checkbox
		CEGUI::Checkbox* isSharedCheckbox = CreateIsSharedCheckboxWidget(editorName + "/Header/IsSharedCheckbox");
		isSharedCheckbox->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
		isSharedCheckbox->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&ArrayEditor::OnEventIsSharedCheckboxChanged, this));
		mHeaderWidget->addChildWindow(isSharedCheckbox);

		// Create body widget
		CEGUI::Window* bodyWidget = gGUIMgr.CreateWindow("DefaultWindow", editorName + "/Body");
		mBodyLayout = new GUISystem::VerticalLayout(bodyWidget, 0, true);
		mMainLayout->AddChildWindow(bodyWidget);
	}