1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/combobox.h
3 // Purpose: wxComboBox class
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_COMBOBOX_H__
13 #define __WX_COCOA_COMBOBOX_H__
17 #include "wx/hashmap.h"
18 #include "wx/cocoa/ObjcAssociate.h"
20 DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox
);
22 WX_DECLARE_OBJC_HASHMAP(NSComboBox
);
23 class wxCocoaNSComboBox
25 WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox
)
27 void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox
);
28 void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox
);
30 virtual void doWxEvent(int nEvent
) = 0;
35 #include "wx/dynarray.h"
37 // ========================================================================
39 // ========================================================================
40 class WXDLLEXPORT wxComboBox
: public wxTextCtrl
, public wxComboBoxBase
, protected wxCocoaNSComboBox
42 DECLARE_DYNAMIC_CLASS(wxComboBox
)
44 WX_DECLARE_COCOA_OWNER(NSComboBox
,NSTextField
,NSView
)
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
50 wxComboBox(wxWindow
*parent
, wxWindowID winid
,
51 const wxString
& value
= wxEmptyString
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 int n
= 0, const wxString choices
[] = NULL
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxComboBoxNameStr
)
59 Create(parent
, winid
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
61 wxComboBox(wxWindow
*parent
, wxWindowID winid
,
62 const wxString
& value
,
65 const wxArrayString
& choices
,
67 const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
& name
= wxComboBoxNameStr
)
70 Create(parent
, winid
, value
, pos
, size
, choices
, style
,
74 bool Create(wxWindow
*parent
, wxWindowID winid
,
75 const wxString
& value
= wxEmptyString
,
76 const wxPoint
& pos
= wxDefaultPosition
,
77 const wxSize
& size
= wxDefaultSize
,
78 int n
= 0, const wxString choices
[] = NULL
,
80 const wxValidator
& validator
= wxDefaultValidator
,
81 const wxString
& name
= wxComboBoxNameStr
);
82 bool Create(wxWindow
*parent
, wxWindowID winid
,
83 const wxString
& value
,
86 const wxArrayString
& choices
,
88 const wxValidator
& validator
= wxDefaultValidator
,
89 const wxString
& name
= wxComboBoxNameStr
);
90 virtual ~wxComboBox();
92 // ------------------------------------------------------------------------
94 // ------------------------------------------------------------------------
96 wxArrayPtrVoid m_Datas
;
97 virtual void doWxEvent(int nEvent
);
99 // ------------------------------------------------------------------------
101 // ------------------------------------------------------------------------
103 // wxCombobox methods
104 virtual void SetSelection(int);
105 // Overlapping methods
106 virtual wxString
GetStringSelection();
108 virtual void Clear();
109 virtual void Delete(int);
110 virtual int GetCount() const;
111 virtual wxString
GetString(int) const;
112 virtual void SetString(int, const wxString
&);
113 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
114 virtual int GetSelection() const;
115 virtual int DoAppend(const wxString
&);
116 virtual int DoInsert(const wxString
&, int);
117 virtual void DoSetItemClientData(int, void*);
118 virtual void* DoGetItemClientData(int) const;
119 virtual void DoSetItemClientObject(int, wxClientData
*);
120 virtual wxClientData
* DoGetItemClientObject(int) const;
121 // wxComboBoxBase pure virtuals
122 virtual wxString
GetValue() const
123 { return wxTextCtrl::GetValue(); }
124 virtual void SetValue(const wxString
& value
)
125 { return wxTextCtrl::SetValue(value
); }
126 virtual void Cut() { wxTextCtrl::Cut(); }
127 virtual void Copy() { wxTextCtrl::Copy(); }
128 virtual void Paste() { wxTextCtrl::Paste(); }
129 virtual void SetInsertionPoint(long pos
)
130 { wxTextCtrl::SetInsertionPoint(pos
); }
131 virtual void SetInsertionPointEnd()
132 { wxTextCtrl::SetInsertionPointEnd(); }
133 virtual long GetInsertionPoint() const
134 { return wxTextCtrl::GetInsertionPoint(); }
135 virtual wxTextPos
GetLastPosition() const
136 { return wxTextCtrl::GetLastPosition(); }
137 virtual void Replace(long from
, long to
, const wxString
& value
)
138 { wxTextCtrl::Replace(from
,to
,value
); }
139 virtual void SetSelection(long from
, long to
)
140 { wxTextCtrl::SetSelection(from
,to
); }
141 virtual void SetEditable(bool editable
)
142 { wxTextCtrl::SetEditable(editable
); }
143 virtual bool IsEditable() const
144 { return !HasFlag(wxCB_READONLY
); }
146 { wxTextCtrl::Undo(); }
148 { wxTextCtrl::Redo(); }
149 virtual void SelectAll()
150 { wxTextCtrl::SelectAll(); }
151 virtual bool CanCopy() const
152 { return wxTextCtrl::CanCopy(); }
153 virtual bool CanCut() const
154 { return wxTextCtrl::CanCut(); }
155 virtual bool CanPaste() const
156 { return wxTextCtrl::CanPaste(); }
157 virtual bool CanUndo() const
158 { return wxTextCtrl::CanUndo(); }
159 virtual bool CanRedo() const
160 { return wxTextCtrl::CanRedo(); }
163 #endif // __WX_COCOA_COMBOBOX_H__