MyGUI_WidgetInput.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_WIDGET_INPUT_H_
#define MYGUI_WIDGET_INPUT_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Macros.h"
#include "MyGUI_WidgetDefines.h"
#include "MyGUI_WidgetToolTip.h"
#include "MyGUI_MouseButton.h"
#include "MyGUI_KeyCode.h"
#include "MyGUI_MaskPickInfo.h"
#include "MyGUI_Delegate.h"
#include "MyGUI_EventPair.h"
namespace MyGUI
{
// делегаты для событий виджета
using EventHandle_WidgetVoid = delegates::MultiDelegate<Widget*>;
using EventHandle_WidgetWidget = delegates::MultiDelegate<Widget*, Widget*>;
using EventHandle_WidgetBool = delegates::MultiDelegate<Widget*, bool>;
using EventHandle_WidgetInt = delegates::MultiDelegate<Widget*, int>;
using EventHandle_WidgetSizeT = delegates::MultiDelegate<Widget*, size_t>;
using EventHandle_WidgetIntInt = delegates::MultiDelegate<Widget*, int, int>;
using EventHandle_WidgetIntIntButton = delegates::MultiDelegate<Widget*, int, int, MouseButton>;
using EventHandle_WidgetKeyCode = delegates::MultiDelegate<Widget*, KeyCode>;
using EventHandle_WidgetKeyCodeChar = delegates::MultiDelegate<Widget*, KeyCode, Char>;
using EventHandle_WidgetToolTip = delegates::MultiDelegate<Widget*, const ToolTipInfo&>;
class MYGUI_EXPORT WidgetInput
{
public:
virtual ~WidgetInput() = default;
void setNeedToolTip(bool _value);
bool getNeedToolTip() const;
void setPointer(std::string_view _value);
const std::string& getPointer() const;
void setNeedKeyFocus(bool _value);
bool getNeedKeyFocus() const;
void setNeedMouseFocus(bool _value);
bool getNeedMouseFocus() const;
void setInheritsPick(bool _value);
bool getInheritsPick() const;
void setMaskPick(const std::string& _filename);
void setMaskPick(const MaskPickInfo& _info);
bool isMaskPickInside(const IntPoint& _point, const IntCoord& _coord) const;
bool getRootMouseFocus() const;
bool getRootKeyFocus() const;
EventHandle_WidgetWidget eventMouseLostFocus;
EventHandle_WidgetWidget eventMouseSetFocus;
EventPairAddParameter<EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton> eventMouseDrag;
EventHandle_WidgetIntInt eventMouseMove;
EventHandle_WidgetInt eventMouseWheel;
EventHandle_WidgetIntIntButton eventMouseButtonPressed;
EventHandle_WidgetIntIntButton eventMouseButtonReleased;
EventHandle_WidgetVoid eventMouseButtonClick;
EventHandle_WidgetVoid eventMouseButtonDoubleClick;
EventHandle_WidgetWidget eventKeyLostFocus;
EventHandle_WidgetWidget eventKeySetFocus;
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed;
EventHandle_WidgetKeyCode eventKeyButtonReleased;
EventHandle_WidgetBool eventRootMouseChangeFocus;
EventHandle_WidgetBool eventRootKeyChangeFocus;
EventHandle_WidgetToolTip eventToolTip;
/*internal:*/
void _riseMouseLostFocus(Widget* _new);
void _riseMouseSetFocus(Widget* _old);
void _riseMouseDrag(int _left, int _top, MouseButton _id);
void _riseMouseMove(int _left, int _top);
void _riseMouseWheel(int _rel);
void _riseMouseButtonPressed(int _left, int _top, MouseButton _id);
void _riseMouseButtonReleased(int _left, int _top, MouseButton _id);
void _riseMouseButtonClick();
void _riseMouseButtonDoubleClick();
void _riseKeyLostFocus(Widget* _new);
void _riseKeySetFocus(Widget* _old);
void _riseKeyButtonPressed(KeyCode _key, Char _char);
void _riseKeyButtonReleased(KeyCode _key);
void _riseMouseChangeRootFocus(bool _focus);
void _riseKeyChangeRootFocus(bool _focus);
void _setRootMouseFocus(bool _value);
void _setRootKeyFocus(bool _value);
protected:
virtual void onMouseLostFocus(Widget* _new);
virtual void onMouseSetFocus(Widget* _old);
virtual void onMouseDrag(int _left, int _top, MouseButton _id);
virtual void onMouseMove(int _left, int _top);
virtual void onMouseWheel(int _rel);
virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
virtual void onMouseButtonClick();
virtual void onMouseButtonDoubleClick();
virtual void onKeyLostFocus(Widget* _new);
virtual void onKeySetFocus(Widget* _old);
virtual void onKeyButtonPressed(KeyCode _key, Char _char);
virtual void onKeyButtonReleased(KeyCode _key);
virtual void onMouseChangeRootFocus(bool _focus);
virtual void onKeyChangeRootFocus(bool _focus);
private:
std::string mPointer;
MaskPickInfo mOwnMaskPickInfo;
bool mNeedToolTip{false};
bool mInheritsPick{false};
bool mNeedKeyFocus{false};
bool mNeedMouseFocus{true};
bool mRootMouseFocus{false};
bool mRootKeyFocus{false};
};
} // namespace MyGUI
#endif // MYGUI_WIDGET_INPUT_H_
MyGUI_Delegate.h
MyGUI_EventPair.h
MyGUI_KeyCode.h
MyGUI_Macros.h
MyGUI_MaskPickInfo.h
MyGUI_MouseButton.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_WidgetDefines.h
MyGUI_WidgetToolTip.h
MyGUI::EventPairAddParameter
Definition MyGUI_EventPair.h:176
MyGUI::MaskPickInfo
Definition MyGUI_MaskPickInfo.h:17
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::WidgetInput
Definition MyGUI_WidgetInput.h:60
MyGUI::WidgetInput::_riseMouseMove
void _riseMouseMove(int _left, int _top)
Definition MyGUI_WidgetInput.cpp:50
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition MyGUI_WidgetInput.h:174
MyGUI::WidgetInput::eventMouseButtonClick
EventHandle_WidgetVoid eventMouseButtonClick
Definition MyGUI_WidgetInput.h:168
MyGUI::WidgetInput::getRootKeyFocus
bool getRootKeyFocus() const
Definition MyGUI_WidgetInput.cpp:177
MyGUI::WidgetInput::_riseMouseButtonDoubleClick
void _riseMouseButtonDoubleClick()
Definition MyGUI_WidgetInput.cpp:80
MyGUI::WidgetInput::onMouseButtonDoubleClick
virtual void onMouseButtonDoubleClick()
Definition MyGUI_WidgetInput.cpp:224
MyGUI::WidgetInput::onKeyLostFocus
virtual void onKeyLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:228
MyGUI::WidgetInput::eventKeyLostFocus
EventHandle_WidgetWidget eventKeyLostFocus
Definition MyGUI_WidgetInput.h:181
MyGUI::WidgetInput::onMouseMove
virtual void onMouseMove(int _left, int _top)
Definition MyGUI_WidgetInput.cpp:204
MyGUI::WidgetInput::getInheritsPick
bool getInheritsPick() const
Definition MyGUI_WidgetInput.cpp:167
MyGUI::WidgetInput::eventMouseMove
EventHandle_WidgetIntInt eventMouseMove
Definition MyGUI_WidgetInput.h:137
MyGUI::WidgetInput::setNeedMouseFocus
void setNeedMouseFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:152
MyGUI::WidgetInput::onMouseDrag
virtual void onMouseDrag(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:200
MyGUI::WidgetInput::onMouseSetFocus
virtual void onMouseSetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:196
MyGUI::WidgetInput::setMaskPick
void setMaskPick(const std::string &_filename)
Definition MyGUI_WidgetInput.cpp:14
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition MyGUI_WidgetInput.h:162
MyGUI::WidgetInput::getPointer
const std::string & getPointer() const
Definition MyGUI_WidgetInput.cpp:137
MyGUI::WidgetInput::setNeedKeyFocus
void setNeedKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:142
MyGUI::WidgetInput::_riseKeyButtonReleased
void _riseKeyButtonReleased(KeyCode _key)
Definition MyGUI_WidgetInput.cpp:104
MyGUI::WidgetInput::_riseKeySetFocus
void _riseKeySetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:92
MyGUI::WidgetInput::getNeedToolTip
bool getNeedToolTip() const
Definition MyGUI_WidgetInput.cpp:127
MyGUI::WidgetInput::~WidgetInput
virtual ~WidgetInput()=default
MyGUI::WidgetInput::_riseKeyButtonPressed
void _riseKeyButtonPressed(KeyCode _key, Char _char)
Definition MyGUI_WidgetInput.cpp:98
MyGUI::WidgetInput::onMouseWheel
virtual void onMouseWheel(int _rel)
Definition MyGUI_WidgetInput.cpp:208
MyGUI::WidgetInput::getNeedMouseFocus
bool getNeedMouseFocus() const
Definition MyGUI_WidgetInput.cpp:157
MyGUI::WidgetInput::_riseMouseWheel
void _riseMouseWheel(int _rel)
Definition MyGUI_WidgetInput.cpp:56
MyGUI::WidgetInput::_riseMouseDrag
void _riseMouseDrag(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:44
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition MyGUI_WidgetInput.h:153
MyGUI::WidgetInput::eventMouseSetFocus
EventHandle_WidgetWidget eventMouseSetFocus
Definition MyGUI_WidgetInput.h:121
MyGUI::WidgetInput::eventToolTip
EventHandle_WidgetToolTip eventToolTip
Definition MyGUI_WidgetInput.h:226
MyGUI::WidgetInput::_riseMouseButtonReleased
void _riseMouseButtonReleased(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:68
MyGUI::WidgetInput::isMaskPickInside
bool isMaskPickInside(const IntPoint &_point, const IntCoord &_coord) const
Definition MyGUI_WidgetInput.cpp:27
MyGUI::WidgetInput::eventKeyButtonPressed
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed
Definition MyGUI_WidgetInput.h:196
MyGUI::WidgetInput::onMouseButtonPressed
virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:212
MyGUI::WidgetInput::setInheritsPick
void setInheritsPick(bool _value)
Definition MyGUI_WidgetInput.cpp:162
MyGUI::WidgetInput::_riseMouseSetFocus
void _riseMouseSetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:38
MyGUI::WidgetInput::onMouseLostFocus
virtual void onMouseLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:192
MyGUI::WidgetInput::_riseMouseButtonPressed
void _riseMouseButtonPressed(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:62
MyGUI::WidgetInput::setPointer
void setPointer(std::string_view _value)
Definition MyGUI_WidgetInput.cpp:132
MyGUI::WidgetInput::_riseMouseLostFocus
void _riseMouseLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:32
MyGUI::WidgetInput::setNeedToolTip
void setNeedToolTip(bool _value)
Definition MyGUI_WidgetInput.cpp:122
MyGUI::WidgetInput::eventMouseLostFocus
EventHandle_WidgetWidget eventMouseLostFocus
Definition MyGUI_WidgetInput.h:114
MyGUI::WidgetInput::onMouseButtonReleased
virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id)
Definition MyGUI_WidgetInput.cpp:216
MyGUI::WidgetInput::eventKeySetFocus
EventHandle_WidgetWidget eventKeySetFocus
Definition MyGUI_WidgetInput.h:188
MyGUI::WidgetInput::_riseKeyChangeRootFocus
void _riseKeyChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:116
MyGUI::WidgetInput::onKeySetFocus
virtual void onKeySetFocus(Widget *_old)
Definition MyGUI_WidgetInput.cpp:232
MyGUI::WidgetInput::onMouseChangeRootFocus
virtual void onMouseChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:244
MyGUI::WidgetInput::eventRootKeyChangeFocus
EventHandle_WidgetBool eventRootKeyChangeFocus
Definition MyGUI_WidgetInput.h:219
MyGUI::WidgetInput::getNeedKeyFocus
bool getNeedKeyFocus() const
Definition MyGUI_WidgetInput.cpp:147
MyGUI::WidgetInput::_riseKeyLostFocus
void _riseKeyLostFocus(Widget *_new)
Definition MyGUI_WidgetInput.cpp:86
MyGUI::WidgetInput::_setRootKeyFocus
void _setRootKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:187
MyGUI::WidgetInput::eventRootMouseChangeFocus
EventHandle_WidgetBool eventRootMouseChangeFocus
Definition MyGUI_WidgetInput.h:211
MyGUI::WidgetInput::onKeyButtonPressed
virtual void onKeyButtonPressed(KeyCode _key, Char _char)
Definition MyGUI_WidgetInput.cpp:236
MyGUI::WidgetInput::onMouseButtonClick
virtual void onMouseButtonClick()
Definition MyGUI_WidgetInput.cpp:220
MyGUI::WidgetInput::onKeyChangeRootFocus
virtual void onKeyChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:248
MyGUI::WidgetInput::eventMouseDrag
EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition MyGUI_WidgetInput.h:129
MyGUI::WidgetInput::_setRootMouseFocus
void _setRootMouseFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:182
MyGUI::WidgetInput::onKeyButtonReleased
virtual void onKeyButtonReleased(KeyCode _key)
Definition MyGUI_WidgetInput.cpp:240
MyGUI::WidgetInput::_riseMouseButtonClick
void _riseMouseButtonClick()
Definition MyGUI_WidgetInput.cpp:74
MyGUI::WidgetInput::_riseMouseChangeRootFocus
void _riseMouseChangeRootFocus(bool _focus)
Definition MyGUI_WidgetInput.cpp:110
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition MyGUI_WidgetInput.h:144
MyGUI::WidgetInput::getRootMouseFocus
bool getRootMouseFocus() const
Definition MyGUI_WidgetInput.cpp:172
MyGUI::WidgetInput::eventKeyButtonReleased
EventHandle_WidgetKeyCode eventKeyButtonReleased
Definition MyGUI_WidgetInput.h:203
MyGUI::delegates::MultiDelegate
Definition MyGUI_Delegate.h:190
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EventHandle_WidgetToolTip
delegates::MultiDelegate< Widget *, const ToolTipInfo & > EventHandle_WidgetToolTip
Definition MyGUI_WidgetInput.h:57
MyGUI::EventHandle_WidgetIntIntButton
delegates::MultiDelegate< Widget *, int, int, MouseButton > EventHandle_WidgetIntIntButton
Definition MyGUI_WidgetInput.h:54
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EventHandle_WidgetKeyCodeChar
delegates::MultiDelegate< Widget *, KeyCode, Char > EventHandle_WidgetKeyCodeChar
Definition MyGUI_WidgetInput.h:56
MyGUI::EventHandle_WidgetSizeT
delegates::MultiDelegate< Widget *, size_t > EventHandle_WidgetSizeT
Definition MyGUI_WidgetInput.h:52
MyGUI::EventHandle_WidgetBool
delegates::MultiDelegate< Widget *, bool > EventHandle_WidgetBool
Definition MyGUI_WidgetInput.h:50
MyGUI::EventHandle_WidgetWidget
delegates::MultiDelegate< Widget *, Widget * > EventHandle_WidgetWidget
Definition MyGUI_WidgetInput.h:49
MyGUI::EventHandle_WidgetVoid
delegates::MultiDelegate< Widget * > EventHandle_WidgetVoid
Definition MyGUI_WidgetInput.h:48
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::EventHandle_WidgetIntInt
delegates::MultiDelegate< Widget *, int, int > EventHandle_WidgetIntInt
Definition MyGUI_WidgetInput.h:53
MyGUI::EventHandle_WidgetKeyCode
delegates::MultiDelegate< Widget *, KeyCode > EventHandle_WidgetKeyCode
Definition MyGUI_WidgetInput.h:55
MyGUI::EventHandle_WidgetInt
delegates::MultiDelegate< Widget *, int > EventHandle_WidgetInt
Definition MyGUI_WidgetInput.h:51
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16