]>
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 | ||
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); | |
23 | typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*); | |
24 | typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); | |
25 | } | |
26 | ||
20123d49 | 27 | class WXDLLIMPEXP_CORE wxControl : public wxControlBase |
c801d85f | 28 | { |
2a4f4a27 | 29 | public: |
8d99be5f | 30 | wxControl(); |
04165bec RR |
31 | wxControl(wxWindow *parent, wxWindowID id, |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 34 | const wxValidator& validator = wxDefaultValidator, |
04165bec RR |
35 | const wxString& name = wxControlNameStr) |
36 | { | |
674ac8b9 | 37 | Create(parent, id, pos, size, style, validator, name); |
04165bec | 38 | } |
8d772832 | 39 | |
04165bec RR |
40 | bool Create(wxWindow *parent, wxWindowID id, |
41 | const wxPoint& pos = wxDefaultPosition, | |
42 | const wxSize& size = wxDefaultSize, long style = 0, | |
04165bec | 43 | const wxValidator& validator = wxDefaultValidator, |
04165bec | 44 | const wxString& name = wxControlNameStr); |
2a4f4a27 | 45 | |
b2ff89d6 | 46 | |
9d522606 RD |
47 | virtual wxVisualAttributes GetDefaultAttributes() const; |
48 | ||
ef5c70f9 VZ |
49 | virtual void OnInternalIdle(); |
50 | ||
2a4f4a27 | 51 | protected: |
f68586e5 | 52 | virtual wxSize DoGetBestSize() const; |
abdeb9e7 RD |
53 | void PostCreation(const wxSize& size); |
54 | ||
b2ff89d6 VZ |
55 | // sets the label to the given string and also sets it for the given widget |
56 | void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); | |
39bc0347 | 57 | void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label); |
b2ff89d6 | 58 | |
2e1f5012 VZ |
59 | // GtkFrame helpers |
60 | GtkWidget* GTKCreateFrame(const wxString& label); | |
b2ff89d6 | 61 | void GTKSetLabelForFrame(GtkFrame *w, const wxString& label); |
2e1f5012 VZ |
62 | void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc); |
63 | void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget); | |
b2ff89d6 VZ |
64 | |
65 | // remove mnemonics ("&"s) from the label | |
66 | static wxString GTKRemoveMnemonics(const wxString& label); | |
67 | ||
68 | // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s | |
b2ff89d6 | 69 | static wxString GTKConvertMnemonics(const wxString &label); |
f68586e5 | 70 | |
39bc0347 VZ |
71 | // converts wx label to GTK+ labels preserving Pango markup |
72 | static wxString GTKConvertMnemonicsWithMarkup(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 | ||
ad60f9e7 JS |
97 | // Fix sensitivity due to bug in GTK+ < 2.14 |
98 | void GTKFixSensitivity(bool onlyIfUnderMouse = true); | |
99 | ||
738f9e5a RR |
100 | private: |
101 | DECLARE_DYNAMIC_CLASS(wxControl) | |
c801d85f KB |
102 | }; |
103 | ||
0416c418 | 104 | #endif // _WX_GTK_CONTROL_H_ |