MyGUI: MyGUI_Window.h Source File

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"
13#include "MyGUI_ControllerFadeAlpha.h"
14
15namespace MyGUI
16{
17
18 // OBSOLETE
19 using EventHandle_WidgetString = EventPairConvertStringView<
20 delegates::MultiDelegate<Widget*, const std::string&>,
21 delegates::MultiDelegate<Widget*, std::string_view>>;
22
23 using EventHandle_WindowPtrCStringRef = EventPairConvertStringView<
24 delegates::MultiDelegate<Window*, const std::string&>,
25 delegates::MultiDelegate<Window*, std::string_view>>;
26 using EventHandle_WindowPtr = delegates::MultiDelegate<Window*>;
27
31 class MYGUI_EXPORT Window :
32 public TextBox, // FIXME пока для кэпшена вместо виджета текст (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:*/
103 EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef> eventWindowButtonPressed;
104
109 EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr> eventWindowChangeCoord;
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 // просто обновляет альфу взависимости от флагов
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_
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:69
MyGUI_TextBox.h
MyGUI::ControllerFadeAlpha
Definition MyGUI_ControllerFadeAlpha.h:19
MyGUI::ControllerItem
Definition MyGUI_ControllerItem.h:26
MyGUI::EventPairConvertStringView
Definition MyGUI_EventPair.h:213
MyGUI::EventPair
Definition MyGUI_EventPair.h:99
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::TextBox
widget description should be here.
Definition MyGUI_TextBox.h:20
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::Widget::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_Widget.cpp:693
MyGUI::Widget::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_Widget.cpp:676
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_Widget.cpp:730
MyGUI::Window
widget description should be here.
Definition MyGUI_Window.h:34
MyGUI::Window::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_Window.cpp:228
MyGUI::Window::setVisibleSmooth
void setVisibleSmooth(bool _visible)
Definition MyGUI_Window.cpp:413
MyGUI::Window::onKeyChangeRootFocus
void onKeyChangeRootFocus(bool _focus) override
Definition MyGUI_Window.cpp:124
MyGUI::Window::setMovable
void setMovable(bool _value)
Definition MyGUI_Window.cpp:597
MyGUI::Window::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_Window.cpp:242
MyGUI::Window::setSnap
void setSnap(bool _value)
Definition MyGUI_Window.cpp:534
MyGUI::Window::eventWindowChangeCoord
EventPair< EventHandle_WidgetVoid, EventHandle_WindowPtr > eventWindowChangeCoord
Definition MyGUI_Window.h:109
MyGUI::Window::onMouseButtonReleased
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
Definition MyGUI_Window.cpp:147
MyGUI::Window::getMaxSize
IntSize getMaxSize() const
Definition MyGUI_Window.cpp:468
MyGUI::Window::setMinSize
void setMinSize(const IntSize &_value)
Definition MyGUI_Window.cpp:451
MyGUI::Window::notifyMousePressed
void notifyMousePressed(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_Window.cpp:154
MyGUI::Window::getCaption
const UString & getCaption() const override
Definition MyGUI_Window.cpp:331
MyGUI::Window::animateStop
void animateStop(Widget *_widget, ControllerItem *_controller)
Definition MyGUI_Window.cpp:345
MyGUI::Window::notifyPressedButtonEvent
void notifyPressedButtonEvent(MyGUI::Widget *_sender)
Definition MyGUI_Window.cpp:163
MyGUI::Window::onMouseButtonPressed
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
Definition MyGUI_Window.cpp:140
MyGUI::Window::getActionScale
const IntCoord & getActionScale() const
Definition MyGUI_Window.cpp:504
MyGUI::Window::setMaxSize
void setMaxSize(const IntSize &_value)
Definition MyGUI_Window.cpp:462
MyGUI::Window::onMouseChangeRootFocus
void onMouseChangeRootFocus(bool _focus) override
Definition MyGUI_Window.cpp:116
MyGUI::Window::notifyMouseReleased
void notifyMouseReleased(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_Window.cpp:539
MyGUI::Window::getCaptionWidget
TextBox * getCaptionWidget() const
Definition MyGUI_Window.cpp:514
MyGUI::Window::notifyMouseDrag
void notifyMouseDrag(MyGUI::Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_Window.cpp:168
MyGUI::Window::setVisible
void setVisible(bool _visible) override
Definition MyGUI_Window.cpp:354
MyGUI::Window::setAutoAlpha
void setAutoAlpha(bool _auto)
Definition MyGUI_Window.cpp:212
MyGUI::Window::updateAlpha
void updateAlpha()
Definition MyGUI_Window.cpp:195
MyGUI::Window::notifyMouseWheel
void notifyMouseWheel(MyGUI::Widget *_sender, int _rel)
Definition MyGUI_Window.cpp:607
MyGUI::Window::getSnap
bool getSnap() const
Definition MyGUI_Window.cpp:529
MyGUI::Window::onMouseDrag
void onMouseDrag(int _left, int _top, MouseButton _id) override
Definition MyGUI_Window.cpp:132
MyGUI::Window::getMovable
bool getMovable() const
Definition MyGUI_Window.cpp:602
MyGUI::Window::shutdownOverride
void shutdownOverride() override
Definition MyGUI_Window.cpp:109
MyGUI::Window::eventWindowButtonPressed
EventPair< EventHandle_WidgetString, EventHandle_WindowPtrCStringRef > eventWindowButtonPressed
Definition MyGUI_Window.h:103
MyGUI::Window::destroySmooth
void destroySmooth()
Definition MyGUI_Window.cpp:338
MyGUI::Window::setCaption
void setCaption(const UString &_caption) override
Definition MyGUI_Window.cpp:323
MyGUI::Window::initialiseOverride
void initialiseOverride() override
Definition MyGUI_Window.cpp:26
MyGUI::Window::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_Window.cpp:268
MyGUI::Window::getMinSize
IntSize getMinSize() const
Definition MyGUI_Window.cpp:457
MyGUI::Window::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_Window.cpp:473
MyGUI::Window::getAutoAlpha
bool getAutoAlpha() const
Definition MyGUI_Window.cpp:509
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:190
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntRect
types::TRect< int > IntRect
Definition MyGUI_Types.h:33
MyGUI::EventHandle_WidgetString
EventPairConvertStringView< delegates::MultiDelegate< Widget *, const std::string & >, delegates::MultiDelegate< Widget *, std::string_view > > EventHandle_WidgetString
Definition MyGUI_Window.h:19
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EventHandle_WindowPtrCStringRef
EventPairConvertStringView< delegates::MultiDelegate< Window *, const std::string & >, delegates::MultiDelegate< Window *, std::string_view > > EventHandle_WindowPtrCStringRef
Definition MyGUI_Window.h:23
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::EventHandle_WindowPtr
delegates::MultiDelegate< Window * > EventHandle_WindowPtr
Definition MyGUI_Window.h:26
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16