2013-04-10 00:32:05 -04:00
|
|
|
#include "windowpinnablebase.hpp"
|
|
|
|
|
|
|
|
#include "exposedwindow.hpp"
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
namespace MWGui
|
2013-04-10 00:32:05 -04:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
|
2013-08-07 23:30:08 +02:00
|
|
|
: WindowBase(parLayout), mPinned(false)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-04-26 11:37:57 +04:00
|
|
|
Window* window = mMainWidget->castType<Window>();
|
2013-04-17 18:56:48 -04:00
|
|
|
mPinButton = window->getSkinWidget ("Button");
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2015-01-31 16:26:34 +01:00
|
|
|
mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2015-01-31 16:26:34 +01:00
|
|
|
void WindowPinnableBase::onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2015-01-31 16:26:34 +01:00
|
|
|
if (id != MyGUI::MouseButton::Left)
|
|
|
|
return;
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mPinned = !mPinned;
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
if (mPinned)
|
|
|
|
mPinButton->changeWidgetSkin ("PinDown");
|
|
|
|
else
|
|
|
|
mPinButton->changeWidgetSkin ("PinUp");
|
2013-04-10 00:32:05 -04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
onPinToggled();
|
|
|
|
}
|
2013-08-07 23:30:08 +02:00
|
|
|
|
2014-06-10 17:47:59 +02:00
|
|
|
void WindowPinnableBase::setPinned(bool pinned)
|
|
|
|
{
|
|
|
|
if (pinned != mPinned)
|
2015-01-31 16:26:34 +01:00
|
|
|
onPinButtonPressed(mPinButton, 0, 0, MyGUI::MouseButton::Left);
|
2014-06-10 17:47:59 +02:00
|
|
|
}
|
|
|
|
|
2013-08-07 23:30:08 +02:00
|
|
|
void WindowPinnableBase::setPinButtonVisible(bool visible)
|
|
|
|
{
|
|
|
|
mPinButton->setVisible(visible);
|
|
|
|
}
|
2013-04-10 00:32:05 -04:00
|
|
|
}
|