MyGUI 3.2.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_Window.h
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_WINDOW_H__
23 #define __MYGUI_WINDOW_H__
24
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_TextBox.h"
27 #include "MyGUI_EventPair.h"
28 #include "MyGUI_ControllerFadeAlpha.h"
29
30 namespace MyGUI
31 {
32
33 // OBSOLETE
34 typedef delegates::CMultiDelegate2<Widget*, const std::string&> EventHandle_WidgetString;
35
36 typedef delegates::CMultiDelegate2<Window*, const std::string&> EventHandle_WindowPtrCStringRef;
37 typedef delegates::CMultiDelegate1<Window*> EventHandle_WindowPtr;
38
39 class MYGUI_EXPORT Window :
40 public TextBox, // FIXME пока для кэпшена вместо виджета текст
41 public MemberObsolete<Window>
42 {
43 MYGUI_RTTI_DERIVED( Window )
44
45 public:
46 Window();
47
49 virtual void setVisible(bool _value);
50
52 void setVisibleSmooth(bool _value);
54 void destroySmooth();
55
57 void setAutoAlpha(bool _value);
59 bool getAutoAlpha() const;
60
62 virtual void setCaption(const UString& _value);
64 virtual const UString& getCaption();
65
67 TextBox* getCaptionWidget();
68
70 void setMinSize(const IntSize& _value);
72 void setMinSize(int _width, int _height);
74 IntSize getMinSize();
75
77 void setMaxSize(const IntSize& _value);
79 void setMaxSize(int _width, int _height);
81 IntSize getMaxSize();
82
84 virtual void setPosition(const IntPoint& _value);
86 virtual void setSize(const IntSize& _value);
88 virtual void setCoord(const IntCoord& _value);
89
91 void setPosition(int _left, int _top);
93 void setSize(int _width, int _height);
95 void setCoord(int _left, int _top, int _width, int _height);
96
98 void setSnap(bool _value);
100 bool getSnap() const;
101
103 const IntCoord& getActionScale() const;
104
106 void setMovable(bool _value);
108 bool getMovable() const;
109
110 /*events:*/
116 EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef>
117 eventWindowButtonPressed;
118
123 EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr>
124 eventWindowChangeCoord;
125
126 protected:
127 virtual void initialiseOverride();
128 virtual void shutdownOverride();
129
130 void onMouseChangeRootFocus(bool _focus);
131 void onKeyChangeRootFocus(bool _focus);
132 void onMouseDrag(int _left, int _top, MouseButton _id);
133 void onMouseButtonPressed(int _left, int _top, MouseButton _id);
134 void onMouseButtonReleased(int _left, int _top, MouseButton _id);
135
136 void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
137 void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
138 void notifyPressedButtonEvent(MyGUI::Widget* _sender);
139 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
140
141 // просто обновляет альфу взависимости от флагов
142 void updateAlpha();
143
144 void animateStop(Widget* _widget);
145
146 virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
147
148 private:
149 float getAlphaVisible() const;
150 void getSnappedCoord(IntCoord& _coord);
151 IntCoord _getActionScale(Widget* _widget);
152
153 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
154
155 private:
156 TextBox* mWidgetCaption;
157
158 // размеры окна перед началом его изменений
159 IntCoord mPreActionCoord;
160
161 // наши главные фокусы
162 bool mMouseRootFocus;
163 bool mKeyRootFocus;
164
165 // автоматическое или ручное управление альфой
166 bool mIsAutoAlpha;
167
168 // минимальные и максимальные размеры окна
169 IntRect mMinmax;
170
171 bool mSnap; // прилеплять ли к краям
172
173 IntCoord mCurrentActionScale;
174 bool mAnimateSmooth;
175
176 Widget* mClient;
177 bool mMovable;
178 };
179
180 } // namespace MyGUI
181
182 #endif // __MYGUI_WINDOW_H__
MyGUI::types::TCoord< int >
MyGUI::Widget
Definition: MyGUI_Widget.h:41
MyGUI::types::TPoint< int >
MyGUI_Prerequest.h
MyGUI::EventHandle_WindowPtrCStringRef
delegates::CMultiDelegate2< Window *, const std::string & > EventHandle_WindowPtrCStringRef
Definition: MyGUI_Window.h:36
MyGUI::types::TSize< int >
MyGUI::MouseButton
Definition: MyGUI_MouseButton.h:30
MyGUI::EventHandle_WindowPtr
delegates::CMultiDelegate1< Window * > EventHandle_WindowPtr
Definition: MyGUI_Window.h:37
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:88
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:120
MyGUI::types::TRect< int >
MyGUI::EventPair
Definition: MyGUI_EventPair.h:31
MyGUI_ControllerFadeAlpha.h
MyGUI::delegates::CMultiDelegate2
Definition: MyGUI_Delegate.h:239
MyGUI::EventHandle_WidgetString
delegates::CMultiDelegate2< Widget *, const std::string & > EventHandle_WidgetString
Definition: MyGUI_Window.h:34
MyGUI::ControllerFadeAlpha
Definition: MyGUI_ControllerFadeAlpha.h:33
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:169
MyGUI::TextBox
Definition: MyGUI_TextBox.h:31
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:28
MyGUI_EventPair.h
MyGUI::Window
Definition: MyGUI_Window.h:39
MyGUI::delegates::CMultiDelegate1
Definition: MyGUI_Delegate.h:239
MyGUI_TextBox.h