]>
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 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
16 | #pragma interface "choice.h" |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
cba5db5f | 21 | #include "wx/dynarray.h" |
56d4016a | 22 | |
c4e41ce3 | 23 | WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; |
0dbd6262 | 24 | |
56d4016a SC |
25 | WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; |
26 | ||
0dbd6262 | 27 | // Choice item |
56d4016a | 28 | class WXDLLEXPORT wxChoice: public wxChoiceBase |
0dbd6262 | 29 | { |
d84afea9 GD |
30 | DECLARE_DYNAMIC_CLASS(wxChoice) |
31 | ||
32 | public: | |
33 | wxChoice() | |
34 | : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL) | |
35 | {} | |
36 | ||
37 | virtual ~wxChoice() ; | |
0dbd6262 | 38 | |
5b781a67 | 39 | wxChoice(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
40 | const wxPoint& pos = wxDefaultPosition, |
41 | const wxSize& size = wxDefaultSize, | |
42 | int n = 0, const wxString choices[] = NULL, | |
43 | long style = 0, | |
44 | const wxValidator& validator = wxDefaultValidator, | |
45 | const wxString& name = wxChoiceNameStr) | |
46 | { | |
47 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
48 | } | |
49 | ||
50 | bool Create(wxWindow *parent, wxWindowID id, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxChoiceNameStr); | |
57 | ||
5fde6fcc GD |
58 | // implement base class pure virtuals |
59 | virtual int DoAppend(const wxString& item); | |
243dbf1a | 60 | virtual int DoInsert(const wxString& item, int pos); |
0dbd6262 SC |
61 | virtual void Delete(int n); |
62 | virtual void Clear(); | |
5fde6fcc | 63 | |
56d4016a | 64 | virtual int GetCount() const ; |
0dbd6262 SC |
65 | virtual int GetSelection() const ; |
66 | virtual void SetSelection(int n); | |
5fde6fcc | 67 | |
0dbd6262 SC |
68 | virtual int FindString(const wxString& s) const; |
69 | virtual wxString GetString(int n) const ; | |
56d4016a | 70 | virtual void SetString( int , const wxString& s ) ; |
d921af51 | 71 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ; |
56d4016a SC |
72 | |
73 | /* | |
74 | virtual void Append(const wxString& item); | |
75 | // Added min Append and GetClientData | |
76 | virtual void Append(const wxString& item, void *client_data); | |
77 | virtual void *GetClientData(int index) const; | |
78 | virtual inline void Select( int n ) { SetSelection( n ); } | |
0dbd6262 SC |
79 | virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
80 | virtual wxString GetStringSelection() const ; | |
81 | virtual bool SetStringSelection(const wxString& sel); | |
82 | ||
5fde6fcc | 83 | // Mac specific |
0dbd6262 | 84 | virtual void Command(wxCommandEvent& event); |
d921af51 | 85 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ; |
0dbd6262 | 86 | |
0dbd6262 | 87 | virtual inline int GetColumns() const { return 1 ; }; |
56d4016a | 88 | */ |
0dbd6262 | 89 | protected: |
9453cf2b | 90 | virtual wxSize DoGetBestSize() const ; |
56d4016a SC |
91 | virtual void DoSetItemClientData( int n, void* clientData ); |
92 | virtual void* DoGetItemClientData( int n ) const; | |
93 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
94 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
95 | ||
56d4016a | 96 | // free all memory we have (used by Clear() and dtor) |
4b651a46 GD |
97 | // prevent collision with some BSD definitions of macro Free() |
98 | void FreeData(); | |
56d4016a | 99 | |
05adb9d2 | 100 | wxArrayString m_strings; |
b668a735 | 101 | wxChoiceDataArray m_datas ; |
d921af51 | 102 | WXHMENU m_macPopUpMenuHandle ; |
0dbd6262 SC |
103 | }; |
104 | ||
105 | #endif | |
d921af51 | 106 | // _WX_CHOICE_H_ |