]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
f6bcfd97 | 2 | // Name: wx/msw/combobox.h |
2bda0e17 KB |
3 | // Purpose: wxComboBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_COMBOBOX_H_ |
13 | #define _WX_COMBOBOX_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
4438caf4 | 16 | #pragma interface "combobox.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
19 | #include "wx/choice.h" | |
20 | ||
47d67540 | 21 | #if wxUSE_COMBOBOX |
2bda0e17 | 22 | |
4438caf4 VZ |
23 | // ---------------------------------------------------------------------------- |
24 | // Combobox control | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
2bda0e17 KB |
27 | class WXDLLEXPORT wxComboBox: public wxChoice |
28 | { | |
4438caf4 | 29 | public: |
13bcc348 | 30 | wxComboBox() { Init(); } |
4438caf4 VZ |
31 | |
32 | wxComboBox(wxWindow *parent, wxWindowID id, | |
33 | const wxString& value = wxEmptyString, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | int n = 0, const wxString choices[] = NULL, | |
37 | long style = 0, | |
38 | const wxValidator& validator = wxDefaultValidator, | |
6463b9f5 JS |
39 | const wxString& name = wxComboBoxNameStr) |
40 | { | |
13bcc348 VZ |
41 | Init(); |
42 | ||
6463b9f5 JS |
43 | Create(parent, id, value, pos, size, n, choices, style, validator, name); |
44 | } | |
584ad2a3 MB |
45 | wxComboBox(wxWindow *parent, wxWindowID id, |
46 | const wxString& value, | |
47 | const wxPoint& pos, | |
48 | const wxSize& size, | |
49 | const wxArrayString& choices, | |
50 | long style = 0, | |
51 | const wxValidator& validator = wxDefaultValidator, | |
52 | const wxString& name = wxComboBoxNameStr) | |
53 | { | |
13bcc348 VZ |
54 | Init(); |
55 | ||
584ad2a3 MB |
56 | Create(parent, id, value, pos, size, choices, style, validator, name); |
57 | } | |
4438caf4 | 58 | |
f6bcfd97 BP |
59 | bool Create(wxWindow *parent, |
60 | wxWindowID id, | |
61 | const wxString& value = wxEmptyString, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | int n = 0, | |
65 | const wxString choices[] = NULL, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxComboBoxNameStr); | |
584ad2a3 MB |
69 | bool Create(wxWindow *parent, |
70 | wxWindowID id, | |
71 | const wxString& value, | |
72 | const wxPoint& pos, | |
73 | const wxSize& size, | |
74 | const wxArrayString& choices, | |
75 | long style = 0, | |
76 | const wxValidator& validator = wxDefaultValidator, | |
77 | const wxString& name = wxComboBoxNameStr); | |
4438caf4 VZ |
78 | |
79 | // List functions: see wxChoice | |
80 | ||
81 | // Text field functions | |
13bcc348 | 82 | wxString GetValue() const { return m_value; } |
4438caf4 VZ |
83 | virtual void SetValue(const wxString& value); |
84 | ||
85 | // Clipboard operations | |
86 | virtual void Copy(); | |
87 | virtual void Cut(); | |
88 | virtual void Paste(); | |
150e31d2 JS |
89 | virtual bool CanCopy() const; |
90 | virtual bool CanCut() const; | |
91 | virtual bool CanPaste() const; | |
4438caf4 VZ |
92 | virtual void SetInsertionPoint(long pos); |
93 | virtual void SetInsertionPointEnd(); | |
94 | virtual long GetInsertionPoint() const; | |
7d8268a1 | 95 | virtual wxTextPos GetLastPosition() const; |
4438caf4 VZ |
96 | virtual void Replace(long from, long to, const wxString& value); |
97 | virtual void Remove(long from, long to); | |
98 | virtual void SetSelection(int n) { wxChoice::SetSelection(n); } | |
99 | virtual void SetSelection(long from, long to); | |
3f5ca6b1 RN |
100 | virtual int GetSelection() const; |
101 | virtual void GetSelection(long* from, long* to) const; | |
4438caf4 | 102 | virtual void SetEditable(bool editable); |
2549081b | 103 | virtual void Clear() { wxChoice::Clear(); m_selectionOld = -1; } |
4438caf4 | 104 | |
150e31d2 JS |
105 | virtual void Undo() ; |
106 | virtual void Redo() ; | |
107 | virtual bool CanUndo() const; | |
108 | virtual bool CanRedo() const; | |
109 | virtual void SelectAll(); | |
110 | virtual bool IsEditable() const ; | |
111 | virtual bool HasSelection() const; | |
112 | ||
f6bcfd97 | 113 | // implementation only from now on |
4438caf4 | 114 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
f6bcfd97 | 115 | bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); |
c140b7e7 | 116 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
3a7d5f7c | 117 | |
f6bcfd97 | 118 | WXHWND GetEditHWND() const; |
fc7a2a60 | 119 | |
150e31d2 JS |
120 | // Standard event handling |
121 | void OnCut(wxCommandEvent& event); | |
122 | void OnCopy(wxCommandEvent& event); | |
123 | void OnPaste(wxCommandEvent& event); | |
124 | void OnUndo(wxCommandEvent& event); | |
125 | void OnRedo(wxCommandEvent& event); | |
126 | void OnDelete(wxCommandEvent& event); | |
127 | void OnSelectAll(wxCommandEvent& event); | |
128 | ||
129 | void OnUpdateCut(wxUpdateUIEvent& event); | |
130 | void OnUpdateCopy(wxUpdateUIEvent& event); | |
131 | void OnUpdatePaste(wxUpdateUIEvent& event); | |
132 | void OnUpdateUndo(wxUpdateUIEvent& event); | |
133 | void OnUpdateRedo(wxUpdateUIEvent& event); | |
134 | void OnUpdateDelete(wxUpdateUIEvent& event); | |
135 | void OnUpdateSelectAll(wxUpdateUIEvent& event); | |
136 | ||
71e57cd6 VZ |
137 | protected: |
138 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
139 | ||
13bcc348 VZ |
140 | // common part of all ctors |
141 | void Init() { m_selectionOld = -1; } | |
142 | ||
143 | ||
144 | // the previous selection (see MSWCommand() to see why it is needed) | |
145 | int m_selectionOld; | |
146 | ||
147 | // the current selection (also see MSWCommand()) | |
148 | wxString m_value; | |
149 | ||
fc7a2a60 VZ |
150 | private: |
151 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) | |
150e31d2 | 152 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
153 | }; |
154 | ||
47d67540 | 155 | #endif // wxUSE_COMBOBOX |
2bda0e17 | 156 | #endif |
bbcdf8bc | 157 | // _WX_COMBOBOX_H_ |