]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/mac/carbon/choice.h |
8cf73271 SC |
3 | // Purpose: wxChoice class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
8cf73271 SC |
15 | #include "wx/control.h" |
16 | ||
17 | #include "wx/dynarray.h" | |
18 | #include "wx/arrstr.h" | |
19 | ||
63ec432b | 20 | WXDLLEXPORT_DATA(extern const wxChar) wxChoiceNameStr[]; |
8cf73271 SC |
21 | |
22 | WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; | |
23 | ||
24 | // Choice item | |
25 | class WXDLLEXPORT wxChoice: public wxChoiceBase | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
28 | ||
29 | public: | |
30 | wxChoice() | |
31 | : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL) | |
32 | {} | |
853dcc57 | 33 | |
8cf73271 SC |
34 | virtual ~wxChoice() ; |
35 | ||
853dcc57 WS |
36 | wxChoice(wxWindow *parent, wxWindowID id, |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, | |
39 | int n = 0, const wxString choices[] = NULL, | |
40 | long style = 0, | |
41 | const wxValidator& validator = wxDefaultValidator, | |
42 | const wxString& name = wxChoiceNameStr) | |
43 | { | |
44 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
45 | } | |
46 | wxChoice(wxWindow *parent, wxWindowID id, | |
47 | const wxPoint& pos, | |
48 | const wxSize& size, | |
49 | const wxArrayString& choices, | |
50 | long style = 0, | |
51 | const wxValidator& validator = wxDefaultValidator, | |
52 | const wxString& name = wxChoiceNameStr) | |
53 | { | |
54 | Create(parent, id, pos, size, choices, style, validator, name); | |
55 | } | |
56 | ||
57 | bool Create(wxWindow *parent, wxWindowID id, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, | |
60 | int n = 0, const wxString choices[] = NULL, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = wxChoiceNameStr); | |
64 | bool Create(wxWindow *parent, wxWindowID id, | |
65 | const wxPoint& pos, | |
66 | const wxSize& size, | |
67 | const wxArrayString& choices, | |
68 | long style = 0, | |
69 | const wxValidator& validator = wxDefaultValidator, | |
70 | const wxString& name = wxChoiceNameStr); | |
71 | ||
aa61d352 | 72 | virtual void Delete(unsigned int n); |
853dcc57 WS |
73 | virtual void Clear(); |
74 | ||
aa61d352 | 75 | virtual unsigned int GetCount() const ; |
853dcc57 WS |
76 | virtual int GetSelection() const ; |
77 | virtual void SetSelection(int n); | |
853dcc57 WS |
78 | |
79 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
aa61d352 VZ |
80 | virtual wxString GetString(unsigned int n) const ; |
81 | virtual void SetString(unsigned int pos, const wxString& s); | |
853dcc57 | 82 | virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; |
8cf73271 SC |
83 | |
84 | protected: | |
85 | virtual wxSize DoGetBestSize() const ; | |
6f02a879 | 86 | virtual int DoAppend(const wxString& item); |
aa61d352 | 87 | virtual int DoInsert(const wxString& item, unsigned int pos); |
8cf73271 | 88 | |
aa61d352 VZ |
89 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
90 | virtual void* DoGetItemClientData(unsigned int n) const; | |
91 | virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); | |
92 | virtual wxClientData* DoGetItemClientObject(unsigned int n) const; | |
8cf73271 | 93 | |
8cf73271 | 94 | // free all memory we have (used by Clear() and dtor) |
853dcc57 | 95 | // prevent collision with some BSD definitions of macro Free() |
8cf73271 SC |
96 | void FreeData(); |
97 | ||
853dcc57 WS |
98 | wxArrayString m_strings; |
99 | wxChoiceDataArray m_datas ; | |
100 | WXHMENU m_macPopUpMenuHandle ; | |
8cf73271 SC |
101 | }; |
102 | ||
103 | #endif | |
104 | // _WX_CHOICE_H_ |