MyGUI: MyGUI_Window.h Source File

MyGUI 3.2.2

MyGUI_Window.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_WINDOW_H_
8 #define MYGUI_WINDOW_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_TextBox.h"
12 #include "MyGUI_EventPair.h"
13 #include "MyGUI_ControllerFadeAlpha.h"
14
15 namespace MyGUI
16 {
17
18 // OBSOLETE
19 typedef delegates::CMultiDelegate2<Widget*, const std::string&> EventHandle_WidgetString;
20
21 typedef delegates::CMultiDelegate2<Window*, const std::string&> EventHandle_WindowPtrCStringRef;
22 typedef delegates::CMultiDelegate1<Window*> EventHandle_WindowPtr;
23
27 class MYGUI_EXPORT Window :
28 public TextBox, // FIXME пока для кэпшена вместо виджета текст (Bug #190)
29 public MemberObsolete<Window>
30 {
31 MYGUI_RTTI_DERIVED( Window )
32
33 public:
34 Window();
35
37 virtual void setVisible(bool _value);
38
40 void setVisibleSmooth(bool _value);
42 void destroySmooth();
43
45 void setAutoAlpha(bool _value);
47 bool getAutoAlpha() const;
48
50 virtual void setCaption(const UString& _value);
52 virtual const UString& getCaption();
53
55 TextBox* getCaptionWidget();
56
58 void setMinSize(const IntSize& _value);
60 void setMinSize(int _width, int _height);
62 IntSize getMinSize();
63
65 void setMaxSize(const IntSize& _value);
67 void setMaxSize(int _width, int _height);
69 IntSize getMaxSize();
70
72 virtual void setPosition(const IntPoint& _value);
74 virtual void setSize(const IntSize& _value);
76 virtual void setCoord(const IntCoord& _value);
77
79 void setPosition(int _left, int _top);
81 void setSize(int _width, int _height);
83 void setCoord(int _left, int _top, int _width, int _height);
84
86 void setSnap(bool _value);
88 bool getSnap() const;
89
91 const IntCoord& getActionScale() const;
92
94 void setMovable(bool _value);
96 bool getMovable() const;
97
98 /*events:*/
104 EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef> eventWindowButtonPressed;
105
110 EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr> eventWindowChangeCoord;
111
112 protected:
113 virtual void initialiseOverride();
114 virtual void shutdownOverride();
115
116 void onMouseChangeRootFocus(bool _focus);
117 void onKeyChangeRootFocus(bool _focus);
118 void onMouseDrag(int _left, int _top, MouseButton _id);
119 void onMouseButtonPressed(int _left, int _top, MouseButton _id);
120 void onMouseButtonReleased(int _left, int _top, MouseButton _id);
121
122 void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
123 void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
124 void notifyPressedButtonEvent(MyGUI::Widget* _sender);
125 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
126 void notifyMouseWheel(MyGUI::Widget* _sender, int _rel);
127
128 // просто обновляет альфу взависимости от флагов
129 void updateAlpha();
130
131 void animateStop(Widget* _widget, ControllerItem* _controller);
132
133 virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
134
135 private:
136 float getAlphaVisible() const;
137 void getSnappedCoord(IntCoord& _coord);
138 IntCoord _getActionScale(Widget* _widget);
139
140 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
141
142 private:
143 TextBox* mWidgetCaption;
144
145 // размеры окна перед началом его изменений
146 IntCoord mPreActionCoord;
147
148 // наши главные фокусы
149 bool mMouseRootFocus;
150 bool mKeyRootFocus;
151
152 // автоматическое или ручное управление альфой
153 bool mIsAutoAlpha;
154
155 // минимальные и максимальные размеры окна
156 IntRect mMinmax;
157
158 bool mSnap; // прилеплять ли к краям
159
160 IntCoord mCurrentActionScale;
161 bool mAnimateSmooth;
162
163 Widget* mClient;
164 bool mMovable;
165 };
166
167 } // namespace MyGUI
168
169 #endif // MYGUI_WINDOW_H_
MyGUI::EventHandle_WindowPtrCStringRef
delegates::CMultiDelegate2< Window *, const std::string & > EventHandle_WindowPtrCStringRef
Definition: MyGUI_Window.h:21
MyGUI_EventPair.h
MyGUI::types::TRect< int >
MyGUI::Window
Window properties. Skin childs. Window widget description should be here.
Definition: MyGUI_Window.h:27
MyGUI::Widget
Widget properties. Skin childs. Widget widget description should be here.
Definition: MyGUI_Widget.h:29
MyGUI::types::TPoint< int >
MyGUI::ControllerItem
Definition: MyGUI_ControllerItem.h:25
MyGUI::EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef >
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:15
MyGUI::EventHandle_WidgetString
delegates::CMultiDelegate2< Widget *, const std::string & > EventHandle_WidgetString
Definition: MyGUI_Window.h:19
MyGUI_Prerequest.h
MyGUI::TextBox
TextBox properties. Skin childs. TextBox widget description should be here.
Definition: MyGUI_TextBox.h:19
MyGUI_ControllerFadeAlpha.h
MyGUI::Window::eventWindowButtonPressed
EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef > eventWindowButtonPressed
Definition: MyGUI_Window.h:104
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::types::TSize< int >
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::Window::eventWindowChangeCoord
EventPair< EventHandle_WidgetVoid, EventHandle_WindowPtr > eventWindowChangeCoord
Definition: MyGUI_Window.h:110
MyGUI::EventHandle_WindowPtr
delegates::CMultiDelegate1< Window * > EventHandle_WindowPtr
Definition: MyGUI_Window.h:22
MyGUI::ControllerFadeAlpha
Definition: MyGUI_ControllerFadeAlpha.h:18
MyGUI::types::TCoord< int >
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI_TextBox.h