00001
00002
00003
00004
00005
00006
00007 #ifndef M_BUTTON_H
00008 #define M_BUTTON_H
00009
00010 namespace MWidgets
00011 {
00012
00014 class Button:public Widget
00015 {
00016 protected:
00017 bool m_bMouseHover;
00018 bool m_bFlat;
00019 HWND m_hWndTT;
00020 std::string m_sToolTip;
00021 protected:
00023 BaseEventHandler *m_pOnClickHandler;
00024
00025 protected:
00027 virtual LRESULT OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
00029 virtual void OnCommand( WORD code,WORD id );
00030 public:
00032 Button();
00034 ~Button();
00042 virtual void Create(Widget *parent,int x,int y,int w,int h,string caption,string tooltip="",bool bflat=false);
00046 template<class T>
00047 void SetOnClickHandler(T *pProcessor,void (T::*EventCallBack)(Widget* sender))
00048 {
00049 if(m_pOnClickHandler!=NULL)
00050 delete m_pOnClickHandler;
00051 m_pOnClickHandler=new EventHandler<T>(pProcessor,EventCallBack);
00052 };
00054 virtual void OnClick();
00057 void SetImage(Image* pImage);
00059 virtual WIDGET_TYPE GetType();
00062 void SetPressed(bool val);
00063 };
00064
00065 };
00066
00067 #endif