MyGUI: MyGUI_Button.h Source File

MyGUI 3.4.3

MyGUI_Button.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_BUTTON_H_
8#define MYGUI_BUTTON_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_TextBox.h"
12
13namespace MyGUI
14{
15
19 class MYGUI_EXPORT Button : public TextBox, public MemberObsolete<Button>
20 {
21 MYGUI_RTTI_DERIVED(Button)
22
23 public:
25 void setStateSelected(bool _check);
27 bool getStateSelected() const;
28
33 void setModeImage(bool _value);
35 bool getModeImage() const;
36
37 void setImageResource(std::string_view _name);
38
39 void setImageGroup(std::string_view _name);
40
41 void setImageName(std::string_view _name);
42
43 /*internal:*/
44 void _setKeyFocus(bool _focus);
45 void _setMouseFocus(bool _focus);
46
47 ImageBox* _getImageBox() const;
48
49 protected:
50 void initialiseOverride() override;
51 void shutdownOverride() override;
52
53 void onKeyLostFocus(Widget* _new) override;
54 void onKeySetFocus(Widget* _old) override;
55 void onMouseLostFocus(Widget* _new) override;
56 void onMouseSetFocus(Widget* _old) override;
57 void onMouseButtonPressed(int _left, int _top, MouseButton _id) override;
58 void onMouseButtonReleased(int _left, int _top, MouseButton _id) override;
59
60 void baseUpdateEnable() override;
61
62 bool _setState(std::string_view _value);
63
64 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
65
66 private:
67 void updateButtonState();
68
69 private:
70 bool mIsMousePressed{false};
71 bool mIsKeyFocus{false};
72 bool mIsMouseFocus{false};
73 // is fixed in pressed position
74 bool mStateSelected{false};
75
76 ImageBox* mImage{nullptr};
77 bool mModeImage{false};
78 };
79
80} // namespace MyGUI
81
82#endif // MYGUI_BUTTON_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::Button
widget description should be here.
Definition MyGUI_Button.h:20
MyGUI::Button::onMouseSetFocus
void onMouseSetFocus(Widget *_old) override
Definition MyGUI_Button.cpp:45
MyGUI::Button::_setMouseFocus
void _setMouseFocus(bool _focus)
Definition MyGUI_Button.cpp:134
MyGUI::Button::_setState
bool _setState(std::string_view _value)
Definition MyGUI_Button.cpp:156
MyGUI::Button::onMouseButtonReleased
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
Definition MyGUI_Button.cpp:70
MyGUI::Button::onKeyLostFocus
void onKeyLostFocus(Widget *_new) override
Definition MyGUI_Button.cpp:38
MyGUI::Button::onMouseButtonPressed
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
Definition MyGUI_Button.cpp:59
MyGUI::Button::setImageName
void setImageName(std::string_view _name)
Definition MyGUI_Button.cpp:184
MyGUI::Button::onKeySetFocus
void onKeySetFocus(Widget *_old) override
Definition MyGUI_Button.cpp:31
MyGUI::Button::getStateSelected
bool getStateSelected() const
Get buton selected.
Definition MyGUI_Button.cpp:221
MyGUI::Button::getModeImage
bool getModeImage() const
Definition MyGUI_Button.cpp:226
MyGUI::Button::_getImageBox
ImageBox * _getImageBox() const
Definition MyGUI_Button.cpp:231
MyGUI::Button::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_Button.cpp:190
MyGUI::Button::shutdownOverride
void shutdownOverride() override
Definition MyGUI_Button.cpp:24
MyGUI::Button::baseUpdateEnable
void baseUpdateEnable() override
Definition MyGUI_Button.cpp:140
MyGUI::Button::setImageResource
void setImageResource(std::string_view _name)
Definition MyGUI_Button.cpp:170
MyGUI::Button::setStateSelected
void setStateSelected(bool _check)
Set button selected state.
Definition MyGUI_Button.cpp:119
MyGUI::Button::initialiseOverride
void initialiseOverride() override
Definition MyGUI_Button.cpp:16
MyGUI::Button::setModeImage
void setModeImage(bool _value)
Definition MyGUI_Button.cpp:150
MyGUI::Button::onMouseLostFocus
void onMouseLostFocus(Widget *_new) override
Definition MyGUI_Button.cpp:52
MyGUI::Button::setImageGroup
void setImageGroup(std::string_view _name)
Definition MyGUI_Button.cpp:177
MyGUI::Button::_setKeyFocus
void _setKeyFocus(bool _focus)
Definition MyGUI_Button.cpp:128
MyGUI::ImageBox
widget description should be here.
Definition MyGUI_ImageBox.h:22
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::TextBox
widget description should be here.
Definition MyGUI_TextBox.h:20
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16