mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 07:19:54 +00:00
d09f0610ea
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).
31 lines
801 B
C++
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);
|
|
}
|
|
|