Ejemplo n.º 1
0
//-----------------------------------------------------------------------------------
    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);
    }
Ejemplo n.º 2
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();
}
Ejemplo n.º 3
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);
	}