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