]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/gtk/control.h |
c801d85f KB |
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 | ||
0416c418 PC |
10 | #ifndef _WX_GTK_CONTROL_H_ |
11 | #define _WX_GTK_CONTROL_H_ | |
c801d85f | 12 | |
b2ff89d6 VZ |
13 | typedef struct _GtkLabel GtkLabel; |
14 | typedef struct _GtkFrame GtkFrame; | |
15 | ||
c801d85f KB |
16 | //----------------------------------------------------------------------------- |
17 | // wxControl | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
865bb325 VZ |
20 | // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget |
21 | extern "C" { | |
22 | typedef GtkWidget* (*wxGtkWidgetNew_t)(void); | |
29e461a2 | 23 | typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const char*); |
865bb325 VZ |
24 | typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); |
25 | } | |
26 | ||
20123d49 | 27 | class WXDLLIMPEXP_CORE wxControl : public wxControlBase |
c801d85f | 28 | { |
9dc44eff | 29 | typedef wxControlBase base_type; |
2a4f4a27 | 30 | public: |
8d99be5f | 31 | wxControl(); |
04165bec RR |
32 | wxControl(wxWindow *parent, wxWindowID id, |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 35 | const wxValidator& validator = wxDefaultValidator, |
04165bec RR |
36 | const wxString& name = wxControlNameStr) |
37 | { | |
674ac8b9 | 38 | Create(parent, id, pos, size, style, validator, name); |
04165bec | 39 | } |
8d772832 | 40 | |
04165bec RR |
41 | bool Create(wxWindow *parent, wxWindowID id, |
42 | const wxPoint& pos = wxDefaultPosition, | |
43 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 44 | const wxValidator& validator = wxDefaultValidator, |
04165bec | 45 | const wxString& name = wxControlNameStr); |
2a4f4a27 | 46 | |
9d522606 | 47 | virtual wxVisualAttributes GetDefaultAttributes() const; |
9dc44eff PC |
48 | #ifdef __WXGTK3__ |
49 | virtual bool SetFont(const wxFont& font); | |
50 | #endif | |
9d522606 | 51 | |
2a4f4a27 | 52 | protected: |
f68586e5 | 53 | virtual wxSize DoGetBestSize() const; |
abdeb9e7 RD |
54 | void PostCreation(const wxSize& size); |
55 | ||
b2ff89d6 VZ |
56 | // sets the label to the given string and also sets it for the given widget |
57 | void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); | |
f5bdfc69 | 58 | #if wxUSE_MARKUP |
39bc0347 | 59 | void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label); |
f5bdfc69 | 60 | #endif // wxUSE_MARKUP |
b2ff89d6 | 61 | |
2e1f5012 VZ |
62 | // GtkFrame helpers |
63 | GtkWidget* GTKCreateFrame(const wxString& label); | |
b2ff89d6 | 64 | void GTKSetLabelForFrame(GtkFrame *w, const wxString& label); |
2e1f5012 VZ |
65 | void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc); |
66 | void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget); | |
b2ff89d6 VZ |
67 | |
68 | // remove mnemonics ("&"s) from the label | |
69 | static wxString GTKRemoveMnemonics(const wxString& label); | |
70 | ||
71 | // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s | |
b2ff89d6 | 72 | static wxString GTKConvertMnemonics(const wxString &label); |
f68586e5 | 73 | |
39bc0347 VZ |
74 | // converts wx label to GTK+ labels preserving Pango markup |
75 | static wxString GTKConvertMnemonicsWithMarkup(const wxString& label); | |
76 | ||
9d522606 RD |
77 | // These are used by GetDefaultAttributes |
78 | static wxVisualAttributes | |
79 | GetDefaultAttributesFromGTKWidget(GtkWidget* widget, | |
80 | bool useBase = false, | |
fac46b97 | 81 | int state = 0); |
9d522606 | 82 | static wxVisualAttributes |
865bb325 | 83 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, |
9d522606 | 84 | bool useBase = false, |
fac46b97 | 85 | int state = 0); |
9d522606 | 86 | static wxVisualAttributes |
865bb325 | 87 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, |
9d522606 | 88 | bool useBase = false, |
fac46b97 | 89 | int state = 0); |
9d522606 RD |
90 | |
91 | static wxVisualAttributes | |
865bb325 | 92 | GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, |
9d522606 | 93 | bool useBase = false, |
fac46b97 | 94 | int state = 0); |
9d522606 RD |
95 | |
96 | // Widgets that use the style->base colour for the BG colour should | |
97 | // override this and return true. | |
98 | virtual bool UseGTKStyleBase() const { return false; } | |
99 | ||
ad60f9e7 JS |
100 | // Fix sensitivity due to bug in GTK+ < 2.14 |
101 | void GTKFixSensitivity(bool onlyIfUnderMouse = true); | |
102 | ||
738f9e5a RR |
103 | private: |
104 | DECLARE_DYNAMIC_CLASS(wxControl) | |
c801d85f KB |
105 | }; |
106 | ||
0416c418 | 107 | #endif // _WX_GTK_CONTROL_H_ |