• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_Button.h

Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009     
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014     
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019     
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
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 
00057         StaticImagePtr getStaticImage() { return mImage; }
00058 
00060         virtual void setProperty(const std::string& _key, const std::string& _value);
00061 
00062     /*internal:*/
00063         virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, WidgetPtr _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
00064 
00065         void _setMouseFocus(bool _focus);
00066 
00067     protected:
00068         virtual ~Button();
00069 
00070         virtual void baseChangeWidgetSkin(ResourceSkin* _info);
00071 
00072         virtual void onMouseLostFocus(WidgetPtr _new);
00073         virtual void onMouseSetFocus(WidgetPtr _old);
00074         virtual void onMouseButtonPressed(int _left, int _top, MouseButton _id);
00075         virtual void onMouseButtonReleased(int _left, int _top, MouseButton _id);
00076 
00077         virtual void baseUpdateEnable();
00078 
00079 
00080     private:
00081         void updateButtonState();
00082 
00083         void shutdownWidgetSkin();
00084         void initialiseWidgetSkin(ResourceSkin* _info);
00085 
00086     private:
00087         // нажата ли кнопка
00088         bool mIsMousePressed;
00089         // в фокусе ли кнопка
00090         bool mIsMouseFocus;
00091         // статус кнопки нажата или нет
00092         bool mIsStateCheck;
00093 
00094         StaticImagePtr mImage;
00095 
00096     };
00097 
00098 } // namespace MyGUI
00099 
00100 #endif // __MYGUI_BUTTON_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1