]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/combobox.h
7d1b7b702569ba4734748a6e5cf58c671a529193
[wxWidgets.git] / include / wx / msw / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
14
15 #include "wx/choice.h"
16 #include "wx/textentry.h"
17
18 #if wxUSE_COMBOBOX
19
20 // ----------------------------------------------------------------------------
21 // Combobox control
22 // ----------------------------------------------------------------------------
23
24 class WXDLLEXPORT wxComboBox : public wxChoice,
25 public wxTextEntry
26 {
27 public:
28 wxComboBox() { }
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,
37 const wxString& name = wxComboBoxNameStr)
38 {
39 Create(parent, id, value, pos, size, n, choices, style, validator, name);
40 }
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 }
52
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);
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);
72
73 // resolve ambiguities among virtual functions inherited from both base
74 // classes
75 virtual void Clear();
76 virtual void SetValue(const wxString& value);
77 virtual wxString GetStringSelection() const
78 { return wxChoice::GetStringSelection(); }
79
80 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
81 virtual void SetSelection(long from, long to)
82 { wxTextEntry::SetSelection(from, to); }
83 virtual int GetSelection() const { return wxChoice::GetSelection(); }
84 virtual void GetSelection(long *from, long *to) const
85 { wxTextEntry::GetSelection(from, to); }
86
87 virtual bool IsEditable() const;
88
89 // implementation only from now on
90 virtual bool MSWCommand(WXUINT param, WXWORD id);
91 bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
92 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
93 bool MSWShouldPreProcessMessage(WXMSG *pMsg);
94
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
112 protected:
113 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
114
115 #if wxUSE_TOOLTIPS
116 virtual void DoSetToolTip(wxToolTip *tip);
117 #endif
118
119 virtual WXHWND GetEditHWND() const;
120
121 private:
122 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
123 DECLARE_EVENT_TABLE()
124 };
125
126 #endif // wxUSE_COMBOBOX
127
128 #endif // _WX_COMBOBOX_H_