1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/control.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef __GTKCONTROLH__
10 #define __GTKCONTROLH__
13 #include "wx/object.h"
15 #include "wx/window.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class WXDLLIMPEXP_FWD_CORE wxControl
;
23 typedef struct _GtkLabel GtkLabel
;
24 typedef struct _GtkFrame GtkFrame
;
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
32 typedef GtkWidget
* (*wxGtkWidgetNew_t
)(void);
33 typedef GtkWidget
* (*wxGtkWidgetNewFromStr_t
)(const char*);
34 typedef GtkWidget
* (*wxGtkWidgetNewFromAdj_t
)(GtkAdjustment
*);
37 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
41 wxControl(wxWindow
*parent
, wxWindowID id
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
, long style
= 0,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxControlNameStr
)
47 Create(parent
, id
, pos
, size
, style
, validator
, name
);
50 bool Create(wxWindow
*parent
, wxWindowID id
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
, long style
= 0,
53 const wxValidator
& validator
= wxDefaultValidator
,
54 const wxString
& name
= wxControlNameStr
);
56 virtual void SetLabel( const wxString
&label
);
57 virtual wxString
GetLabel() const;
59 virtual wxVisualAttributes
GetDefaultAttributes() const;
62 virtual wxSize
DoGetBestSize() const;
63 void PostCreation(const wxSize
& size
);
65 // sets the label to the given string and also sets it for the given widget
66 void GTKSetLabelForLabel(GtkLabel
*w
, const wxString
& label
);
68 // as GTKSetLabelForLabel() but for a GtkFrame widget
69 void GTKSetLabelForFrame(GtkFrame
*w
, const wxString
& label
);
71 // remove mnemonics ("&"s) from the label
72 static wxString
GTKRemoveMnemonics(const wxString
& label
);
74 // These are used by GetDefaultAttributes
75 static wxVisualAttributes
76 GetDefaultAttributesFromGTKWidget(GtkWidget
* widget
,
79 static wxVisualAttributes
80 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t
,
83 static wxVisualAttributes
84 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t
,
88 static wxVisualAttributes
89 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t
,
93 // Widgets that use the style->base colour for the BG colour should
94 // override this and return true.
95 virtual bool UseGTKStyleBase() const { return false; }
97 // this field contains the label in wx format, i.e. with "&" mnemonics
101 DECLARE_DYNAMIC_CLASS(wxControl
)
104 #endif // __GTKCONTROLH__