MyGUI_Window.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_WINDOW_H_
#define MYGUI_WINDOW_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_TextBox.h"
#include "MyGUI_EventPair.h"
#include "MyGUI_ControllerFadeAlpha.h"
namespace MyGUI
{
// OBSOLETE
using EventHandle_WidgetString = EventPairConvertStringView<
delegates::MultiDelegate<Widget*, const std::string&>,
delegates::MultiDelegate<Widget*, std::string_view>>;
using EventHandle_WindowPtrCStringRef = EventPairConvertStringView<
delegates::MultiDelegate<Window*, const std::string&>,
delegates::MultiDelegate<Window*, std::string_view>>;
using EventHandle_WindowPtr = delegates::MultiDelegate<Window*>;
class MYGUI_EXPORT Window :
public TextBox, // FIXME пока для кэпшена вместо виджета текст (Bug #190)
public MemberObsolete<Window>
{
MYGUI_RTTI_DERIVED(Window)
public:
void setVisible(bool _visible) override;
void setVisibleSmooth(bool _visible);
void destroySmooth();
void setAutoAlpha(bool _auto);
bool getAutoAlpha() const;
void setCaption(const UString& _caption) override;
const UString& getCaption() const override;
TextBox* getCaptionWidget() const;
void setMinSize(const IntSize& _value);
void setMinSize(int _width, int _height);
IntSize getMinSize() const;
void setMaxSize(const IntSize& _value);
void setMaxSize(int _width, int _height);
IntSize getMaxSize() const;
void setPosition(const IntPoint& _point) override;
void setSize(const IntSize& _size) override;
void setCoord(const IntCoord& _coord) override;
using Widget::setPosition;
using Widget::setSize;
using Widget::setCoord;
void setSnap(bool _value);
bool getSnap() const;
const IntCoord& getActionScale() const;
void setMovable(bool _value);
bool getMovable() const;
/*events:*/
EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef> eventWindowButtonPressed;
EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr> eventWindowChangeCoord;
protected:
void initialiseOverride() override;
void shutdownOverride() override;
void onMouseChangeRootFocus(bool _focus) override;
void onKeyChangeRootFocus(bool _focus) override;
void onMouseDrag(int _left, int _top, MouseButton _id) override;
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
void notifyPressedButtonEvent(MyGUI::Widget* _sender);
void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseWheel(MyGUI::Widget* _sender, int _rel);
// просто обновляет альфу взависимости от флагов
void updateAlpha();
void animateStop(Widget* _widget, ControllerItem* _controller);
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
private:
float getAlphaVisible() const;
enum class Snap
{
Position,
Size
};
void getSnappedCoord(IntCoord& _coord, Snap snapMode) const;
IntCoord _getActionScale(Widget* _widget) const;
ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
private:
TextBox* mWidgetCaption{nullptr};
// размеры окна перед началом его изменений
IntCoord mPreActionCoord;
// наши главные фокусы
bool mMouseRootFocus{false};
bool mKeyRootFocus{false};
// автоматическое или ручное управление альфой
bool mIsAutoAlpha{false};
// минимальные и максимальные размеры окна
IntRect mMinmax;
bool mSnap{false}; // прилеплять ли к краям
IntCoord mCurrentActionScale;
bool mAnimateSmooth{false};
bool mMovable{true};
};
} // namespace MyGUI
#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::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EventHandle_WidgetString
EventPairConvertStringView< delegates::MultiDelegate< Widget *, const std::string & >, delegates::MultiDelegate< Widget *, std::string_view > > EventHandle_WidgetString
Definition MyGUI_Window.h:19
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::EventHandle_WindowPtrCStringRef
EventPairConvertStringView< delegates::MultiDelegate< Window *, const std::string & >, delegates::MultiDelegate< Window *, std::string_view > > EventHandle_WindowPtrCStringRef
Definition MyGUI_Window.h:23
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16