1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/control.h
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_CONTROL_H_
11 #define _WX_GTK_CONTROL_H_
13 typedef struct _GtkLabel GtkLabel
;
14 typedef struct _GtkFrame GtkFrame
;
15 typedef struct _GtkEntry GtkEntry
;
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
23 typedef wxControlBase base_type
;
26 wxControl(wxWindow
*parent
, wxWindowID id
,
27 const wxPoint
& pos
= wxDefaultPosition
,
28 const wxSize
& size
= wxDefaultSize
, long style
= 0,
29 const wxValidator
& validator
= wxDefaultValidator
,
30 const wxString
& name
= wxControlNameStr
)
32 Create(parent
, id
, pos
, size
, style
, validator
, name
);
35 bool Create(wxWindow
*parent
, wxWindowID id
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
, long style
= 0,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxControlNameStr
);
41 virtual wxVisualAttributes
GetDefaultAttributes() const;
43 virtual bool SetFont(const wxFont
& font
);
47 virtual wxSize
DoGetBestSize() const;
48 void PostCreation(const wxSize
& size
);
50 // sets the label to the given string and also sets it for the given widget
51 void GTKSetLabelForLabel(GtkLabel
*w
, const wxString
& label
);
53 void GTKSetLabelWithMarkupForLabel(GtkLabel
*w
, const wxString
& label
);
54 #endif // wxUSE_MARKUP
57 GtkWidget
* GTKCreateFrame(const wxString
& label
);
58 void GTKSetLabelForFrame(GtkFrame
*w
, const wxString
& label
);
59 void GTKFrameApplyWidgetStyle(GtkFrame
* w
, GtkRcStyle
* rc
);
60 void GTKFrameSetMnemonicWidget(GtkFrame
* w
, GtkWidget
* widget
);
62 // remove mnemonics ("&"s) from the label
63 static wxString
GTKRemoveMnemonics(const wxString
& label
);
65 // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
66 static wxString
GTKConvertMnemonics(const wxString
&label
);
68 // converts wx label to GTK+ labels preserving Pango markup
69 static wxString
GTKConvertMnemonicsWithMarkup(const wxString
& label
);
71 // These are used by GetDefaultAttributes
72 static wxVisualAttributes
73 GetDefaultAttributesFromGTKWidget(GtkWidget
* widget
,
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; }
81 // Fix sensitivity due to bug in GTK+ < 2.14
82 void GTKFixSensitivity(bool onlyIfUnderMouse
= true);
84 // Ask GTK+ for preferred size. Use it after setting the font.
85 wxSize
GTKGetPreferredSize(GtkWidget
* widget
) const;
87 // Inner margins in a GtkEntry
88 wxPoint
GTKGetEntryMargins(GtkEntry
* entry
) const;
91 DECLARE_DYNAMIC_CLASS(wxControl
)
94 #endif // _WX_GTK_CONTROL_H_