Remove "PinToggle" event from layout file

actorid
Emanuel Guevel 12 years ago
parent 2dea86bbc7
commit 3dc28baa28

@ -9,26 +9,20 @@ using namespace MWGui;
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager) WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
: WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false) : WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false)
{ {
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget); ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget);
mPinButton = window->getSkinWidget ("Button"); mPinButton = window->getSkinWidget ("Button");
mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked);
} }
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName) void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender)
{ {
if ("PinToggle" == eventName) mPinned = !mPinned;
{
mPinned = !mPinned;
if (mPinned)
mPinButton->changeWidgetSkin ("PinDown");
else
mPinButton->changeWidgetSkin ("PinUp");
onPinToggled(); if (mPinned)
} mPinButton->changeWidgetSkin ("PinDown");
else
mPinButton->changeWidgetSkin ("PinUp");
eventDone(this); onPinToggled();
} }

@ -14,7 +14,7 @@ namespace MWGui
bool pinned() { return mPinned; } bool pinned() { return mPinned; }
private: private:
void onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName); void onPinButtonClicked(MyGUI::Widget* _sender);
protected: protected:
virtual void onPinToggled() = 0; virtual void onPinToggled() = 0;

@ -585,9 +585,7 @@
<Property key="Scale" value = "1 1 0 0"/> <Property key="Scale" value = "1 1 0 0"/>
</Child> </Child>
<Child type="Button" skin="PinUp" offset="232 4 19 19" align="ALIGN_RIGHT ALIGN_TOP" name="Button"> <Child type="Button" skin="PinUp" offset="232 4 19 19" align="ALIGN_RIGHT ALIGN_TOP" name="Button"/>
<Property key="Event" value="PinToggle"/>
</Child>
</Skin> </Skin>
<Skin name = "MW_Dialog" size = "256 54"> <Skin name = "MW_Dialog" size = "256 54">

Loading…
Cancel
Save