]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/combobox.h
adding OS level Window Menu 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);
29
30 virtual void doWxEvent(int nEvent) = 0;
31};
32
33//begin combobox.h
34
35#include "wx/dynarray.h"
421a8431
DE
36
37// ========================================================================
38// wxComboBox
39// ========================================================================
8f248607 40class WXDLLEXPORT wxComboBox : public wxTextCtrl, public wxComboBoxBase, protected wxCocoaNSComboBox
421a8431
DE
41{
42 DECLARE_DYNAMIC_CLASS(wxComboBox)
43 DECLARE_EVENT_TABLE()
8f248607 44 WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
421a8431
DE
45// ------------------------------------------------------------------------
46// initialization
47// ------------------------------------------------------------------------
48public:
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 }
584ad2a3
MB
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 }
421a8431
DE
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);
584ad2a3
MB
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);
421a8431
DE
90 virtual ~wxComboBox();
91
92// ------------------------------------------------------------------------
93// Cocoa callbacks
94// ------------------------------------------------------------------------
95protected:
8f248607
RN
96 wxArrayPtrVoid m_Datas;
97 virtual void doWxEvent(int nEvent);
98
421a8431
DE
99// ------------------------------------------------------------------------
100// Implementation
101// ------------------------------------------------------------------------
102public:
103 // wxCombobox methods
104 virtual void SetSelection(int);
105 // Overlapping methods
106 virtual wxString GetStringSelection();
421a8431
DE
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;
421a8431
DE
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(); }
7d8268a1 135 virtual wxTextPos GetLastPosition() const
421a8431
DE
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); }
150e31d2
JS
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(); }
b6e8e241 153 virtual bool CanCut() const
150e31d2
JS
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(); }
421a8431
DE
161};
162
163#endif // __WX_COCOA_COMBOBOX_H__