1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/control.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_GTK_CONTROL_H_
10 #define _WX_GTK_CONTROL_H_
12 typedef struct _GtkLabel GtkLabel
;
13 typedef struct _GtkFrame GtkFrame
;
14 typedef struct _GtkEntry GtkEntry
;
16 //-----------------------------------------------------------------------------
18 //-----------------------------------------------------------------------------
20 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
22 typedef wxControlBase base_type
;
25 wxControl(wxWindow
*parent
, wxWindowID id
,
26 const wxPoint
& pos
= wxDefaultPosition
,
27 const wxSize
& size
= wxDefaultSize
, long style
= 0,
28 const wxValidator
& validator
= wxDefaultValidator
,
29 const wxString
& name
= wxControlNameStr
)
31 Create(parent
, id
, pos
, size
, style
, validator
, name
);
34 bool Create(wxWindow
*parent
, wxWindowID id
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
, long style
= 0,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxControlNameStr
);
40 virtual wxVisualAttributes
GetDefaultAttributes() const;
42 virtual bool SetFont(const wxFont
& font
);
46 virtual wxSize
DoGetBestSize() const;
47 void PostCreation(const wxSize
& size
);
49 // sets the label to the given string and also sets it for the given widget
50 void GTKSetLabelForLabel(GtkLabel
*w
, const wxString
& label
);
52 void GTKSetLabelWithMarkupForLabel(GtkLabel
*w
, const wxString
& label
);
53 #endif // wxUSE_MARKUP
56 GtkWidget
* GTKCreateFrame(const wxString
& label
);
57 void GTKSetLabelForFrame(GtkFrame
*w
, const wxString
& label
);
58 void GTKFrameApplyWidgetStyle(GtkFrame
* w
, GtkRcStyle
* rc
);
59 void GTKFrameSetMnemonicWidget(GtkFrame
* w
, GtkWidget
* widget
);
61 // remove mnemonics ("&"s) from the label
62 static wxString
GTKRemoveMnemonics(const wxString
& label
);
64 // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
65 static wxString
GTKConvertMnemonics(const wxString
&label
);
67 // converts wx label to GTK+ labels preserving Pango markup
68 static wxString
GTKConvertMnemonicsWithMarkup(const wxString
& label
);
70 // These are used by GetDefaultAttributes
71 static wxVisualAttributes
72 GetDefaultAttributesFromGTKWidget(GtkWidget
* widget
,
76 // Widgets that use the style->base colour for the BG colour should
77 // override this and return true.
78 virtual bool UseGTKStyleBase() const { return false; }
80 // Fix sensitivity due to bug in GTK+ < 2.14
81 void GTKFixSensitivity(bool onlyIfUnderMouse
= true);
83 // Ask GTK+ for preferred size. Use it after setting the font.
84 wxSize
GTKGetPreferredSize(GtkWidget
* widget
) const;
86 // Inner margins in a GtkEntry
87 wxPoint
GTKGetEntryMargins(GtkEntry
* entry
) const;
90 DECLARE_DYNAMIC_CLASS(wxControl
)
93 #endif // _WX_GTK_CONTROL_H_