1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKCONTROLH__
11 #define __GTKCONTROLH__
13 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
18 #include "wx/object.h"
20 #include "wx/window.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxControl
;
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
34 typedef GtkWidget
* (*wxGtkWidgetNew_t
)(void);
35 typedef GtkWidget
* (*wxGtkWidgetNewFromStr_t
)(const gchar
*);
36 typedef GtkWidget
* (*wxGtkWidgetNewFromAdj_t
)(GtkAdjustment
*);
39 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
43 wxControl(wxWindow
*parent
, wxWindowID id
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
, long style
= 0,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxControlNameStr
)
49 Create(parent
, id
, pos
, size
, style
, validator
, name
);
52 bool Create(wxWindow
*parent
, wxWindowID id
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
, long style
= 0,
55 const wxValidator
& validator
= wxDefaultValidator
,
56 const wxString
& name
= wxControlNameStr
);
58 // this function will filter out '&' characters and will put the accelerator
59 // char (the one immediately after '&') into m_chAccel (TODO not yet)
60 virtual void SetLabel( const wxString
&label
);
61 virtual wxString
GetLabel() const;
63 virtual wxVisualAttributes
GetDefaultAttributes() const;
66 virtual wxSize
DoGetBestSize() const;
67 void PostCreation(const wxSize
& size
);
70 wxString
PrepareLabelMnemonics( const wxString
&label
) const;
73 // These are used by GetDefaultAttributes
74 static wxVisualAttributes
75 GetDefaultAttributesFromGTKWidget(GtkWidget
* widget
,
78 static wxVisualAttributes
79 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t
,
82 static wxVisualAttributes
83 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t
,
87 static wxVisualAttributes
88 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t
,
92 // Widgets that use the style->base colour for the BG colour should
93 // override this and return true.
94 virtual bool UseGTKStyleBase() const { return false; }
97 char m_chAccel
; // enabled to avoid breaking binary compatibility later on
100 DECLARE_DYNAMIC_CLASS(wxControl
)
103 #endif // __GTKCONTROLH__