MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_BUTTON_H__ 00008 #define __MYGUI_BUTTON_H__ 00009 00010 #include "MyGUI_Prerequest.h" 00011 #include "MyGUI_TextBox.h" 00012 00013 namespace MyGUI 00014 { 00015 00019 class MYGUI_EXPORT Button : 00020 public TextBox, 00021 public MemberObsolete<Button> 00022 { 00023 MYGUI_RTTI_DERIVED( Button ) 00024 00025 public: 00026 Button(); 00027 00029 void setStateSelected(bool _value); 00031 bool getStateSelected() const; 00032 00037 void setModeImage(bool _value); 00039 bool getModeImage() const; 00040 00041 void setImageResource(const std::string& _name); 00042 00043 void setImageGroup(const std::string& _name); 00044 00045 void setImageName(const std::string& _name); 00046 00047 /*internal:*/ 00048 void _setMouseFocus(bool _focus); 00049 00050 ImageBox* _getImageBox(); 00051 00052 protected: 00053 virtual void initialiseOverride(); 00054 virtual void shutdownOverride(); 00055 00056 virtual void onMouseLostFocus(Widget* _new); 00057 virtual void onMouseSetFocus(Widget* _old); 00058 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id); 00059 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id); 00060 00061 virtual void baseUpdateEnable(); 00062 00063 bool _setState(const std::string& _value); 00064 00065 virtual void setPropertyOverride(const std::string& _key, const std::string& _value); 00066 00067 private: 00068 void updateButtonState(); 00069 00070 private: 00071 // нажата ли кнопка 00072 bool mIsMousePressed; 00073 // в фокусе ли кнопка 00074 bool mIsMouseFocus; 00075 // статус кнопки нажата или нет 00076 bool mStateSelected; 00077 00078 ImageBox* mImage; 00079 bool mModeImage; 00080 }; 00081 00082 } // namespace MyGUI 00083 00084 #endif // __MYGUI_BUTTON_H__