]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/control.h
Build fix after last commit.
[wxWidgets.git] / include / wx / gtk1 / 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 #include "wx/defs.h"
14 #include "wx/object.h"
15 #include "wx/list.h"
16 #include "wx/window.h"
17
18 //-----------------------------------------------------------------------------
19 // classes
20 //-----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_CORE wxControl;
23
24 //-----------------------------------------------------------------------------
25 // wxControl
26 //-----------------------------------------------------------------------------
27
28 // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
29 extern "C" {
30 typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
31 typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*);
32 typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
33 }
34
35 class WXDLLIMPEXP_CORE wxControl : public wxControlBase
36 {
37 public:
38 wxControl();
39 wxControl(wxWindow *parent, wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize, long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxControlNameStr)
44 {
45 Create(parent, id, pos, size, style, validator, name);
46 }
47
48 bool Create(wxWindow *parent, wxWindowID id,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize, long style = 0,
51 const wxValidator& validator = wxDefaultValidator,
52 const wxString& name = wxControlNameStr);
53
54 // this function will filter out '&' characters and will put the accelerator
55 // char (the one immediately after '&') into m_chAccel (TODO not yet)
56 virtual void SetLabel( const wxString &label );
57 virtual wxString GetLabel() const;
58
59 virtual wxVisualAttributes GetDefaultAttributes() const;
60
61 protected:
62 virtual wxSize DoGetBestSize() const;
63 void PostCreation(const wxSize& size);
64
65 #ifdef __WXGTK20__
66 wxString PrepareLabelMnemonics( const wxString &label ) const;
67 #endif
68
69 // These are used by GetDefaultAttributes
70 static wxVisualAttributes
71 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
72 bool useBase = false,
73 int state = -1);
74 static wxVisualAttributes
75 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
76 bool useBase = false,
77 int state = -1);
78 static wxVisualAttributes
79 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
80 bool useBase = false,
81 int state = -1);
82
83 static wxVisualAttributes
84 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
85 bool useBase = false,
86 int state = -1);
87
88 // Widgets that use the style->base colour for the BG colour should
89 // override this and return true.
90 virtual bool UseGTKStyleBase() const { return false; }
91
92 wxString m_label;
93 char m_chAccel; // enabled to avoid breaking binary compatibility later on
94
95 private:
96 DECLARE_DYNAMIC_CLASS(wxControl)
97 };
98
99 #endif // __GTKCONTROLH__