]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/choice.h
cleanup
[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_FWD_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 DoClear();
84 virtual unsigned int GetCount() const;
85 virtual wxString GetString(unsigned int) const;
86 virtual void SetString(unsigned int pos, const wxString&);
87 virtual int FindString(const wxString& s, bool bCase = false) const;
88 virtual int GetSelection() const;
89 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
90 unsigned int pos,
91 void **clientData, wxClientDataType type);
92 virtual void DoDeleteOneItem(unsigned int pos);
93 virtual void DoSetItemClientData(unsigned int, void*);
94 virtual void* DoGetItemClientData(unsigned int) const;
95 virtual void SetSelection(int pos);
96 protected:
97 wxSortedArrayString *m_sortedStrings;
98 wxArrayPtrVoid m_itemsClientData;
99 };
100
101 #endif // __WX_COCOA_CHOICE_H__