MyGUI 3.4.3
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"
14
15namespace MyGUI
16{
17
18 // OBSOLETE
22
27
32 public TextBox, // FIXME пока для кэпшена вместо виджета текст (Bug #190)
33 public MemberObsolete<Window>
34 {
36
37 public:
39 void setVisible(bool _visible) override;
40
42 void setVisibleSmooth(bool _visible);
44 void destroySmooth();
45
47 void setAutoAlpha(bool _auto);
49 bool getAutoAlpha() const;
50
52 void setCaption(const UString& _caption) override;
54 const UString& getCaption() const override;
55
58
60 void setMinSize(const IntSize& _value);
62 void setMinSize(int _width, int _height);
64 IntSize getMinSize() const;
65
67 void setMaxSize(const IntSize& _value);
69 void setMaxSize(int _width, int _height);
71 IntSize getMaxSize() const;
72
74 void setPosition(const IntPoint& _point) override;
76 void setSize(const IntSize& _size) override;
78 void setCoord(const IntCoord& _coord) override;
79
81 using Widget::setSize;
82 using Widget::setCoord;
83
85 void setSnap(bool _value);
87 bool getSnap() const;
88
90 const IntCoord& getActionScale() const;
91
93 void setMovable(bool _value);
95 bool getMovable() const;
96
97 /*events:*/
104
110
111 protected:
112 void initialiseOverride() override;
113 void shutdownOverride() override;
114
115 void onMouseChangeRootFocus(bool _focus) override;
116 void onKeyChangeRootFocus(bool _focus) override;
117 void onMouseDrag(int _left, int _top, MouseButton _id) override;
118 void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
119 void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
120
121 void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
122 void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
124 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
125 void notifyMouseWheel(MyGUI::Widget* _sender, int _rel);
126
127 // просто обновляет альфу взависимости от флагов
128 void updateAlpha();
129
130 void animateStop(Widget* _widget, ControllerItem* _controller);
131
132 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
133
134 private:
135 float getAlphaVisible() const;
136 enum class Snap
137 {
138 Position,
139 Size
140 };
141 void getSnappedCoord(IntCoord& _coord, Snap snapMode) const;
142 IntCoord _getActionScale(Widget* _widget) const;
143
144 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
145
146 private:
147 TextBox* mWidgetCaption{nullptr};
148
149 // размеры окна перед началом его изменений
150 IntCoord mPreActionCoord;
151
152 // наши главные фокусы
153 bool mMouseRootFocus{false};
154 bool mKeyRootFocus{false};
155
156 // автоматическое или ручное управление альфой
157 bool mIsAutoAlpha{false};
158
159 // минимальные и максимальные размеры окна
160 IntRect mMinmax;
161
162 bool mSnap{false}; // прилеплять ли к краям
163
164 IntCoord mCurrentActionScale;
165 bool mAnimateSmooth{false};
166
167 bool mMovable{true};
168 };
169
170} // namespace MyGUI
171
172#endif // MYGUI_WINDOW_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
widget description should be here.
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
widget description should be here.
void setSize(const IntSize &_size) override
void setPosition(const IntPoint &_point) override
void setCoord(const IntCoord &_coord) override
widget description should be here.
void setPosition(const IntPoint &_point) override
void setVisibleSmooth(bool _visible)
void onKeyChangeRootFocus(bool _focus) override
void setMovable(bool _value)
void setSize(const IntSize &_size) override
void setSnap(bool _value)
EventPair< EventHandle_WidgetVoid, EventHandle_WindowPtr > eventWindowChangeCoord
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
IntSize getMaxSize() const
void setMinSize(const IntSize &_value)
void notifyMousePressed(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
const UString & getCaption() const override
void animateStop(Widget *_widget, ControllerItem *_controller)
void notifyPressedButtonEvent(MyGUI::Widget *_sender)
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
const IntCoord & getActionScale() const
void setMaxSize(const IntSize &_value)
void onMouseChangeRootFocus(bool _focus) override
void notifyMouseReleased(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
TextBox * getCaptionWidget() const
void notifyMouseDrag(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
void setVisible(bool _visible) override
void setAutoAlpha(bool _auto)
void notifyMouseWheel(MyGUI::Widget *_sender, int _rel)
bool getSnap() const
void onMouseDrag(int _left, int _top, MouseButton _id) override
bool getMovable() const
void shutdownOverride() override
EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef > eventWindowButtonPressed
void setCaption(const UString &_caption) override
void initialiseOverride() override
void setCoord(const IntCoord &_coord) override
IntSize getMinSize() const
void setPropertyOverride(std::string_view _key, std::string_view _value) override
bool getAutoAlpha() const
types::TRect< int > IntRect
Definition MyGUI_Types.h:33
EventPairConvertStringView< delegates::MultiDelegate< Window *, const std::string & >, delegates::MultiDelegate< Window *, std::string_view > > EventHandle_WindowPtrCStringRef
EventPairConvertStringView< delegates::MultiDelegate< Widget *, const std::string & >, delegates::MultiDelegate< Widget *, std::string_view > > EventHandle_WidgetString
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
delegates::MultiDelegate< Window * > EventHandle_WindowPtr