2012-04-01 17:36:57 +00:00
|
|
|
#include "window_pinnable_base.hpp"
|
2012-08-12 16:11:09 +00:00
|
|
|
|
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2012-04-01 17:36:57 +00:00
|
|
|
|
2013-02-17 01:56:07 +00:00
|
|
|
#include "exposedwindow.hpp"
|
|
|
|
|
2012-04-01 17:36:57 +00:00
|
|
|
using namespace MWGui;
|
|
|
|
|
2012-08-12 16:11:09 +00:00
|
|
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
2012-04-01 20:51:49 +00:00
|
|
|
: WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false)
|
2012-04-01 17:36:57 +00:00
|
|
|
{
|
|
|
|
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
|
|
|
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
|
2013-02-17 01:56:07 +00:00
|
|
|
|
|
|
|
ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget);
|
|
|
|
mPinButton = window->getSkinWidget ("Button");
|
2012-04-01 17:36:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
|
|
|
|
{
|
|
|
|
if ("PinToggle" == eventName)
|
|
|
|
{
|
2012-04-01 20:51:49 +00:00
|
|
|
mPinned = !mPinned;
|
2013-02-17 01:56:07 +00:00
|
|
|
|
|
|
|
if (mPinned)
|
|
|
|
mPinButton->changeWidgetSkin ("PinDown");
|
|
|
|
else
|
|
|
|
mPinButton->changeWidgetSkin ("PinUp");
|
|
|
|
|
2012-04-05 22:17:23 +00:00
|
|
|
onPinToggled();
|
2012-04-01 17:36:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
eventDone(this);
|
|
|
|
}
|