added stock buttons support
[wxWidgets.git] / include / wx / gtk1 / button.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/button.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKBUTTONH__
11 #define __GTKBUTTONH__
12
13 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma interface
15 #endif
16
17 #include "wx/defs.h"
18 #include "wx/object.h"
19 #include "wx/list.h"
20 #include "wx/control.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxButton;
27
28 //-----------------------------------------------------------------------------
29 // global data
30 //-----------------------------------------------------------------------------
31
32 extern const wxChar *wxButtonNameStr;
33
34 //-----------------------------------------------------------------------------
35 // wxButton
36 //-----------------------------------------------------------------------------
37
38 class wxButton: public wxButtonBase
39 {
40 public:
41 wxButton();
42 wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize, long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxButtonNameStr)
47 {
48 Create(parent, id, label, pos, size, style, validator, name);
49 }
50
51 wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
52 const wxString& descriptiveLabel = wxEmptyString,
53 const wxPoint& pos = wxDefaultPosition,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxButtonNameStr)
57 {
58 Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
59 }
60
61 virtual ~wxButton();
62
63 bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize, long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxButtonNameStr);
68
69 bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
70 const wxString& descriptiveLabel = wxEmptyString,
71 const wxPoint& pos = wxDefaultPosition,
72 long style = 0,
73 const wxValidator& validator = wxDefaultValidator,
74 const wxString& name = wxButtonNameStr);
75
76 virtual void SetDefault();
77 virtual void SetLabel( const wxString &label );
78 virtual bool Enable( bool enable = TRUE );
79
80 // implementation
81 // --------------
82
83 void DoApplyWidgetStyle(GtkRcStyle *style);
84 bool IsOwnGtkWindow( GdkWindow *window );
85
86 // Since this wxButton doesn't derive from wxButtonBase (why?) we need
87 // to override this here too...
88 virtual bool ShouldInheritColours() const { return false; }
89
90 static wxVisualAttributes
91 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
92
93 protected:
94 virtual wxSize DoGetBestSize() const;
95
96 private:
97 DECLARE_DYNAMIC_CLASS(wxButton)
98 };
99
100 #endif // __GTKBUTTONH__