]>
Commit | Line | Data |
---|---|---|
da0634c1 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/03/16 | |
da0634c1 | 7 | // Copyright: (c) 2003 David Elliott |
853dcc57 | 8 | // Licence: wxWindows licence |
da0634c1 DE |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef __WX_COCOA_CHOICE_H__ | |
12 | #define __WX_COCOA_CHOICE_H__ | |
13 | ||
f154ff60 DE |
14 | //#include "wx/cocoa/NSPopUpButton.h" |
15 | #include "wx/cocoa/NSMenu.h" | |
da0634c1 | 16 | |
b5dbe15d | 17 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; |
584ad2a3 | 18 | |
da0634c1 DE |
19 | // ======================================================================== |
20 | // wxChoice | |
21 | // ======================================================================== | |
53a2db12 | 22 | class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu |
da0634c1 DE |
23 | { |
24 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
25 | DECLARE_EVENT_TABLE() | |
26 | // WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) | |
27 | // ------------------------------------------------------------------------ | |
28 | // initialization | |
29 | // ------------------------------------------------------------------------ | |
30 | public: | |
f154ff60 | 31 | wxChoice() { Init(); } |
da0634c1 DE |
32 | wxChoice(wxWindow *parent, wxWindowID winid, |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | int n = 0, const wxString choices[] = NULL, | |
36 | long style = 0, | |
37 | const wxValidator& validator = wxDefaultValidator, | |
38 | const wxString& name = wxChoiceNameStr) | |
39 | { | |
f154ff60 | 40 | Init(); |
da0634c1 DE |
41 | Create(parent, winid, pos, size, n, choices, style, validator, name); |
42 | } | |
584ad2a3 MB |
43 | wxChoice(wxWindow *parent, wxWindowID winid, |
44 | const wxPoint& pos, | |
45 | const wxSize& size, | |
46 | const wxArrayString& choices, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxChoiceNameStr) | |
50 | { | |
51 | Init(); | |
52 | Create(parent, winid, pos, size, choices, style, validator, name); | |
53 | } | |
da0634c1 DE |
54 | |
55 | bool Create(wxWindow *parent, wxWindowID winid, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | int n = 0, const wxString choices[] = NULL, | |
59 | long style = 0, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
62 | bool Create(wxWindow *parent, wxWindowID winid, |
63 | const wxPoint& pos, | |
64 | const wxSize& size, | |
65 | const wxArrayString& choices, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxChoiceNameStr); | |
da0634c1 | 69 | virtual ~wxChoice(); |
f154ff60 DE |
70 | protected: |
71 | void Init(); | |
da0634c1 DE |
72 | |
73 | // ------------------------------------------------------------------------ | |
74 | // Cocoa callbacks | |
75 | // ------------------------------------------------------------------------ | |
76 | protected: | |
f154ff60 | 77 | void CocoaNotification_menuDidSendAction(WX_NSNotification notification); |
da0634c1 DE |
78 | // ------------------------------------------------------------------------ |
79 | // Implementation | |
80 | // ------------------------------------------------------------------------ | |
81 | public: | |
a236aa20 | 82 | virtual void DoClear(); |
aa61d352 VZ |
83 | virtual unsigned int GetCount() const; |
84 | virtual wxString GetString(unsigned int) const; | |
85 | virtual void SetString(unsigned int pos, const wxString&); | |
853dcc57 | 86 | virtual int FindString(const wxString& s, bool bCase = false) const; |
da0634c1 | 87 | virtual int GetSelection() const; |
a236aa20 VZ |
88 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
89 | unsigned int pos, | |
90 | void **clientData, wxClientDataType type); | |
91 | virtual void DoDeleteOneItem(unsigned int pos); | |
aa61d352 VZ |
92 | virtual void DoSetItemClientData(unsigned int, void*); |
93 | virtual void* DoGetItemClientData(unsigned int) const; | |
aa61d352 | 94 | virtual void SetSelection(int pos); |
f154ff60 DE |
95 | protected: |
96 | wxSortedArrayString *m_sortedStrings; | |
97 | wxArrayPtrVoid m_itemsClientData; | |
da0634c1 DE |
98 | }; |
99 | ||
100 | #endif // __WX_COCOA_CHOICE_H__ |