MyGUI: MyGUI_Window.h Source File

MyGUI 3.4.2

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

- File List
- Globals

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
15namespace 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 void setVisible(bool _value) override;
38
40 void setVisibleSmooth(bool _value);
42 void destroySmooth();
43
45 void setAutoAlpha(bool _value);
47 bool getAutoAlpha() const;
48
50 void setCaption(const UString& _value) override;
52 const UString& getCaption() const override;
53
55 TextBox* getCaptionWidget() const;
56
58 void setMinSize(const IntSize& _value);
60 void setMinSize(int _width, int _height);
62 IntSize getMinSize() const;
63
65 void setMaxSize(const IntSize& _value);
67 void setMaxSize(int _width, int _height);
69 IntSize getMaxSize() const;
70
72 void setPosition(const IntPoint& _value) override;
74 void setSize(const IntSize& _value) override;
76 void setCoord(const IntCoord& _value) override;
77
78 using Widget::setPosition;
79 using Widget::setSize;
80 using Widget::setCoord;
81
83 void setSnap(bool _value);
85 bool getSnap() const;
86
88 const IntCoord& getActionScale() const;
89
91 void setMovable(bool _value);
93 bool getMovable() const;
94
95 /*events:*/
101 EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef> eventWindowButtonPressed;
102
107 EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr> eventWindowChangeCoord;
108
109 protected:
110 void initialiseOverride() override;
111 void shutdownOverride() override;
112
113 void onMouseChangeRootFocus(bool _focus) override;
114 void onKeyChangeRootFocus(bool _focus) override;
115 void onMouseDrag(int _left, int _top, MouseButton _id) override;
116 void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
117 void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
118
119 void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
120 void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
121 void notifyPressedButtonEvent(MyGUI::Widget* _sender);
122 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
123 void notifyMouseWheel(MyGUI::Widget* _sender, int _rel);
124
125 // просто обновляет альфу взависимости от флагов
126 void updateAlpha();
127
128 void animateStop(Widget* _widget, ControllerItem* _controller);
129
130 void setPropertyOverride(const std::string& _key, const std::string& _value) override;
131
132 private:
133 float getAlphaVisible() const;
134 enum class Snap {Position, Size};
135 void getSnappedCoord(IntCoord& _coord, Snap snapMode) const;
136 IntCoord _getActionScale(Widget* _widget) const;
137
138 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
139
140 private:
141 TextBox* mWidgetCaption;
142
143 // размеры окна перед началом его изменений
144 IntCoord mPreActionCoord;
145
146 // наши главные фокусы
147 bool mMouseRootFocus;
148 bool mKeyRootFocus;
149
150 // автоматическое или ручное управление альфой
151 bool mIsAutoAlpha;
152
153 // минимальные и максимальные размеры окна
154 IntRect mMinmax;
155
156 bool mSnap; // прилеплять ли к краям
157
158 IntCoord mCurrentActionScale;
159 bool mAnimateSmooth;
160
161 bool mMovable;
162 };
163
164} // namespace MyGUI
165
166#endif // MYGUI_WINDOW_H_
MyGUI_ControllerFadeAlpha.h
MyGUI_EventPair.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:48
MyGUI_TextBox.h
MyGUI::ControllerFadeAlpha
Definition MyGUI_ControllerFadeAlpha.h:20
MyGUI::ControllerItem
Definition MyGUI_ControllerItem.h:27
MyGUI::EventPair
Definition MyGUI_EventPair.h:17
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::TextBox
widget description should be here.
Definition MyGUI_TextBox.h:21
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:145
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:37
MyGUI::Window
widget description should be here.
Definition MyGUI_Window.h:30
MyGUI::Window::eventWindowChangeCoord
EventPair< EventHandle_WidgetVoid, EventHandle_WindowPtr > eventWindowChangeCoord
Definition MyGUI_Window.h:107
MyGUI::Window::eventWindowButtonPressed
EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef > eventWindowButtonPressed
Definition MyGUI_Window.h:101
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:200
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EventHandle_WindowPtr
delegates::CMultiDelegate1< Window * > EventHandle_WindowPtr
Definition MyGUI_Window.h:22
MyGUI::EventHandle_WidgetString
delegates::CMultiDelegate2< Widget *, const std::string & > EventHandle_WidgetString
Definition MyGUI_Window.h:19
MyGUI::EventHandle_WindowPtrCStringRef
delegates::CMultiDelegate2< Window *, const std::string & > EventHandle_WindowPtrCStringRef
Definition MyGUI_Window.h:21
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16
MyGUI::types::TCoord< int >
MyGUI::types::TPoint< int >
MyGUI::types::TRect< int >
MyGUI::types::TSize< int >