2012-04-01 20:36:57 +03:00
|
|
|
#include "window_pinnable_base.hpp"
|
2012-08-12 18:11:09 +02:00
|
|
|
|
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2012-04-01 20:36:57 +03:00
|
|
|
|
|
|
|
using namespace MWGui;
|
|
|
|
|
2012-08-12 18:11:09 +02:00
|
|
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager)
|
2012-04-01 23:51:49 +03:00
|
|
|
: WindowBase(parLayout, parWindowManager), mPinned(false), mVisible(false)
|
2012-04-01 20:36:57 +03:00
|
|
|
{
|
|
|
|
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
|
|
|
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WindowPinnableBase::setVisible(bool b)
|
|
|
|
{
|
|
|
|
// Pinned windows can not be hidden
|
2012-04-01 23:51:49 +03:00
|
|
|
if (mPinned && !b)
|
2012-04-01 20:36:57 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
WindowBase::setVisible(b);
|
2012-04-01 23:51:49 +03:00
|
|
|
mVisible = b;
|
2012-04-01 20:36:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
|
|
|
|
{
|
|
|
|
if ("PinToggle" == eventName)
|
|
|
|
{
|
2012-04-01 23:51:49 +03:00
|
|
|
mPinned = !mPinned;
|
2012-04-06 01:17:23 +03:00
|
|
|
onPinToggled();
|
2012-04-01 20:36:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
eventDone(this);
|
|
|
|
}
|