]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
8ef94bfc | 2 | // Name: wx/gtk1/control.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
dbf858b5 | 5 | // Copyright: (c) 1998 Robert Roebling, Julian Smart |
65571936 | 6 | // Licence: wxWindows licence |
c801d85f KB |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
c801d85f KB |
9 | #ifndef __GTKCONTROLH__ |
10 | #define __GTKCONTROLH__ | |
11 | ||
c801d85f KB |
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 | ||
b5dbe15d | 21 | class WXDLLIMPEXP_FWD_CORE wxControl; |
c801d85f | 22 | |
b2ff89d6 VZ |
23 | typedef struct _GtkLabel GtkLabel; |
24 | typedef struct _GtkFrame GtkFrame; | |
25 | ||
c801d85f KB |
26 | //----------------------------------------------------------------------------- |
27 | // wxControl | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
865bb325 VZ |
30 | // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget |
31 | extern "C" { | |
32 | typedef GtkWidget* (*wxGtkWidgetNew_t)(void); | |
29e461a2 | 33 | typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*); |
865bb325 VZ |
34 | typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); |
35 | } | |
36 | ||
20123d49 | 37 | class WXDLLIMPEXP_CORE wxControl : public wxControlBase |
c801d85f | 38 | { |
2a4f4a27 | 39 | public: |
8d99be5f | 40 | wxControl(); |
04165bec RR |
41 | wxControl(wxWindow *parent, wxWindowID id, |
42 | const wxPoint& pos = wxDefaultPosition, | |
43 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 44 | const wxValidator& validator = wxDefaultValidator, |
04165bec RR |
45 | const wxString& name = wxControlNameStr) |
46 | { | |
674ac8b9 | 47 | Create(parent, id, pos, size, style, validator, name); |
04165bec | 48 | } |
8d772832 | 49 | |
04165bec RR |
50 | bool Create(wxWindow *parent, wxWindowID id, |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 53 | const wxValidator& validator = wxDefaultValidator, |
04165bec | 54 | const wxString& name = wxControlNameStr); |
2a4f4a27 | 55 | |
8d99be5f VZ |
56 | virtual void SetLabel( const wxString &label ); |
57 | virtual wxString GetLabel() const; | |
b2ff89d6 | 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 | ||
b2ff89d6 VZ |
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 | ||
9d522606 RD |
74 | // These are used by GetDefaultAttributes |
75 | static wxVisualAttributes | |
76 | GetDefaultAttributesFromGTKWidget(GtkWidget* widget, | |
77 | bool useBase = false, | |
78 | int state = -1); | |
79 | static wxVisualAttributes | |
865bb325 | 80 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, |
9d522606 RD |
81 | bool useBase = false, |
82 | int state = -1); | |
83 | static wxVisualAttributes | |
865bb325 | 84 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, |
9d522606 RD |
85 | bool useBase = false, |
86 | int state = -1); | |
87 | ||
88 | static wxVisualAttributes | |
865bb325 | 89 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, |
9d522606 RD |
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 | ||
b2ff89d6 VZ |
97 | // this field contains the label in wx format, i.e. with "&" mnemonics |
98 | wxString m_label; | |
8d772832 | 99 | |
738f9e5a RR |
100 | private: |
101 | DECLARE_DYNAMIC_CLASS(wxControl) | |
c801d85f KB |
102 | }; |
103 | ||
104 | #endif // __GTKCONTROLH__ |