moved DoApplyWidgetStyle to wxWindowGTK
[wxWidgets.git] / include / wx / gtk / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKCONTROLH__
11 #define __GTKCONTROLH__
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/window.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxControl;
27
28 //-----------------------------------------------------------------------------
29 // wxControl
30 //-----------------------------------------------------------------------------
31
32 class wxControl : public wxControlBase
33 {
34 public:
35 wxControl();
36 wxControl(wxWindow *parent, wxWindowID id,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize, long style = 0,
39 const wxValidator& validator = wxDefaultValidator,
40 const wxString& name = wxControlNameStr)
41 {
42 Create(parent, id, pos, size, style, validator, name);
43 }
44
45 bool Create(wxWindow *parent, wxWindowID id,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize, long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxControlNameStr);
50
51 // this function will filter out '&' characters and will put the accelerator
52 // char (the one immediately after '&') into m_chAccel (TODO not yet)
53 virtual void SetLabel( const wxString &label );
54 virtual wxString GetLabel() const;
55
56 virtual wxVisualAttributes GetDefaultAttributes() const;
57
58 protected:
59 virtual wxSize DoGetBestSize() const;
60 void PostCreation(const wxSize& size);
61 void PostSetLabel();
62
63 #ifdef __WXGTK20__
64 wxString PrepareLabelMnemonics( const wxString &label ) const;
65 #endif
66
67 // These are used by GetDefaultAttributes
68 static wxVisualAttributes
69 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
70 bool useBase = false,
71 int state = -1);
72 static wxVisualAttributes
73 GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void),
74 bool useBase = false,
75 int state = -1);
76 static wxVisualAttributes
77 GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*),
78 bool useBase = false,
79 int state = -1);
80
81 static wxVisualAttributes
82 GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*),
83 bool useBase = false,
84 int state = -1);
85
86 // Widgets that use the style->base colour for the BG colour should
87 // override this and return true.
88 virtual bool UseGTKStyleBase() const { return false; }
89
90 wxString m_label;
91 char m_chAccel; // enabled to avoid breaking binary compatibility later on
92 bool m_createComplete;
93
94 private:
95 DECLARE_DYNAMIC_CLASS(wxControl)
96 };
97
98 #endif // __GTKCONTROLH__