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