OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
windowbase.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_WINDOW_BASE_H
2 #define MWGUI_WINDOW_BASE_H
3 
4 #include "layout.hpp"
5 
6 namespace MWBase
7 {
8  class WindowManager;
9 }
10 
11 namespace MWWorld
12 {
13  class Ptr;
14 }
15 
16 namespace MWGui
17 {
18  class WindowManager;
19  class DragAndDrop;
20 
21  class WindowBase: public Layout
22  {
23  public:
24  WindowBase(const std::string& parLayout);
25 
26  virtual MyGUI::Widget* getDefaultKeyFocus() { return NULL; }
27 
28  // Events
29  typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
30 
32  virtual void setPtr(const MWWorld::Ptr& ptr) {}
33 
35  virtual void onFrame(float duration) {}
36 
38  virtual void onOpen() {}
40  virtual void onClose () {}
42  virtual bool exit() {return true;}
44  virtual void setVisible(bool visible);
46  bool isVisible();
47 
48  void center();
49 
51  virtual void clear() {}
52 
54  virtual void onResChange(int width, int height) {}
55  };
56 
57 
58  /*
59  * "Modal" windows cause the rest of the interface to be inaccessible while they are visible
60  */
61  class WindowModal : public WindowBase
62  {
63  public:
64  WindowModal(const std::string& parLayout);
65  virtual void onOpen() override;
66  virtual void onClose() override;
67  virtual bool exit() override {return true;}
68  };
69 
72  class NoDrop
73  {
74  public:
75  NoDrop(DragAndDrop* drag, MyGUI::Widget* widget);
76 
77  void onFrame(float dt);
78  virtual void setAlpha(float alpha);
79 
80  private:
81  MyGUI::Widget* mWidget;
84  };
85 }
86 
87 #endif
virtual void onFrame(float duration)
Called every frame if the window is in an active GUI mode.
Definition: windowbase.hpp:35
void onFrame(float dt)
Definition: windowbase.cpp:89
WindowBase(const std::string &parLayout)
Definition: windowbase.cpp:15
NoDrop(DragAndDrop *drag, MyGUI::Widget *widget)
Definition: windowbase.cpp:84
WindowModal(const std::string &parLayout)
Definition: windowbase.cpp:63
DragAndDrop * mDrag
Definition: windowbase.hpp:82
Definition: draganddrop.hpp:17
virtual void onResChange(int width, int height)
Called when GUI viewport changes size.
Definition: windowbase.hpp:54
virtual bool exit()
Gracefully exits the window.
Definition: windowbase.hpp:42
void center()
Definition: windowbase.cpp:49
Definition: windowbase.hpp:72
virtual void onClose() override
Notify that window has been hidden.
Definition: windowbase.cpp:77
virtual bool exit() override
Gracefully exits the window.
Definition: windowbase.hpp:67
virtual void onOpen()
Notify that window has been made visible.
Definition: windowbase.hpp:38
virtual void setVisible(bool visible)
Sets the visibility of the window.
Definition: windowbase.cpp:21
virtual void clear()
Clear any state specific to the running game.
Definition: windowbase.hpp:51
MyGUI::Widget * mWidget
Definition: windowbase.hpp:81
virtual void onOpen() override
Notify that window has been made visible.
Definition: windowbase.cpp:68
Definition: windowbase.hpp:21
Definition: layout.hpp:15
bool isVisible()
Returns the visibility state of the window.
Definition: windowbase.cpp:44
virtual void setPtr(const MWWorld::Ptr &ptr)
Open this object in the GUI, for windows that support it.
Definition: windowbase.hpp:32
MyGUI::delegates::CMultiDelegate1< WindowBase * > EventHandle_WindowBase
Definition: windowbase.hpp:29
bool mTransparent
Definition: windowbase.hpp:83
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
virtual void onClose()
Notify that window has been hidden.
Definition: windowbase.hpp:40
virtual void setAlpha(float alpha)
Definition: windowbase.cpp:120
virtual MyGUI::Widget * getDefaultKeyFocus()
Definition: windowbase.hpp:26
Definition: windowbase.hpp:61