MyGUI 3.5.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
31 class MYGUI_EXPORT Window :
32 public TextBox, // FIXME: For now using text for caption instead of widget (Bug #190)
33 public MemberObsolete<Window>
34 {
35 MYGUI_RTTI_DERIVED(Window)
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
57 TextBox* getCaptionWidget() const;
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
80 using Widget::setPosition;
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);
123 void notifyPressedButtonEvent(MyGUI::Widget* _sender);
124 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
125 void notifyMouseWheel(MyGUI::Widget* _sender, int _rel);
126
127 // Update alpha based on focus and auto-alpha flags
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 FloatPoint getResizeAnchor() const;
144 void restoreResizeAnchor();
145
146 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
147
148 private:
149 TextBox* mWidgetCaption{nullptr};
150
151 // Window dimensions before starting move/resize operation
152 IntCoord mPreActionCoord;
153 FloatPoint mPreActionAnchor;
154
155 // Root focus states
156 bool mMouseRootFocus{false};
157 bool mKeyRootFocus{false};
158
159 // Automatic or manual alpha control
160 bool mIsAutoAlpha{false};
161
162 // Minimum and maximum window dimensions
163 IntRect mMinmax;
164
165 bool mSnap{false}; // Whether to snap to screen edges
166
167 IntCoord mCurrentActionScale;
168 bool mAnimateSmooth{false};
169
170 bool mMovable{true};
171 };
172
173} // namespace MyGUI
174
175#endif // MYGUI_WINDOW_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:67
types::TRect< int > IntRect
Definition MyGUI_Types.h:32
EventPairConvertStringView< delegates::MultiDelegate< Widget *, const std::string & >, delegates::MultiDelegate< Widget *, std::string_view > > EventHandle_WidgetString
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:26
types::TPoint< float > FloatPoint
Definition MyGUI_Types.h:27
EventPairConvertStringView< delegates::MultiDelegate< Window *, const std::string & >, delegates::MultiDelegate< Window *, std::string_view > > EventHandle_WindowPtrCStringRef
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:35
types::TSize< int > IntSize
Definition MyGUI_Types.h:29
delegates::MultiDelegate< Window * > EventHandle_WindowPtr