]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/control.h
added wxPLURAL() macro
[wxWidgets.git] / include / wx / gtk / control.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
3// Purpose:
4// Author: Robert Roebling
dbf858b5
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling, Julian Smart
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifndef __GTKCONTROLH__
11#define __GTKCONTROLH__
12
12028905 13#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
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
26class wxControl;
27
28//-----------------------------------------------------------------------------
29// wxControl
30//-----------------------------------------------------------------------------
31
865bb325
VZ
32// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget
33extern "C" {
34 typedef GtkWidget* (*wxGtkWidgetNew_t)(void);
35 typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*);
36 typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*);
37}
38
9abe166a 39class wxControl : public wxControlBase
c801d85f 40{
2a4f4a27 41public:
8d99be5f 42 wxControl();
04165bec
RR
43 wxControl(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize, long style = 0,
04165bec 46 const wxValidator& validator = wxDefaultValidator,
04165bec
RR
47 const wxString& name = wxControlNameStr)
48 {
674ac8b9 49 Create(parent, id, pos, size, style, validator, name);
04165bec 50 }
8d772832 51
04165bec
RR
52 bool Create(wxWindow *parent, wxWindowID id,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize, long style = 0,
04165bec 55 const wxValidator& validator = wxDefaultValidator,
04165bec 56 const wxString& name = wxControlNameStr);
2a4f4a27 57
2a4f4a27 58 // this function will filter out '&' characters and will put the accelerator
8d99be5f
VZ
59 // char (the one immediately after '&') into m_chAccel (TODO not yet)
60 virtual void SetLabel( const wxString &label );
61 virtual wxString GetLabel() const;
fe161a26 62
9d522606
RD
63 virtual wxVisualAttributes GetDefaultAttributes() const;
64
2a4f4a27 65protected:
f68586e5 66 virtual wxSize DoGetBestSize() const;
abdeb9e7
RD
67 void PostCreation(const wxSize& size);
68
eaafd2f8
VS
69#ifdef __WXGTK20__
70 wxString PrepareLabelMnemonics( const wxString &label ) const;
71#endif
f68586e5 72
9d522606
RD
73 // These are used by GetDefaultAttributes
74 static wxVisualAttributes
75 GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
76 bool useBase = false,
77 int state = -1);
78 static wxVisualAttributes
865bb325 79 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t,
9d522606
RD
80 bool useBase = false,
81 int state = -1);
82 static wxVisualAttributes
865bb325 83 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t,
9d522606
RD
84 bool useBase = false,
85 int state = -1);
86
87 static wxVisualAttributes
865bb325 88 GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t,
9d522606
RD
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
8d99be5f
VZ
96 wxString m_label;
97 char m_chAccel; // enabled to avoid breaking binary compatibility later on
8d772832 98
738f9e5a
RR
99private:
100 DECLARE_DYNAMIC_CLASS(wxControl)
c801d85f
KB
101};
102
103#endif // __GTKCONTROLH__