1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 07:19:54 +00:00
openmw-tes3mp/apps/openmw/mwgui/window_pinnable_base.cpp
Roman Melnik d09f0610ea Add basic windows pinning
Create WindowPinnableBase class for windows which should be
allowed to be pinned.

Add skin for pinnable windows - currently just a copy of normal
window with 1 extra button (hopefully this can be improved later).

Handle clicking on PinToggle button (pinning/unpinning a window).
2012-04-01 20:36:57 +03:00

31 lines
801 B
C++

#include "window_pinnable_base.hpp"
#include "window_manager.hpp"
using namespace MWGui;
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, WindowManager& parWindowManager)
: WindowBase(parLayout, parWindowManager), mIsPinned(false)
{
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
if (mIsPinned && !b)
return;
WindowBase::setVisible(b);
}
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
{
if ("PinToggle" == eventName)
{
mIsPinned = !mIsPinned;
}
eventDone(this);
}