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