]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/combobox.h
Fixed wxToolBar for WinCE so normal bitmaps can be used;
[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 };
32
33 //begin combobox.h
34
35 #include "wx/dynarray.h"
36
37 // ========================================================================
38 // wxComboBox
39 // ========================================================================
40 class WXDLLEXPORT wxComboBox : public wxTextCtrl, public wxComboBoxBase, protected wxCocoaNSComboBox
41 {
42 DECLARE_DYNAMIC_CLASS(wxComboBox)
43 DECLARE_EVENT_TABLE()
44 WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
45 // ------------------------------------------------------------------------
46 // initialization
47 // ------------------------------------------------------------------------
48 public:
49 wxComboBox() { }
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,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxComboBoxNameStr)
58 {
59 Create(parent, winid, value, pos, size, n, choices, style, validator, name);
60 }
61 wxComboBox(wxWindow *parent, wxWindowID winid,
62 const wxString& value,
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 = wxComboBoxNameStr)
69 {
70 Create(parent, winid, value, pos, size, choices, style,
71 validator, name);
72 }
73
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,
79 long style = 0,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = wxComboBoxNameStr);
82 bool Create(wxWindow *parent, wxWindowID winid,
83 const wxString& value,
84 const wxPoint& pos,
85 const wxSize& size,
86 const wxArrayString& choices,
87 long style = 0,
88 const wxValidator& validator = wxDefaultValidator,
89 const wxString& name = wxComboBoxNameStr);
90 virtual ~wxComboBox();
91
92 // ------------------------------------------------------------------------
93 // Cocoa callbacks
94 // ------------------------------------------------------------------------
95 protected:
96 wxArrayPtrVoid m_Datas;
97 virtual void doWxEvent(int nEvent);
98
99 // ------------------------------------------------------------------------
100 // Implementation
101 // ------------------------------------------------------------------------
102 public:
103 // wxCombobox methods
104 virtual void SetSelection(int);
105 // Overlapping methods
106 virtual wxString GetStringSelection();
107 // wxItemContainer
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&) 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); }
145 virtual void Undo()
146 { wxTextCtrl::Undo(); }
147 virtual void Redo()
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(); }
161 };
162
163 #endif // __WX_COCOA_COMBOBOX_H__