]>
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 | |
2bda0e17 | 15 | #include "wx/choice.h" |
74f35eea | 16 | #include "wx/textentry.h" |
2bda0e17 | 17 | |
47d67540 | 18 | #if wxUSE_COMBOBOX |
2bda0e17 | 19 | |
4438caf4 VZ |
20 | // ---------------------------------------------------------------------------- |
21 | // Combobox control | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
74f35eea VZ |
24 | class WXDLLEXPORT wxComboBox : public wxChoice, |
25 | public wxTextEntry | |
2bda0e17 | 26 | { |
4438caf4 | 27 | public: |
7d90194c | 28 | wxComboBox() { } |
4438caf4 VZ |
29 | |
30 | wxComboBox(wxWindow *parent, wxWindowID id, | |
31 | const wxString& value = wxEmptyString, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | int n = 0, const wxString choices[] = NULL, | |
35 | long style = 0, | |
36 | const wxValidator& validator = wxDefaultValidator, | |
6463b9f5 JS |
37 | const wxString& name = wxComboBoxNameStr) |
38 | { | |
39 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
40 | } | |
584ad2a3 MB |
41 | wxComboBox(wxWindow *parent, wxWindowID id, |
42 | const wxString& value, | |
43 | const wxPoint& pos, | |
44 | const wxSize& size, | |
45 | const wxArrayString& choices, | |
46 | long style = 0, | |
47 | const wxValidator& validator = wxDefaultValidator, | |
48 | const wxString& name = wxComboBoxNameStr) | |
49 | { | |
50 | Create(parent, id, value, pos, size, choices, style, validator, name); | |
51 | } | |
4438caf4 | 52 | |
f6bcfd97 BP |
53 | bool Create(wxWindow *parent, |
54 | wxWindowID id, | |
55 | const wxString& value = wxEmptyString, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | int n = 0, | |
59 | const wxString choices[] = NULL, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxComboBoxNameStr); | |
584ad2a3 MB |
63 | bool Create(wxWindow *parent, |
64 | wxWindowID id, | |
65 | const wxString& value, | |
66 | const wxPoint& pos, | |
67 | const wxSize& size, | |
68 | const wxArrayString& choices, | |
69 | long style = 0, | |
70 | const wxValidator& validator = wxDefaultValidator, | |
71 | const wxString& name = wxComboBoxNameStr); | |
4438caf4 | 72 | |
74f35eea VZ |
73 | // resolve ambiguities among virtual functions inherited from both base |
74 | // classes | |
e6a84162 | 75 | virtual void Clear(); |
e9717bd5 | 76 | virtual wxString GetValue() const; |
4438caf4 | 77 | virtual void SetValue(const wxString& value); |
74f35eea VZ |
78 | virtual wxString GetStringSelection() const |
79 | { return wxChoice::GetStringSelection(); } | |
4438caf4 | 80 | |
7d90194c | 81 | virtual void SetSelection(int n) { wxChoice::SetSelection(n); } |
74f35eea VZ |
82 | virtual void SetSelection(long from, long to) |
83 | { wxTextEntry::SetSelection(from, to); } | |
7d90194c | 84 | virtual int GetSelection() const { return wxChoice::GetSelection(); } |
e9717bd5 | 85 | virtual void GetSelection(long *from, long *to) const; |
74f35eea | 86 | |
7d90194c | 87 | virtual bool IsEditable() const; |
150e31d2 | 88 | |
f6bcfd97 | 89 | // implementation only from now on |
4438caf4 | 90 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
f6bcfd97 | 91 | bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); |
c140b7e7 | 92 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
90ac8b50 | 93 | bool MSWShouldPreProcessMessage(WXMSG *pMsg); |
fc7a2a60 | 94 | |
150e31d2 JS |
95 | // Standard event handling |
96 | void OnCut(wxCommandEvent& event); | |
97 | void OnCopy(wxCommandEvent& event); | |
98 | void OnPaste(wxCommandEvent& event); | |
99 | void OnUndo(wxCommandEvent& event); | |
100 | void OnRedo(wxCommandEvent& event); | |
101 | void OnDelete(wxCommandEvent& event); | |
102 | void OnSelectAll(wxCommandEvent& event); | |
103 | ||
104 | void OnUpdateCut(wxUpdateUIEvent& event); | |
105 | void OnUpdateCopy(wxUpdateUIEvent& event); | |
106 | void OnUpdatePaste(wxUpdateUIEvent& event); | |
107 | void OnUpdateUndo(wxUpdateUIEvent& event); | |
108 | void OnUpdateRedo(wxUpdateUIEvent& event); | |
109 | void OnUpdateDelete(wxUpdateUIEvent& event); | |
110 | void OnUpdateSelectAll(wxUpdateUIEvent& event); | |
111 | ||
71e57cd6 VZ |
112 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
113 | ||
3c75d8ba | 114 | protected: |
d6b9cc87 VZ |
115 | #if wxUSE_TOOLTIPS |
116 | virtual void DoSetToolTip(wxToolTip *tip); | |
117 | #endif | |
118 | ||
e9717bd5 VZ |
119 | // this is the implementation of GetEditHWND() which can also be used when |
120 | // we don't have the edit control, it simply returns NULL then | |
121 | // | |
122 | // try not to use this function unless absolutely necessary (as in the | |
123 | // message handling code where the edit control might not be created yet | |
124 | // for the messages we receive during the control creation) as normally | |
125 | // just testing for IsEditable() and using GetEditHWND() should be enough | |
126 | WXHWND GetEditHWNDIfAvailable() const; | |
127 | ||
fc7a2a60 | 128 | private: |
3c75d8ba PC |
129 | // this is the overridden wxTextEntry method which should only be called |
130 | // when we do have an edit control so it asserts if this is not the case | |
131 | virtual WXHWND GetEditHWND() const; | |
132 | ||
fc7a2a60 | 133 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) |
150e31d2 | 134 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
135 | }; |
136 | ||
47d67540 | 137 | #endif // wxUSE_COMBOBOX |
74f35eea VZ |
138 | |
139 | #endif // _WX_COMBOBOX_H_ |