2013-04-10 04:32:05 +00:00
|
|
|
#ifndef MWGUI_WINDOW_BASE_H
|
|
|
|
#define MWGUI_WINDOW_BASE_H
|
|
|
|
|
2015-05-01 00:09:57 +00:00
|
|
|
#include "layout.hpp"
|
2013-04-10 04:32:05 +00:00
|
|
|
|
2017-09-22 19:26:41 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2014-01-26 13:47:01 +00:00
|
|
|
class DragAndDrop;
|
2013-04-10 04:32:05 +00:00
|
|
|
|
2015-05-01 00:09:57 +00:00
|
|
|
class WindowBase: public Layout
|
2013-04-10 04:32:05 +00:00
|
|
|
{
|
2019-04-26 07:37:57 +00:00
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
WindowBase(const std::string& parLayout);
|
2013-04-10 04:32:05 +00:00
|
|
|
|
2018-10-09 06:21:12 +00:00
|
|
|
virtual MyGUI::Widget* getDefaultKeyFocus() { return nullptr; }
|
2017-09-26 20:21:30 +00:00
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
// Events
|
|
|
|
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
|
|
|
|
|
2017-09-22 19:26:41 +00:00
|
|
|
/// Open this object in the GUI, for windows that support it
|
|
|
|
virtual void setPtr(const MWWorld::Ptr& ptr) {}
|
|
|
|
|
2017-09-23 20:00:15 +00:00
|
|
|
/// Called every frame if the window is in an active GUI mode
|
|
|
|
virtual void onFrame(float duration) {}
|
|
|
|
|
2015-07-15 17:10:09 +00:00
|
|
|
/// Notify that window has been made visible
|
2017-09-22 15:10:53 +00:00
|
|
|
virtual void onOpen() {}
|
2015-07-15 17:10:09 +00:00
|
|
|
/// Notify that window has been hidden
|
2017-09-22 15:10:53 +00:00
|
|
|
virtual void onClose () {}
|
2015-07-15 17:10:09 +00:00
|
|
|
/// Gracefully exits the window
|
2017-09-23 10:18:39 +00:00
|
|
|
virtual bool exit() {return true;}
|
2015-07-15 17:10:09 +00:00
|
|
|
/// Sets the visibility of the window
|
2020-10-16 18:18:54 +00:00
|
|
|
void setVisible(bool visible) override;
|
2015-07-15 17:10:09 +00:00
|
|
|
/// Returns the visibility state of the window
|
|
|
|
bool isVisible();
|
2017-09-23 20:07:30 +00:00
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
void center();
|
2017-09-23 20:07:30 +00:00
|
|
|
|
2017-09-23 20:16:56 +00:00
|
|
|
/// Clear any state specific to the running game
|
|
|
|
virtual void clear() {}
|
|
|
|
|
2017-09-23 20:07:30 +00:00
|
|
|
/// Called when GUI viewport changes size
|
|
|
|
virtual void onResChange(int width, int height) {}
|
2013-04-10 04:32:05 +00:00
|
|
|
|
2019-04-26 07:37:57 +00:00
|
|
|
protected:
|
|
|
|
virtual void onTitleDoubleClicked();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onDoubleClick(MyGUI::Widget* _sender);
|
|
|
|
};
|
2013-04-10 04:32:05 +00:00
|
|
|
|
|
|
|
/*
|
2018-07-02 00:17:50 +00:00
|
|
|
* "Modal" windows cause the rest of the interface to be inaccessible while they are visible
|
2013-04-10 04:32:05 +00:00
|
|
|
*/
|
|
|
|
class WindowModal : public WindowBase
|
|
|
|
{
|
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
WindowModal(const std::string& parLayout);
|
2020-10-16 18:18:54 +00:00
|
|
|
void onOpen() override;
|
|
|
|
void onClose() override;
|
|
|
|
bool exit() override {return true;}
|
2013-04-10 04:32:05 +00:00
|
|
|
};
|
2014-01-26 13:47:01 +00:00
|
|
|
|
|
|
|
/// A window that cannot be the target of a drag&drop action.
|
|
|
|
/// When hovered with a drag item, the window will become transparent and allow click-through.
|
|
|
|
class NoDrop
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NoDrop(DragAndDrop* drag, MyGUI::Widget* widget);
|
|
|
|
|
|
|
|
void onFrame(float dt);
|
2014-09-13 05:59:29 +00:00
|
|
|
virtual void setAlpha(float alpha);
|
2020-03-26 08:07:32 +00:00
|
|
|
virtual ~NoDrop() = default;
|
2014-01-26 13:47:01 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
MyGUI::Widget* mWidget;
|
|
|
|
DragAndDrop* mDrag;
|
|
|
|
bool mTransparent;
|
|
|
|
};
|
2019-04-01 17:47:12 +00:00
|
|
|
|
|
|
|
class BookWindowBase : public WindowBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BookWindowBase(const std::string& parLayout);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float adjustButton (char const * name);
|
|
|
|
};
|
2013-04-10 04:32:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|