]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/choice.h
wxPython 2.1b1 for wxMSW (wxGTK coming soon)
[wxWidgets.git] / include / wx / gtk / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choice.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKCHOICEH__
11 #define __GTKCHOICEH__
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "wx/defs.h"
18
19 #include "wx/object.h"
20 #include "wx/list.h"
21 #include "wx/control.h"
22
23 //-----------------------------------------------------------------------------
24 // classes
25 //-----------------------------------------------------------------------------
26
27 class wxChoice;
28
29 //-----------------------------------------------------------------------------
30 // global data
31 //-----------------------------------------------------------------------------
32
33 extern const char *wxChoiceNameStr;
34
35 //-----------------------------------------------------------------------------
36 // wxChoice
37 //-----------------------------------------------------------------------------
38
39 class wxChoice : public wxControl
40 {
41 DECLARE_DYNAMIC_CLASS(wxChoice)
42
43 public:
44 wxChoice();
45 wxChoice( wxWindow *parent, wxWindowID id,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 int n = 0, const wxString choices[] = (const wxString *) NULL,
49 long style = 0,
50 const wxValidator& validator = wxDefaultValidator,
51 const wxString& name = wxChoiceNameStr )
52 {
53 Create(parent, id, pos, size, n, choices, style, validator, name);
54 }
55 ~wxChoice();
56 bool Create( wxWindow *parent, wxWindowID id,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 int n = 0, const wxString choices[] = (wxString *) NULL,
60 long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxChoiceNameStr );
63
64 void Append( const wxString &item );
65 void Append( const wxString &item, void* clientData );
66 void Append( const wxString &item, wxClientData* clientData );
67
68 void SetClientData( int n, void* clientData );
69 void* GetClientData( int n );
70 void SetClientObject( int n, wxClientData* clientData );
71 wxClientData* GetClientObject( int n );
72
73 void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); }
74 wxClientData *GetClientObject() const { return wxControl::GetClientObject(); }
75 void SetClientData( void *data ) { wxControl::SetClientData( data ); }
76 void *GetClientData() const { return wxControl::GetClientData(); }
77
78 void Clear();
79 void Delete(int n);
80
81 int FindString( const wxString &string ) const;
82 int GetColumns() const;
83 int GetSelection();
84 wxString GetString( int n ) const;
85 wxString GetStringSelection() const;
86 int Number() const;
87 void SetColumns( int n = 1 );
88 void SetSelection( int n );
89 void SetStringSelection( const wxString &string );
90
91 // implementation
92
93 wxList m_clientDataList;
94 wxList m_clientObjectList;
95
96 void AppendCommon( const wxString &item );
97 void ApplyWidgetStyle();
98 };
99
100
101 #endif // __GTKCHOICEH__