OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
box.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_WIDGETS_BOX_H
2 #define OPENMW_WIDGETS_BOX_H
3 
4 #include <MyGUI_Widget.h>
5 #include <MyGUI_TextBox.h>
6 #include <MyGUI_EditBox.h>
7 #include <MyGUI_Button.h>
8 
9 namespace Gui
10 {
11 
13  {
14  public:
15  AutoSizedWidget() : mExpandDirection(MyGUI::Align::Right) {}
16 
17  virtual MyGUI::IntSize getRequestedSize() = 0;
18 
19  protected:
20  void notifySizeChange(MyGUI::Widget* w);
21 
22  MyGUI::Align mExpandDirection;
23  };
24 
25  class AutoSizedTextBox : public AutoSizedWidget, public MyGUI::TextBox
26  {
27  MYGUI_RTTI_DERIVED( AutoSizedTextBox )
28 
29  public:
30  virtual MyGUI::IntSize getRequestedSize();
31  virtual void setCaption(const MyGUI::UString& _value);
32 
33  protected:
34  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
35  };
36 
37  class AutoSizedEditBox : public AutoSizedWidget, public MyGUI::EditBox
38  {
39  MYGUI_RTTI_DERIVED( AutoSizedEditBox )
40 
41  public:
42  virtual MyGUI::IntSize getRequestedSize();
43  virtual void setCaption(const MyGUI::UString& _value);
44 
45  protected:
46  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
47  };
48 
49  class AutoSizedButton : public AutoSizedWidget, public MyGUI::Button
50  {
51  MYGUI_RTTI_DERIVED( AutoSizedButton )
52 
53  public:
54  virtual MyGUI::IntSize getRequestedSize();
55  virtual void setCaption(const MyGUI::UString& _value);
56 
57  protected:
58  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
59  };
60 
65  class Box : public AutoSizedWidget
66  {
67  public:
68  Box();
69 
71 
72  protected:
73  virtual void align() = 0;
74 
75  virtual bool _setPropertyImpl(const std::string& _key, const std::string& _value);
76 
77  int mSpacing; // how much space to put between elements
78 
79  int mPadding; // outer padding
80 
81  bool mAutoResize; // auto resize the box so that it exactly fits all elements
82  };
83 
84  class HBox : public Box, public MyGUI::Widget
85  {
86  MYGUI_RTTI_DERIVED( HBox )
87 
88  public:
89  virtual void setSize (const MyGUI::IntSize &_value);
90  virtual void setCoord (const MyGUI::IntCoord &_value);
91 
92  protected:
93  virtual void align();
94  virtual MyGUI::IntSize getRequestedSize();
95 
96  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
97 
98  virtual void onWidgetCreated(MyGUI::Widget* _widget);
99  };
100 
101  class VBox : public Box, public MyGUI::Widget
102  {
103  MYGUI_RTTI_DERIVED( VBox)
104 
105  public:
106  virtual void setSize (const MyGUI::IntSize &_value);
107  virtual void setCoord (const MyGUI::IntCoord &_value);
108 
109  protected:
110  virtual void align();
111  virtual MyGUI::IntSize getRequestedSize();
112 
113  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
114 
115  virtual void onWidgetCreated(MyGUI::Widget* _widget);
116  };
117 
118 }
119 
120 #endif
A container widget that automatically sizes its children.
Definition: box.hpp:65
virtual void onWidgetCreated(MyGUI::Widget *_widget)
Definition: box.cpp:420
virtual MyGUI::IntSize getRequestedSize()
Definition: box.cpp:385
int mSpacing
Definition: box.hpp:77
virtual MyGUI::IntSize getRequestedSize()
Definition: box.cpp:244
Definition: box.hpp:12
virtual void setCaption(const MyGUI::UString &_value)
Definition: box.cpp:92
virtual void setCaption(const MyGUI::UString &_value)
Definition: box.cpp:62
virtual bool _setPropertyImpl(const std::string &_key, const std::string &_value)
Definition: box.cpp:124
virtual void setCoord(const MyGUI::IntCoord &_value)
Definition: box.cpp:379
virtual void onWidgetCreated(MyGUI::Widget *_widget)
Definition: box.cpp:239
virtual void setSize(const MyGUI::IntSize &_value)
Definition: box.cpp:227
Box()
Definition: box.cpp:111
Definition: box.hpp:84
virtual void setCoord(const MyGUI::IntCoord &_value)
Definition: box.cpp:233
virtual MyGUI::IntSize getRequestedSize()=0
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: box.cpp:367
Definition: box.hpp:49
void notifyChildrenSizeChanged()
Definition: box.cpp:119
bool mAutoResize
Definition: box.hpp:81
virtual void setCaption(const MyGUI::UString &_value)
Definition: box.cpp:36
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: box.cpp:221
Definition: box.hpp:25
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: box.cpp:69
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: box.cpp:99
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: box.cpp:43
virtual MyGUI::IntSize getRequestedSize()
Definition: box.cpp:82
int mPadding
Definition: box.hpp:79
void notifySizeChange(MyGUI::Widget *w)
Definition: box.cpp:6
virtual void setSize(const MyGUI::IntSize &_value)
Definition: box.cpp:373
Definition: box.hpp:101
MyGUI::Align mExpandDirection
Definition: box.hpp:22
virtual void align()
Definition: box.cpp:138
Definition: box.hpp:37
virtual MyGUI::IntSize getRequestedSize()
Definition: box.cpp:55
virtual void align()
Definition: box.cpp:282
virtual void align()=0
virtual MyGUI::IntSize getRequestedSize()
Definition: box.cpp:31
AutoSizedWidget()
Definition: box.hpp:15