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