forked from teamnwah/openmw-tes3coop
Make the "lock window" button to change state visually
This commit is contained in:
parent
43d6392921
commit
3ba3c71556
11 changed files with 84 additions and 6 deletions
|
@ -30,7 +30,7 @@ add_openmw_dir (mwgui
|
||||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
|
||||||
itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog
|
itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog
|
||||||
enchantingdialog trainingwindow travelwindow imagebutton
|
enchantingdialog trainingwindow travelwindow imagebutton exposedwindow
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
|
|
26
apps/openmw/mwgui/exposedwindow.cpp
Normal file
26
apps/openmw/mwgui/exposedwindow.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
|
#include "MyGUI_Window.h"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
MyGUI::VectorWidgetPtr ExposedWindow::getSkinWidgetsByName (const std::string &name)
|
||||||
|
{
|
||||||
|
return MyGUI::Widget::getSkinWidgetsByName (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
MyGUI::Widget* ExposedWindow::getSkinWidget(const std::string & _name, bool _throw)
|
||||||
|
{
|
||||||
|
MyGUI::VectorWidgetPtr widgets = getSkinWidgetsByName (_name);
|
||||||
|
|
||||||
|
if (widgets.empty())
|
||||||
|
{
|
||||||
|
MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' not found in skin of layout '" << getName() << "'");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return widgets[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
apps/openmw/mwgui/exposedwindow.hpp
Normal file
26
apps/openmw/mwgui/exposedwindow.hpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef MWGUI_EXPOSEDWINDOW_H
|
||||||
|
#define MWGUI_EXPOSEDWINDOW_H
|
||||||
|
|
||||||
|
#include "MyGUI_Window.h"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief subclass to provide access to some Widget internals.
|
||||||
|
*/
|
||||||
|
class ExposedWindow : public MyGUI::Window
|
||||||
|
{
|
||||||
|
MYGUI_RTTI_DERIVED(ExposedWindow)
|
||||||
|
|
||||||
|
public:
|
||||||
|
MyGUI::VectorWidgetPtr getSkinWidgetsByName (const std::string &name);
|
||||||
|
|
||||||
|
MyGUI::Widget* getSkinWidget(const std::string & _name, bool _throw = true);
|
||||||
|
///< Get a widget defined in the inner skin of this window.
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
||||||
|
@ -9,6 +11,9 @@ WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::Win
|
||||||
{
|
{
|
||||||
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||||
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
|
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
|
||||||
|
|
||||||
|
ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget);
|
||||||
|
mPinButton = window->getSkinWidget ("Button");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
|
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
|
||||||
|
@ -16,6 +21,12 @@ void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std:
|
||||||
if ("PinToggle" == eventName)
|
if ("PinToggle" == eventName)
|
||||||
{
|
{
|
||||||
mPinned = !mPinned;
|
mPinned = !mPinned;
|
||||||
|
|
||||||
|
if (mPinned)
|
||||||
|
mPinButton->changeWidgetSkin ("PinDown");
|
||||||
|
else
|
||||||
|
mPinButton->changeWidgetSkin ("PinUp");
|
||||||
|
|
||||||
onPinToggled();
|
onPinToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace MWGui
|
||||||
protected:
|
protected:
|
||||||
virtual void onPinToggled() = 0;
|
virtual void onPinToggled() = 0;
|
||||||
|
|
||||||
|
MyGUI::Widget* mPinButton;
|
||||||
bool mPinned;
|
bool mPinned;
|
||||||
bool mVisible;
|
bool mVisible;
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "enchantingdialog.hpp"
|
#include "enchantingdialog.hpp"
|
||||||
#include "trainingwindow.hpp"
|
#include "trainingwindow.hpp"
|
||||||
#include "imagebutton.hpp"
|
#include "imagebutton.hpp"
|
||||||
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -127,6 +128,7 @@ WindowManager::WindowManager(
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedTextBox>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedTextBox>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
|
||||||
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
|
||||||
|
|
||||||
MyGUI::LanguageManager::getInstance().eventRequestTag = MyGUI::newDelegate(this, &WindowManager::onRetrieveTag);
|
MyGUI::LanguageManager::getInstance().eventRequestTag = MyGUI::newDelegate(this, &WindowManager::onRetrieveTag);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
||||||
|
|
||||||
<Widget type="Widget" skin="" position="0 0 224 223" align="Left Top" name="LeftPane">
|
<Widget type="Widget" skin="" position="0 0 224 223" align="Left Top" name="LeftPane">
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 300" name="_Main">
|
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 300" name="_Main">
|
||||||
|
|
||||||
<!-- Local map -->
|
<!-- Local map -->
|
||||||
<Widget type="ScrollView" skin="MW_MapView" position="0 0 284 264" align="ALIGN_STRETCH" name="LocalMap">
|
<Widget type="ScrollView" skin="MW_MapView" position="0 0 284 264" align="ALIGN_STRETCH" name="LocalMap">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
||||||
|
|
||||||
<!-- Effect box-->
|
<!-- Effect box-->
|
||||||
<Widget type="Widget" skin="MW_Box" position="8 8 268 24" align="Left Top HStretch">
|
<Widget type="Widget" skin="MW_Box" position="8 8 268 24" align="Left Top HStretch">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 500 342" name="_Main">
|
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 500 342" name="_Main">
|
||||||
|
|
||||||
<Widget type="Widget" skin="" name="LeftPane" position="0 0 220 342">
|
<Widget type="Widget" skin="" name="LeftPane" position="0 0 220 342">
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,18 @@
|
||||||
</BasisSkin>
|
</BasisSkin>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
|
<!-- Define the background for pin button -->
|
||||||
|
<Skin name = "PinUp" size = "16 16" texture = "textures\menu_rightbuttondown_center.dds">
|
||||||
|
<BasisSkin type="MainSkin" offset = "0 0 16 16">
|
||||||
|
<State name="normal" offset = "0 0 16 16"/>
|
||||||
|
</BasisSkin>
|
||||||
|
</Skin>
|
||||||
|
<Skin name = "PinDown" size = "8 8" texture = "transparent.png">
|
||||||
|
<BasisSkin type="MainSkin" offset = "0 0 8 8">
|
||||||
|
<State name="normal" offset = "0 0 8 8"/>
|
||||||
|
</BasisSkin>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
<!-- Defines a pure black background -->
|
<!-- Defines a pure black background -->
|
||||||
<Skin name = "DialogBG" size = "8 8" texture = "black.png">
|
<Skin name = "DialogBG" size = "8 8" texture = "black.png">
|
||||||
<BasisSkin type="MainSkin" offset = "0 0 8 8">
|
<BasisSkin type="MainSkin" offset = "0 0 8 8">
|
||||||
|
@ -473,7 +485,7 @@
|
||||||
<Property key="Scale" value = "1 1 0 0"/>
|
<Property key="Scale" value = "1 1 0 0"/>
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
<Child type="Button" skin="BlackBG" offset="230 4 21 19" align="ALIGN_RIGHT ALIGN_TOP" name="Button">
|
<Child type="Button" skin="PinUp" offset="230 4 21 19" align="ALIGN_RIGHT ALIGN_TOP" name="Button">
|
||||||
<Property key="Event" value="PinToggle"/>
|
<Property key="Event" value="PinToggle"/>
|
||||||
</Child>
|
</Child>
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
Loading…
Reference in a new issue