]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.h | |
3 | // Purpose: wxChoice class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
d921af51 | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
0dbd6262 SC |
16 | #pragma interface "choice.h" |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
584ad2a3 MB |
21 | #include "wx/dynarray.h" |
22 | #include "wx/arrstr.h" | |
56d4016a | 23 | |
c4e41ce3 | 24 | WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; |
0dbd6262 | 25 | |
56d4016a SC |
26 | WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; |
27 | ||
0dbd6262 | 28 | // Choice item |
56d4016a | 29 | class WXDLLEXPORT wxChoice: public wxChoiceBase |
0dbd6262 | 30 | { |
d84afea9 GD |
31 | DECLARE_DYNAMIC_CLASS(wxChoice) |
32 | ||
33 | public: | |
34 | wxChoice() | |
35 | : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL) | |
36 | {} | |
37 | ||
38 | virtual ~wxChoice() ; | |
0dbd6262 | 39 | |
5b781a67 | 40 | wxChoice(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
41 | const wxPoint& pos = wxDefaultPosition, |
42 | const wxSize& size = wxDefaultSize, | |
43 | int n = 0, const wxString choices[] = NULL, | |
44 | long style = 0, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString& name = wxChoiceNameStr) | |
47 | { | |
48 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
49 | } | |
584ad2a3 MB |
50 | wxChoice(wxWindow *parent, wxWindowID id, |
51 | const wxPoint& pos, | |
52 | const wxSize& size, | |
53 | const wxArrayString& choices, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxChoiceNameStr) | |
57 | { | |
58 | Create(parent, id, pos, size, choices, style, validator, name); | |
59 | } | |
0dbd6262 SC |
60 | |
61 | bool Create(wxWindow *parent, wxWindowID id, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | int n = 0, const wxString choices[] = NULL, | |
65 | long style = 0, | |
66 | const wxValidator& validator = wxDefaultValidator, | |
67 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
68 | bool Create(wxWindow *parent, wxWindowID id, |
69 | const wxPoint& pos, | |
70 | const wxSize& size, | |
71 | const wxArrayString& choices, | |
72 | long style = 0, | |
73 | const wxValidator& validator = wxDefaultValidator, | |
74 | const wxString& name = wxChoiceNameStr); | |
0dbd6262 | 75 | |
5fde6fcc GD |
76 | // implement base class pure virtuals |
77 | virtual int DoAppend(const wxString& item); | |
243dbf1a | 78 | virtual int DoInsert(const wxString& item, int pos); |
0dbd6262 SC |
79 | virtual void Delete(int n); |
80 | virtual void Clear(); | |
5fde6fcc | 81 | |
56d4016a | 82 | virtual int GetCount() const ; |
0dbd6262 SC |
83 | virtual int GetSelection() const ; |
84 | virtual void SetSelection(int n); | |
5fde6fcc | 85 | |
0dbd6262 SC |
86 | virtual int FindString(const wxString& s) const; |
87 | virtual wxString GetString(int n) const ; | |
56d4016a | 88 | virtual void SetString( int , const wxString& s ) ; |
69b85ca4 SC |
89 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; |
90 | ||
0dbd6262 | 91 | protected: |
9453cf2b | 92 | virtual wxSize DoGetBestSize() const ; |
f148f2ba MB |
93 | |
94 | public: // for wxComboBox only | |
56d4016a SC |
95 | virtual void DoSetItemClientData( int n, void* clientData ); |
96 | virtual void* DoGetItemClientData( int n ) const; | |
97 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
98 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
99 | ||
f148f2ba | 100 | protected: |
56d4016a | 101 | // free all memory we have (used by Clear() and dtor) |
4b651a46 GD |
102 | // prevent collision with some BSD definitions of macro Free() |
103 | void FreeData(); | |
56d4016a | 104 | |
05adb9d2 | 105 | wxArrayString m_strings; |
b668a735 | 106 | wxChoiceDataArray m_datas ; |
d921af51 | 107 | WXHMENU m_macPopUpMenuHandle ; |
0dbd6262 SC |
108 | }; |
109 | ||
110 | #endif | |
d921af51 | 111 | // _WX_CHOICE_H_ |