00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_BUTTON_H__
00024 #define __MYGUI_BUTTON_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_StaticText.h"
00028
00029 namespace MyGUI
00030 {
00031
00032 class MYGUI_EXPORT Button :
00033 public StaticText
00034 {
00035 MYGUI_RTTI_DERIVED( Button )
00036
00037 public:
00038 Button();
00039
00041 void setButtonPressed(bool _value) { setStateCheck(_value); }
00043 bool getButtonPressed() { return getStateCheck(); }
00044
00046 void setStateCheck(bool _value);
00047
00049 bool getStateCheck() { return mIsStateCheck; }
00050
00052 void setImageIndex(size_t _value);
00054 size_t getImageIndex();
00055
00060 void setModeImage(bool _value);
00062 bool getModeImage() { return mModeImage; }
00063
00065 StaticImage* getStaticImage() { return mImage; }
00066
00068 virtual void setProperty(const std::string& _key, const std::string& _value);
00069
00070
00071 virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
00072
00073 void _setMouseFocus(bool _focus);
00074
00075 protected:
00076 virtual ~Button();
00077
00078 virtual void baseChangeWidgetSkin(ResourceSkin* _info);
00079
00080 virtual void onMouseLostFocus(Widget* _new);
00081 virtual void onMouseSetFocus(Widget* _old);
00082 virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
00083 virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
00084
00085 virtual void baseUpdateEnable();
00086
00087 bool _setState(const std::string& _value);
00088 void setImageResource(const std::string& _name);
00089
00090 private:
00091 void updateButtonState();
00092
00093 void shutdownWidgetSkin();
00094 void initialiseWidgetSkin(ResourceSkin* _info);
00095
00096 private:
00097
00098 bool mIsMousePressed;
00099
00100 bool mIsMouseFocus;
00101
00102 bool mIsStateCheck;
00103
00104 StaticImage* mImage;
00105 bool mModeImage;
00106
00107 };
00108
00109 }
00110
00111 #endif // __MYGUI_BUTTON_H__