MyGUI  3.2.0
MyGUI_Button.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_BUTTON_H__
23 #define __MYGUI_BUTTON_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_TextBox.h"
27 
28 namespace MyGUI
29 {
30 
32  public TextBox,
33  public MemberObsolete<Button>
34  {
36 
37  public:
38  Button();
39 
41  void setStateSelected(bool _value);
43  bool getStateSelected() const;
44 
49  void setModeImage(bool _value);
51  bool getModeImage() const;
52 
53  void setImageResource(const std::string& _name);
54 
55  void setImageGroup(const std::string& _name);
56 
57  void setImageName(const std::string& _name);
58 
59  /*internal:*/
60  void _setMouseFocus(bool _focus);
61 
62  ImageBox* _getImageBox();
63 
64  protected:
65  virtual void initialiseOverride();
66  virtual void shutdownOverride();
67 
68  virtual void onMouseLostFocus(Widget* _new);
69  virtual void onMouseSetFocus(Widget* _old);
70  virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
71  virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
72 
73  virtual void baseUpdateEnable();
74 
75  bool _setState(const std::string& _value);
76 
77  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
78 
79  private:
80  void updateButtonState();
81 
82  private:
83  // нажата ли кнопка
84  bool mIsMousePressed;
85  // в фокусе ли кнопка
86  bool mIsMouseFocus;
87  // статус кнопки нажата или нет
88  bool mStateSelected;
89 
90  ImageBox* mImage;
91  bool mModeImage;
92  };
93 
94 } // namespace MyGUI
95 
96 #endif // __MYGUI_BUTTON_H__