]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/control.h
min size of an empty sizer should be (0, 0) and not (10, 10)
[wxWidgets.git] / include / wx / gtk / control.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
3// Purpose:
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling, Julian Smart
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef __GTKCONTROLH__
11#define __GTKCONTROLH__
12
13#include "wx/defs.h"
14#include "wx/object.h"
15#include "wx/list.h"
16#include "wx/window.h"
17
18//-----------------------------------------------------------------------------
19// classes
20//-----------------------------------------------------------------------------
21
22class WXDLLIMPEXP_CORE wxControl;
23
24typedef struct _GtkLabel GtkLabel;
25typedef struct _GtkFrame GtkFrame;
26
27//-----------------------------------------------------------------------------
28// wxControl
29//-----------------------------------------------------------------------------
30
31// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
32extern "C" {
33 typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
34 typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*);
35 typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
36}
37
38class WXDLLIMPEXP_CORE wxControl : public wxControlBase
39{
40public:
41 wxControl();
42 wxControl(wxWindow *parent, wxWindowID id,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize, long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxControlNameStr)
47 {
48 Create(parent, id, pos, size, style, validator, name);
49 }
50
51 bool Create(wxWindow *parent, wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize, long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxControlNameStr);
56
57 virtual void SetLabel( const wxString &label );
58 virtual wxString GetLabel() const;
59
60 virtual wxVisualAttributes GetDefaultAttributes() const;
61
62protected:
63 virtual wxSize DoGetBestSize() const;
64 void PostCreation(const wxSize& size);
65
66 // sets the label to the given string and also sets it for the given widget
67 void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
68
69 // GtkFrame helpers
70 GtkWidget* GTKCreateFrame(const wxString& label);
71 void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
72 void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc);
73 void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget);
74
75 // remove mnemonics ("&"s) from the label
76 static wxString GTKRemoveMnemonics(const wxString& label);
77
78 // converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
79 //
80 // for GTK+ 1 (which doesn't support mnemonics) this is the same as
81 // GTKRemoveMnemonics()
82 static wxString GTKConvertMnemonics(const wxString &label);
83
84 // These are used by GetDefaultAttributes
85 static wxVisualAttributes
86 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
87 bool useBase = false,
88 int state = -1);
89 static wxVisualAttributes
90 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
91 bool useBase = false,
92 int state = -1);
93 static wxVisualAttributes
94 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
95 bool useBase = false,
96 int state = -1);
97
98 static wxVisualAttributes
99 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
100 bool useBase = false,
101 int state = -1);
102
103 // Widgets that use the style->base colour for the BG colour should
104 // override this and return true.
105 virtual bool UseGTKStyleBase() const { return false; }
106
107 // this field contains the label in wx format, i.e. with "&" mnemonics
108 wxString m_label;
109
110private:
111 DECLARE_DYNAMIC_CLASS(wxControl)
112};
113
114#endif // __GTKCONTROLH__