]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/cocoa/choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/03/16 | |
7 | // Copyright: (c) 2003 David Elliott | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef __WX_COCOA_CHOICE_H__ | |
12 | #define __WX_COCOA_CHOICE_H__ | |
13 | ||
14 | //#include "wx/cocoa/NSPopUpButton.h" | |
15 | #include "wx/cocoa/NSMenu.h" | |
16 | ||
17 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; | |
18 | ||
19 | // ======================================================================== | |
20 | // wxChoice | |
21 | // ======================================================================== | |
22 | class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu | |
23 | { | |
24 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
25 | DECLARE_EVENT_TABLE() | |
26 | // WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) | |
27 | // ------------------------------------------------------------------------ | |
28 | // initialization | |
29 | // ------------------------------------------------------------------------ | |
30 | public: | |
31 | wxChoice() { Init(); } | |
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 | { | |
40 | Init(); | |
41 | Create(parent, winid, pos, size, n, choices, style, validator, name); | |
42 | } | |
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 | } | |
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); | |
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); | |
69 | virtual ~wxChoice(); | |
70 | protected: | |
71 | void Init(); | |
72 | ||
73 | // ------------------------------------------------------------------------ | |
74 | // Cocoa callbacks | |
75 | // ------------------------------------------------------------------------ | |
76 | protected: | |
77 | void CocoaNotification_menuDidSendAction(WX_NSNotification notification); | |
78 | // ------------------------------------------------------------------------ | |
79 | // Implementation | |
80 | // ------------------------------------------------------------------------ | |
81 | public: | |
82 | virtual void DoClear(); | |
83 | virtual unsigned int GetCount() const; | |
84 | virtual wxString GetString(unsigned int) const; | |
85 | virtual void SetString(unsigned int pos, const wxString&); | |
86 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
87 | virtual int GetSelection() const; | |
88 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
89 | unsigned int pos, | |
90 | void **clientData, wxClientDataType type); | |
91 | virtual void DoDeleteOneItem(unsigned int pos); | |
92 | virtual void DoSetItemClientData(unsigned int, void*); | |
93 | virtual void* DoGetItemClientData(unsigned int) const; | |
94 | virtual void SetSelection(int pos); | |
95 | protected: | |
96 | wxSortedArrayString *m_sortedStrings; | |
97 | wxArrayPtrVoid m_itemsClientData; | |
98 | }; | |
99 | ||
100 | #endif // __WX_COCOA_CHOICE_H__ |