]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/choice.h
Use wxObjcAutoRefFromAlloc for sm_cocoaTarget.
[wxWidgets.git] / include / wx / cocoa / choice.h
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 licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_CHOICE_H__
13 #define __WX_COCOA_CHOICE_H__
14
15 //#include "wx/cocoa/NSPopUpButton.h"
16 #include "wx/cocoa/NSMenu.h"
17
18 class WXDLLIMPEXP_BASE wxSortedArrayString;
19
20 // ========================================================================
21 // wxChoice
22 // ========================================================================
23 class WXDLLEXPORT wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu
24 {
25 DECLARE_DYNAMIC_CLASS(wxChoice)
26 DECLARE_EVENT_TABLE()
27 // WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
28 // ------------------------------------------------------------------------
29 // initialization
30 // ------------------------------------------------------------------------
31 public:
32 wxChoice() { Init(); }
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 {
41 Init();
42 Create(parent, winid, pos, size, n, choices, style, validator, name);
43 }
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 }
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);
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);
70 virtual ~wxChoice();
71 protected:
72 void Init();
73
74 // ------------------------------------------------------------------------
75 // Cocoa callbacks
76 // ------------------------------------------------------------------------
77 protected:
78 void CocoaNotification_menuDidSendAction(WX_NSNotification notification);
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&);
91 virtual int DoInsert(const wxString&, int);
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);
97 protected:
98 wxSortedArrayString *m_sortedStrings;
99 wxArrayPtrVoid m_itemsClientData;
100 };
101
102 #endif // __WX_COCOA_CHOICE_H__