]>
Commit | Line | Data |
---|---|---|
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 wxChar *wxChoiceNameStr; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // wxChoice | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | class wxChoice : public wxControl | |
40 | { | |
41 | public: | |
42 | wxChoice(); | |
43 | wxChoice( wxWindow *parent, wxWindowID id, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxChoiceNameStr ) | |
50 | { | |
51 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
52 | } | |
53 | ~wxChoice(); | |
54 | bool Create( wxWindow *parent, wxWindowID id, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | int n = 0, const wxString choices[] = (wxString *) NULL, | |
58 | long style = 0, | |
59 | const wxValidator& validator = wxDefaultValidator, | |
60 | const wxString& name = wxChoiceNameStr ); | |
61 | ||
62 | void Append( const wxString &item ); | |
63 | void Append( const wxString &item, void* clientData ); | |
64 | void Append( const wxString &item, wxClientData* clientData ); | |
65 | ||
66 | void SetClientData( int n, void* clientData ); | |
67 | void* GetClientData( int n ); | |
68 | void SetClientObject( int n, wxClientData* clientData ); | |
69 | wxClientData* GetClientObject( int n ); | |
70 | ||
71 | void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); } | |
72 | wxClientData *GetClientObject() const { return wxControl::GetClientObject(); } | |
73 | void SetClientData( void *data ) { wxControl::SetClientData( data ); } | |
74 | void *GetClientData() const { return wxControl::GetClientData(); } | |
75 | ||
76 | void Clear(); | |
77 | void Delete(int n); | |
78 | ||
79 | int FindString( const wxString &string ) const; | |
80 | int GetColumns() const; | |
81 | int GetSelection(); | |
82 | wxString GetString( int n ) const; | |
83 | wxString GetStringSelection() const; | |
84 | int Number() const; | |
85 | void SetColumns( int n = 1 ); | |
86 | void SetSelection( int n ); | |
87 | void SetStringSelection( const wxString &string ); | |
88 | ||
89 | // implementation | |
90 | ||
91 | wxList m_clientDataList; | |
92 | wxList m_clientObjectList; | |
93 | ||
94 | void DisableEvents(); | |
95 | void EnableEvents(); | |
96 | void AppendCommon( const wxString &item ); | |
97 | void ApplyWidgetStyle(); | |
98 | ||
99 | private: | |
100 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
101 | }; | |
102 | ||
103 | ||
104 | #endif // __GTKCHOICEH__ |