]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/combobox.h
Partly reverted changes to Get(Current)Selection.
[wxWidgets.git] / include / wx / mac / classic / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/classic/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
14
15 #include "wx/choice.h"
16
17 WXDLLEXPORT_DATA(extern const wxChar) wxComboBoxNameStr[];
18
19 // Combobox item
20 class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
21 {
22 DECLARE_DYNAMIC_CLASS(wxComboBox)
23
24 public:
25 inline wxComboBox() {}
26 virtual ~wxComboBox();
27 // override the base class virtuals involved in geometry calculations
28 virtual wxSize DoGetBestSize() const;
29 virtual void DoMoveWindow(int x, int y, int width, int height);
30
31 // forward these functions to all subcontrols
32 virtual bool Enable(bool enable = true);
33 virtual bool Show(bool show = true);
34 virtual void SetFocus();
35
36 // callback functions
37 virtual void DelegateTextChanged( const wxString& value );
38 virtual void DelegateChoice( const wxString& value );
39
40 inline wxComboBox(wxWindow *parent, wxWindowID id,
41 const wxString& value = wxEmptyString,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 int n = 0, const wxString choices[] = NULL,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxComboBoxNameStr)
48 {
49 Create(parent, id, value, pos, size, n, choices, style, validator, name);
50 }
51 inline wxComboBox(wxWindow *parent, wxWindowID id,
52 const wxString& value,
53 const wxPoint& pos,
54 const wxSize& size,
55 const wxArrayString& choices,
56 long style = 0,
57 const wxValidator& validator = wxDefaultValidator,
58 const wxString& name = wxComboBoxNameStr)
59 {
60 Create(parent, id, value, pos, size, choices, style, validator, name);
61 }
62
63 bool Create(wxWindow *parent, wxWindowID id,
64 const wxString& value = wxEmptyString,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize,
67 int n = 0, const wxString choices[] = NULL,
68 long style = 0,
69 const wxValidator& validator = wxDefaultValidator,
70 const wxString& name = wxComboBoxNameStr);
71 bool Create(wxWindow *parent, wxWindowID id,
72 const wxString& value,
73 const wxPoint& pos,
74 const wxSize& size,
75 const wxArrayString& choices,
76 long style = 0,
77 const wxValidator& validator = wxDefaultValidator,
78 const wxString& name = wxComboBoxNameStr);
79
80 // List functions
81 virtual void Delete(unsigned int n);
82 virtual void Clear();
83
84 virtual int GetSelection() const ;
85 virtual void SetSelection(int n);
86 virtual int FindString(const wxString& s, bool bCase = false) const;
87 virtual wxString GetString(unsigned int n) const ;
88 virtual wxString GetStringSelection() const ;
89 virtual void SetString(unsigned int n, const wxString& s);
90
91 // Text field functions
92 virtual wxString GetValue() const ;
93 virtual void SetValue(const wxString& value);
94
95 // Clipboard operations
96 virtual void Copy();
97 virtual void Cut();
98 virtual void Paste();
99 virtual void SetInsertionPoint(long pos);
100 virtual void SetInsertionPointEnd();
101 virtual long GetInsertionPoint() const ;
102 virtual wxTextPos GetLastPosition() const ;
103 virtual void Replace(long from, long to, const wxString& value);
104 virtual void Remove(long from, long to);
105 virtual void SetSelection(long from, long to);
106 virtual void SetEditable(bool editable);
107 virtual unsigned int GetCount() const { return m_choice->GetCount() ; }
108
109 virtual bool IsEditable() const ;
110
111 virtual void Undo() ;
112 virtual void Redo() ;
113 virtual void SelectAll() ;
114
115 virtual bool CanCopy() const ;
116 virtual bool CanCut() const ;
117 virtual bool CanPaste() const ;
118 virtual bool CanUndo() const ;
119 virtual bool CanRedo() const ;
120
121 void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
122
123 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
124
125 protected:
126 virtual int DoAppend(const wxString& item) ;
127 virtual int DoInsert(const wxString& item, unsigned int pos) ;
128
129 virtual void DoSetItemClientData(unsigned int n, void* clientData);
130 virtual void* DoGetItemClientData(unsigned int n) const ;
131 virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
132 virtual wxClientData* DoGetItemClientObject(unsigned int n) const ;
133
134 void FreeData();
135
136 // the subcontrols
137 wxTextCtrl* m_text;
138 wxChoice* m_choice;
139 };
140
141 #endif
142 // _WX_COMBOBOX_H_