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