]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/combobox.h
set eol-style
[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:
05ef417f
DE
104 // FIXME: Quit deriving from wxTextCtrl
105 void Clear() // HACK
106 { wxComboBoxBase::Clear(); }
107
421a8431 108 // wxCombobox methods
aa61d352 109 virtual void SetSelection(int pos);
421a8431
DE
110 // Overlapping methods
111 virtual wxString GetStringSelection();
421a8431 112 // wxItemContainer
a236aa20
VZ
113 virtual void DoClear();
114 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
115 virtual unsigned int GetCount() const;
116 virtual wxString GetString(unsigned int) const;
117 virtual void SetString(unsigned int pos, const wxString&);
853dcc57 118 virtual int FindString(const wxString& s, bool bCase = false) const;
421a8431 119 virtual int GetSelection() const;
a236aa20
VZ
120 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
121 unsigned int pos,
122 void **clientData, wxClientDataType type);
aa61d352
VZ
123 virtual void DoSetItemClientData(unsigned int, void*);
124 virtual void* DoGetItemClientData(unsigned int) const;
a236aa20 125 virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
421a8431
DE
126 // wxComboBoxBase pure virtuals
127 virtual wxString GetValue() const
128 { return wxTextCtrl::GetValue(); }
129 virtual void SetValue(const wxString& value)
130 { return wxTextCtrl::SetValue(value); }
131 virtual void Cut() { wxTextCtrl::Cut(); }
132 virtual void Copy() { wxTextCtrl::Copy(); }
133 virtual void Paste() { wxTextCtrl::Paste(); }
134 virtual void SetInsertionPoint(long pos)
135 { wxTextCtrl::SetInsertionPoint(pos); }
136 virtual void SetInsertionPointEnd()
137 { wxTextCtrl::SetInsertionPointEnd(); }
138 virtual long GetInsertionPoint() const
139 { return wxTextCtrl::GetInsertionPoint(); }
7d8268a1 140 virtual wxTextPos GetLastPosition() const
421a8431
DE
141 { return wxTextCtrl::GetLastPosition(); }
142 virtual void Replace(long from, long to, const wxString& value)
143 { wxTextCtrl::Replace(from,to,value); }
144 virtual void SetSelection(long from, long to)
145 { wxTextCtrl::SetSelection(from,to); }
146 virtual void SetEditable(bool editable)
147 { wxTextCtrl::SetEditable(editable); }
150e31d2
JS
148 virtual bool IsEditable() const
149 { return !HasFlag(wxCB_READONLY); }
150 virtual void Undo()
151 { wxTextCtrl::Undo(); }
152 virtual void Redo()
153 { wxTextCtrl::Redo(); }
154 virtual void SelectAll()
155 { wxTextCtrl::SelectAll(); }
156 virtual bool CanCopy() const
157 { return wxTextCtrl::CanCopy(); }
b6e8e241 158 virtual bool CanCut() const
150e31d2
JS
159 { return wxTextCtrl::CanCut(); }
160 virtual bool CanPaste() const
161 { return wxTextCtrl::CanPaste(); }
162 virtual bool CanUndo() const
163 { return wxTextCtrl::CanUndo(); }
164 virtual bool CanRedo() const
165 { return wxTextCtrl::CanRedo(); }
421a8431
DE
166};
167
168#endif // __WX_COCOA_COMBOBOX_H__