]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/combobox.h
re-disable Universal Mac builds by default
[wxWidgets.git] / include / wx / cocoa / combobox.h
CommitLineData
421a8431
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/combobox.h
3// Purpose: wxComboBox class
8f248607 4// Author: Ryan Norton
421a8431 5// Modified by:
8f248607 6// Created: 2005/02/16
421a8431
DE
7// RCS-ID: $Id$
8// Copyright: (c) 2003 David Elliott
7d8268a1 9// Licence: wxWindows licence
421a8431
DE
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __WX_COCOA_COMBOBOX_H__
13#define __WX_COCOA_COMBOBOX_H__
14
8f248607
RN
15//Begin NSComboBox.h
16
17#include "wx/hashmap.h"
18#include "wx/cocoa/ObjcAssociate.h"
19
20DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox);
21
22WX_DECLARE_OBJC_HASHMAP(NSComboBox);
23class wxCocoaNSComboBox
24{
25 WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox)
26public:
27 void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
28 void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
853dcc57 29
8f248607 30 virtual void doWxEvent(int nEvent) = 0;
31e57091 31 virtual ~wxCocoaNSComboBox() { }
8f248607
RN
32};
33
34//begin combobox.h
35
36#include "wx/dynarray.h"
421a8431
DE
37
38// ========================================================================
39// wxComboBox
40// ========================================================================
8f248607 41class WXDLLEXPORT wxComboBox : public wxTextCtrl, public wxComboBoxBase, protected wxCocoaNSComboBox
421a8431
DE
42{
43 DECLARE_DYNAMIC_CLASS(wxComboBox)
44 DECLARE_EVENT_TABLE()
8f248607 45 WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
421a8431
DE
46// ------------------------------------------------------------------------
47// initialization
48// ------------------------------------------------------------------------
49public:
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 }
584ad2a3
MB
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 }
421a8431
DE
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);
584ad2a3
MB
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);
421a8431
DE
91 virtual ~wxComboBox();
92
93// ------------------------------------------------------------------------
94// Cocoa callbacks
95// ------------------------------------------------------------------------
96protected:
8f248607
RN
97 wxArrayPtrVoid m_Datas;
98 virtual void doWxEvent(int nEvent);
99
421a8431
DE
100// ------------------------------------------------------------------------
101// Implementation
102// ------------------------------------------------------------------------
103public:
104 // wxCombobox methods
aa61d352 105 virtual void SetSelection(int pos);
421a8431
DE
106 // Overlapping methods
107 virtual wxString GetStringSelection();
421a8431 108 // wxItemContainer
a236aa20
VZ
109 virtual void DoClear();
110 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
111 virtual unsigned int GetCount() const;
112 virtual wxString GetString(unsigned int) const;
113 virtual void SetString(unsigned int pos, const wxString&);
853dcc57 114 virtual int FindString(const wxString& s, bool bCase = false) const;
421a8431 115 virtual int GetSelection() const;
a236aa20
VZ
116 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
117 unsigned int pos,
118 void **clientData, wxClientDataType type);
aa61d352
VZ
119 virtual void DoSetItemClientData(unsigned int, void*);
120 virtual void* DoGetItemClientData(unsigned int) const;
a236aa20 121 virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
421a8431
DE
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(); }
7d8268a1 136 virtual wxTextPos GetLastPosition() const
421a8431
DE
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); }
150e31d2
JS
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(); }
b6e8e241 154 virtual bool CanCut() const
150e31d2
JS
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(); }
421a8431
DE
162};
163
164#endif // __WX_COCOA_COMBOBOX_H__