00001 00002 /* 00003 * The aedButton class 00004 * This is the base class for all button widgets 00005 * Initial design by Eduardo B. Fonseca <ebf@aedsolucoes.com.br> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public 00018 * License along with this library; if not, write to the Free 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 #ifndef AEDBUTTON_H 00024 #define AEDBUTTON_H 00025 00026 #include "dllmacros.h" 00027 #include "aedWidget.h" 00028 #include "aedImage.h" 00029 #include "aedStaticText.h" 00030 00031 enum aedButtonType 00032 { 00033 ROUND, 00034 SQUARE, 00035 BUTTON_ARROW_UP, 00036 BUTTON_ARROW_DOWN, 00037 BUTTON_ARROW_LEFT, 00038 BUTTON_ARROW_RIGHT 00039 }; 00040 00043 class DLLEXPORT aedButton:public aedWidget 00044 { 00045 public: 00046 00050 aedButton(aedButtonType type = ROUND); 00051 virtual ~ aedButton(); 00052 virtual void render(void); 00053 virtual int wm_update(Uint32 msdelta); 00054 virtual int wm_lbuttondown(Uint16 x, Uint16 y); 00055 virtual int wm_lbuttonup(Uint16 x, Uint16 y); 00056 virtual int wm_keydown(aedKeyEvent & event); 00057 virtual int wm_mouseenter(); 00058 virtual int wm_mouseleave(); 00059 00061 void setCaption(const std::string & caption); 00062 00064 void setImage(aedImage image); 00065 00067 bool getButtonState(void) 00068 { 00069 return m_ButtonDown; 00070 } 00071 00073 void setButtonState(bool s); 00074 00076 void setButtonType(aedButtonType type) 00077 { 00078 m_ButtonType = type; 00079 } 00080 00082 void setToggleMode(bool mode); 00083 00085 void click(); 00086 00087 protected: 00088 bool m_ButtonDown; 00089 bool m_ToggleMode; 00090 aedButtonType m_ButtonType; 00091 aedImage *m_Image; 00092 aedStaticText m_Label; 00093 }; 00094 00095 #if defined(_MSC_VER) 00096 DLLEXTERN template DLLEXPORT aedFunctor1Arg < stub, aedButton >; 00097 #endif 00098 00099 #endif
1.4.7