1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: wx/gtk/button.h 3 // Purpose: wxGTK wxButton class declaration 4 // Author: Robert Roebling 5 // Copyright: (c) 1998 Robert Roebling 6 // Licence: wxWindows licence 7 ///////////////////////////////////////////////////////////////////////////// 8 9 #ifndef _WX_GTK_BUTTON_H_ 10 #define _WX_GTK_BUTTON_H_ 11 12 //----------------------------------------------------------------------------- 13 // wxButton 14 //----------------------------------------------------------------------------- 15 16 class WXDLLIMPEXP_CORE wxButton : public wxButtonBase 17 { 18 public: wxButton()19 wxButton() {} 20 wxButton(wxWindow *parent, wxWindowID id, 21 const wxString& label = wxEmptyString, 22 const wxPoint& pos = wxDefaultPosition, 23 const wxSize& size = wxDefaultSize, long style = 0, 24 const wxValidator& validator = wxDefaultValidator, 25 const wxString& name = wxASCII_STR(wxButtonNameStr)) 26 { 27 Create(parent, id, label, pos, size, style, validator, name); 28 } 29 30 bool Create(wxWindow *parent, wxWindowID id, 31 const wxString& label = wxEmptyString, 32 const wxPoint& pos = wxDefaultPosition, 33 const wxSize& size = wxDefaultSize, long style = 0, 34 const wxValidator& validator = wxDefaultValidator, 35 const wxString& name = wxASCII_STR(wxButtonNameStr)); 36 37 virtual wxWindow *SetDefault() wxOVERRIDE; 38 virtual void SetLabel( const wxString &label ) wxOVERRIDE; 39 40 // implementation 41 // -------------- 42 43 static wxVisualAttributes 44 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); 45 46 // helper to allow access to protected member from GTK callback MoveWindow(int x,int y,int width,int height)47 void MoveWindow(int x, int y, int width, int height) { DoMoveWindow(x, y, width, height); } 48 49 // called from GTK callbacks: they update the button state and call 50 // GTKUpdateBitmap() 51 void GTKMouseEnters(); 52 void GTKMouseLeaves(); 53 void GTKPressed(); 54 void GTKReleased(); 55 56 protected: 57 virtual wxSize DoGetBestSize() const wxOVERRIDE; 58 virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; 59 60 #if wxUSE_MARKUP 61 virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; 62 #endif // wxUSE_MARKUP 63 64 private: 65 typedef wxButtonBase base_type; 66 67 // Return the GtkLabel used by this button. 68 GtkLabel *GTKGetLabel() const; 69 70 #ifndef __WXGTK3__ 71 // To mark if special GTK style for buttons with wxBU_EXACTFIT flag 72 // was already defined. 73 static bool m_exactFitStyleDefined; 74 #endif // !__WXGTK3__ 75 76 wxDECLARE_DYNAMIC_CLASS(wxButton); 77 }; 78 79 #endif // _WX_GTK_BUTTON_H_ 80