]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: control.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
c801d85f KB |
10 | #ifndef __GTKCONTROLH__ |
11 | #define __GTKCONTROLH__ | |
12 | ||
c801d85f KB |
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 | ||
20123d49 | 22 | class WXDLLIMPEXP_CORE wxControl; |
c801d85f KB |
23 | |
24 | //----------------------------------------------------------------------------- | |
25 | // wxControl | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
865bb325 VZ |
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 | ||
20123d49 | 35 | class WXDLLIMPEXP_CORE wxControl : public wxControlBase |
c801d85f | 36 | { |
2a4f4a27 | 37 | public: |
8d99be5f | 38 | wxControl(); |
04165bec RR |
39 | wxControl(wxWindow *parent, wxWindowID id, |
40 | const wxPoint& pos = wxDefaultPosition, | |
41 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 42 | const wxValidator& validator = wxDefaultValidator, |
04165bec RR |
43 | const wxString& name = wxControlNameStr) |
44 | { | |
674ac8b9 | 45 | Create(parent, id, pos, size, style, validator, name); |
04165bec | 46 | } |
8d772832 | 47 | |
04165bec RR |
48 | bool Create(wxWindow *parent, wxWindowID id, |
49 | const wxPoint& pos = wxDefaultPosition, | |
50 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 51 | const wxValidator& validator = wxDefaultValidator, |
04165bec | 52 | const wxString& name = wxControlNameStr); |
2a4f4a27 | 53 | |
2a4f4a27 | 54 | // this function will filter out '&' characters and will put the accelerator |
8d99be5f VZ |
55 | // char (the one immediately after '&') into m_chAccel (TODO not yet) |
56 | virtual void SetLabel( const wxString &label ); | |
57 | virtual wxString GetLabel() const; | |
fe161a26 | 58 | |
9d522606 RD |
59 | virtual wxVisualAttributes GetDefaultAttributes() const; |
60 | ||
2a4f4a27 | 61 | protected: |
f68586e5 | 62 | virtual wxSize DoGetBestSize() const; |
abdeb9e7 RD |
63 | void PostCreation(const wxSize& size); |
64 | ||
eaafd2f8 VS |
65 | #ifdef __WXGTK20__ |
66 | wxString PrepareLabelMnemonics( const wxString &label ) const; | |
67 | #endif | |
f68586e5 | 68 | |
9d522606 RD |
69 | // These are used by GetDefaultAttributes |
70 | static wxVisualAttributes | |
71 | GetDefaultAttributesFromGTKWidget(GtkWidget* widget, | |
72 | bool useBase = false, | |
73 | int state = -1); | |
74 | static wxVisualAttributes | |
865bb325 | 75 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, |
9d522606 RD |
76 | bool useBase = false, |
77 | int state = -1); | |
78 | static wxVisualAttributes | |
865bb325 | 79 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, |
9d522606 RD |
80 | bool useBase = false, |
81 | int state = -1); | |
82 | ||
83 | static wxVisualAttributes | |
865bb325 | 84 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, |
9d522606 RD |
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 | ||
8d99be5f VZ |
92 | wxString m_label; |
93 | char m_chAccel; // enabled to avoid breaking binary compatibility later on | |
8d772832 | 94 | |
738f9e5a RR |
95 | private: |
96 | DECLARE_DYNAMIC_CLASS(wxControl) | |
c801d85f KB |
97 | }; |
98 | ||
99 | #endif // __GTKCONTROLH__ |