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