]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/control.h
added GetHimagelist()
[wxWidgets.git] / include / wx / gtk / control.h
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma interface
15 #endif
16
17 #include "wx/defs.h"
18 #include "wx/object.h"
19 #include "wx/list.h"
20 #include "wx/window.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxControl;
27
28 //-----------------------------------------------------------------------------
29 // wxControl
30 //-----------------------------------------------------------------------------
31
32 // C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
33 extern "C" {
34 typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
35 typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*);
36 typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
37 }
38
39 class wxControl : public wxControlBase
40 {
41 public:
42 wxControl();
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)
48 {
49 Create(parent, id, pos, size, style, validator, name);
50 }
51
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);
57
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;
62
63 virtual wxVisualAttributes GetDefaultAttributes() const;
64
65 protected:
66 virtual wxSize DoGetBestSize() const;
67 void PostCreation(const wxSize& size);
68
69 #ifdef __WXGTK20__
70 wxString PrepareLabelMnemonics( const wxString &label ) const;
71 #endif
72
73 // These are used by GetDefaultAttributes
74 static wxVisualAttributes
75 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
76 bool useBase = false,
77 int state = -1);
78 static wxVisualAttributes
79 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
80 bool useBase = false,
81 int state = -1);
82 static wxVisualAttributes
83 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
84 bool useBase = false,
85 int state = -1);
86
87 static wxVisualAttributes
88 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
89 bool useBase = false,
90 int state = -1);
91
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; }
95
96 wxString m_label;
97 char m_chAccel; // enabled to avoid breaking binary compatibility later on
98
99 private:
100 DECLARE_DYNAMIC_CLASS(wxControl)
101 };
102
103 #endif // __GTKCONTROLH__