]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/combobox.h
Compilation fix after wxCB_ flags move.
[wxWidgets.git] / include / wx / cocoa / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Ryan Norton
5 // Modified by:
6 // Created: 2005/02/16
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_COMBOBOX_H__
13 #define __WX_COCOA_COMBOBOX_H__
14
15 //Begin NSComboBox.h
16
17 #include "wx/hashmap.h"
18 #include "wx/cocoa/ObjcAssociate.h"
19
20 DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox);
21
22 WX_DECLARE_OBJC_HASHMAP(NSComboBox);
23 class wxCocoaNSComboBox
24 {
25 WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox)
26 public:
27 void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
28 void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
29
30 virtual void doWxEvent(int nEvent) = 0;
31 virtual ~wxCocoaNSComboBox() { }
32 };
33
34 //begin combobox.h
35
36 #include "wx/dynarray.h"
37
38 // ========================================================================
39 // wxComboBox
40 // ========================================================================
41 class WXDLLEXPORT wxComboBox : public wxTextCtrl, public wxComboBoxBase, protected wxCocoaNSComboBox
42 {
43 DECLARE_DYNAMIC_CLASS(wxComboBox)
44 DECLARE_EVENT_TABLE()
45 WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
46 // ------------------------------------------------------------------------
47 // initialization
48 // ------------------------------------------------------------------------
49 public:
50 wxComboBox() { }
51 wxComboBox(wxWindow *parent, wxWindowID winid,
52 const wxString& value = wxEmptyString,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 int n = 0, const wxString choices[] = NULL,
56 long style = 0,
57 const wxValidator& validator = wxDefaultValidator,
58 const wxString& name = wxComboBoxNameStr)
59 {
60 Create(parent, winid, value, pos, size, n, choices, style, validator, name);
61 }
62 wxComboBox(wxWindow *parent, wxWindowID winid,
63 const wxString& value,
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 = wxComboBoxNameStr)
70 {
71 Create(parent, winid, value, pos, size, choices, style,
72 validator, name);
73 }
74
75 bool Create(wxWindow *parent, wxWindowID winid,
76 const wxString& value = wxEmptyString,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
79 int n = 0, const wxString choices[] = NULL,
80 long style = 0,
81 const wxValidator& validator = wxDefaultValidator,
82 const wxString& name = wxComboBoxNameStr);
83 bool Create(wxWindow *parent, wxWindowID winid,
84 const wxString& value,
85 const wxPoint& pos,
86 const wxSize& size,
87 const wxArrayString& choices,
88 long style = 0,
89 const wxValidator& validator = wxDefaultValidator,
90 const wxString& name = wxComboBoxNameStr);
91 virtual ~wxComboBox();
92
93 // ------------------------------------------------------------------------
94 // Cocoa callbacks
95 // ------------------------------------------------------------------------
96 protected:
97 wxArrayPtrVoid m_Datas;
98 virtual void doWxEvent(int nEvent);
99
100 // ------------------------------------------------------------------------
101 // Implementation
102 // ------------------------------------------------------------------------
103 public:
104 // wxCombobox methods
105 virtual void SetSelection(int pos);
106 // Overlapping methods
107 virtual wxString GetStringSelection();
108 // wxItemContainer
109 virtual void Clear();
110 virtual void Delete(unsigned int n);
111 virtual unsigned int GetCount() const;
112 virtual wxString GetString(unsigned int) const;
113 virtual void SetString(unsigned int pos, const wxString&);
114 virtual int FindString(const wxString& s, bool bCase = false) const;
115 virtual int GetSelection() const;
116 virtual int DoAppend(const wxString&);
117 virtual int DoInsert(const wxString&, unsigned int pos);
118 virtual void DoSetItemClientData(unsigned int, void*);
119 virtual void* DoGetItemClientData(unsigned int) const;
120 virtual void DoSetItemClientObject(unsigned int, wxClientData*);
121 virtual wxClientData* DoGetItemClientObject(unsigned int) const;
122 // wxComboBoxBase pure virtuals
123 virtual wxString GetValue() const
124 { return wxTextCtrl::GetValue(); }
125 virtual void SetValue(const wxString& value)
126 { return wxTextCtrl::SetValue(value); }
127 virtual void Cut() { wxTextCtrl::Cut(); }
128 virtual void Copy() { wxTextCtrl::Copy(); }
129 virtual void Paste() { wxTextCtrl::Paste(); }
130 virtual void SetInsertionPoint(long pos)
131 { wxTextCtrl::SetInsertionPoint(pos); }
132 virtual void SetInsertionPointEnd()
133 { wxTextCtrl::SetInsertionPointEnd(); }
134 virtual long GetInsertionPoint() const
135 { return wxTextCtrl::GetInsertionPoint(); }
136 virtual wxTextPos GetLastPosition() const
137 { return wxTextCtrl::GetLastPosition(); }
138 virtual void Replace(long from, long to, const wxString& value)
139 { wxTextCtrl::Replace(from,to,value); }
140 virtual void SetSelection(long from, long to)
141 { wxTextCtrl::SetSelection(from,to); }
142 virtual void SetEditable(bool editable)
143 { wxTextCtrl::SetEditable(editable); }
144 virtual bool IsEditable() const
145 { return !HasFlag(wxCB_READONLY); }
146 virtual void Undo()
147 { wxTextCtrl::Undo(); }
148 virtual void Redo()
149 { wxTextCtrl::Redo(); }
150 virtual void SelectAll()
151 { wxTextCtrl::SelectAll(); }
152 virtual bool CanCopy() const
153 { return wxTextCtrl::CanCopy(); }
154 virtual bool CanCut() const
155 { return wxTextCtrl::CanCut(); }
156 virtual bool CanPaste() const
157 { return wxTextCtrl::CanPaste(); }
158 virtual bool CanUndo() const
159 { return wxTextCtrl::CanUndo(); }
160 virtual bool CanRedo() const
161 { return wxTextCtrl::CanRedo(); }
162 };
163
164 #endif // __WX_COCOA_COMBOBOX_H__