]>
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 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) 2003 David Elliott | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef __WX_COCOA_CHOICE_H__ | |
13 | #define __WX_COCOA_CHOICE_H__ | |
14 | ||
f154ff60 DE |
15 | //#include "wx/cocoa/NSPopUpButton.h" |
16 | #include "wx/cocoa/NSMenu.h" | |
da0634c1 | 17 | |
584ad2a3 MB |
18 | class WXDLLIMPEXP_BASE wxSortedArrayString; |
19 | ||
da0634c1 DE |
20 | // ======================================================================== |
21 | // wxChoice | |
22 | // ======================================================================== | |
f154ff60 | 23 | class WXDLLEXPORT wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu |
da0634c1 DE |
24 | { |
25 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
26 | DECLARE_EVENT_TABLE() | |
27 | // WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) | |
28 | // ------------------------------------------------------------------------ | |
29 | // initialization | |
30 | // ------------------------------------------------------------------------ | |
31 | public: | |
f154ff60 | 32 | wxChoice() { Init(); } |
da0634c1 DE |
33 | wxChoice(wxWindow *parent, wxWindowID winid, |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | int n = 0, const wxString choices[] = NULL, | |
37 | long style = 0, | |
38 | const wxValidator& validator = wxDefaultValidator, | |
39 | const wxString& name = wxChoiceNameStr) | |
40 | { | |
f154ff60 | 41 | Init(); |
da0634c1 DE |
42 | Create(parent, winid, pos, size, n, choices, style, validator, name); |
43 | } | |
584ad2a3 MB |
44 | wxChoice(wxWindow *parent, wxWindowID winid, |
45 | const wxPoint& pos, | |
46 | const wxSize& size, | |
47 | const wxArrayString& choices, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxChoiceNameStr) | |
51 | { | |
52 | Init(); | |
53 | Create(parent, winid, pos, size, choices, style, validator, name); | |
54 | } | |
da0634c1 DE |
55 | |
56 | bool Create(wxWindow *parent, wxWindowID winid, | |
57 | const wxPoint& pos = wxDefaultPosition, | |
58 | const wxSize& size = wxDefaultSize, | |
59 | int n = 0, const wxString choices[] = NULL, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxChoiceNameStr); | |
584ad2a3 MB |
63 | bool Create(wxWindow *parent, wxWindowID winid, |
64 | const wxPoint& pos, | |
65 | const wxSize& size, | |
66 | const wxArrayString& choices, | |
67 | long style = 0, | |
68 | const wxValidator& validator = wxDefaultValidator, | |
69 | const wxString& name = wxChoiceNameStr); | |
da0634c1 | 70 | virtual ~wxChoice(); |
f154ff60 DE |
71 | protected: |
72 | void Init(); | |
da0634c1 DE |
73 | |
74 | // ------------------------------------------------------------------------ | |
75 | // Cocoa callbacks | |
76 | // ------------------------------------------------------------------------ | |
77 | protected: | |
f154ff60 | 78 | void CocoaNotification_menuDidSendAction(WX_NSNotification notification); |
da0634c1 DE |
79 | // ------------------------------------------------------------------------ |
80 | // Implementation | |
81 | // ------------------------------------------------------------------------ | |
82 | public: | |
83 | virtual void Clear(); | |
84 | virtual void Delete(int); | |
85 | virtual int GetCount() const; | |
86 | virtual wxString GetString(int) const; | |
87 | virtual void SetString(int, const wxString&); | |
88 | virtual int FindString(const wxString&) const; | |
89 | virtual int GetSelection() const; | |
90 | virtual int DoAppend(const wxString&); | |
be657756 | 91 | virtual int DoInsert(const wxString&, int); |
da0634c1 DE |
92 | virtual void DoSetItemClientData(int, void*); |
93 | virtual void* DoGetItemClientData(int) const; | |
94 | virtual void DoSetItemClientObject(int, wxClientData*); | |
95 | virtual wxClientData* DoGetItemClientObject(int) const; | |
96 | virtual void SetSelection(int); | |
f154ff60 DE |
97 | protected: |
98 | wxSortedArrayString *m_sortedStrings; | |
99 | wxArrayPtrVoid m_itemsClientData; | |
da0634c1 DE |
100 | }; |
101 | ||
102 | #endif // __WX_COCOA_CHOICE_H__ |