]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/control.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / gtk1 / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/control.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef __GTKCONTROLH__
10 #define __GTKCONTROLH__
11
12 #include "wx/defs.h"
13 #include "wx/object.h"
14 #include "wx/list.h"
15 #include "wx/window.h"
16
17 //-----------------------------------------------------------------------------
18 // classes
19 //-----------------------------------------------------------------------------
20
21 class WXDLLIMPEXP_FWD_CORE wxControl;
22
23 typedef struct _GtkLabel GtkLabel;
24 typedef struct _GtkFrame GtkFrame;
25
26 //-----------------------------------------------------------------------------
27 // wxControl
28 //-----------------------------------------------------------------------------
29
30 // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
31 extern "C" {
32 typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
33 typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*);
34 typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
35 }
36
37 class WXDLLIMPEXP_CORE wxControl : public wxControlBase
38 {
39 public:
40 wxControl();
41 wxControl(wxWindow *parent, wxWindowID id,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize, long style = 0,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxControlNameStr)
46 {
47 Create(parent, id, pos, size, style, validator, name);
48 }
49
50 bool Create(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize, long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxControlNameStr);
55
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 // sets the label to the given string and also sets it for the given widget
66 void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
67
68 // as GTKSetLabelForLabel() but for a GtkFrame widget
69 void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
70
71 // remove mnemonics ("&"s) from the label
72 static wxString GTKRemoveMnemonics(const wxString& label);
73
74 // These are used by GetDefaultAttributes
75 static wxVisualAttributes
76 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
77 bool useBase = false,
78 int state = -1);
79 static wxVisualAttributes
80 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
81 bool useBase = false,
82 int state = -1);
83 static wxVisualAttributes
84 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
85 bool useBase = false,
86 int state = -1);
87
88 static wxVisualAttributes
89 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
90 bool useBase = false,
91 int state = -1);
92
93 // Widgets that use the style->base colour for the BG colour should
94 // override this and return true.
95 virtual bool UseGTKStyleBase() const { return false; }
96
97 // this field contains the label in wx format, i.e. with "&" mnemonics
98 wxString m_label;
99
100 private:
101 DECLARE_DYNAMIC_CLASS(wxControl)
102 };
103
104 #endif // __GTKCONTROLH__