]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/combobox.h
test ShowFullScreen() to verify that restoring menu works correctly
[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 WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
25 public wxTextEntry
26 {
27 public:
28 wxComboBox() { Init(); }
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 Init();
40 Create(parent, id, value, pos, size, n, choices, style, validator, name);
41
42 }
43
44 wxComboBox(wxWindow *parent, wxWindowID id,
45 const wxString& value,
46 const wxPoint& pos,
47 const wxSize& size,
48 const wxArrayString& choices,
49 long style = 0,
50 const wxValidator& validator = wxDefaultValidator,
51 const wxString& name = wxComboBoxNameStr)
52 {
53 Init();
54
55 Create(parent, id, value, pos, size, choices, style, validator, name);
56 }
57
58 bool Create(wxWindow *parent,
59 wxWindowID id,
60 const wxString& value = wxEmptyString,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 int n = 0,
64 const wxString choices[] = NULL,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr);
68 bool Create(wxWindow *parent,
69 wxWindowID id,
70 const wxString& value,
71 const wxPoint& pos,
72 const wxSize& size,
73 const wxArrayString& choices,
74 long style = 0,
75 const wxValidator& validator = wxDefaultValidator,
76 const wxString& name = wxComboBoxNameStr);
77
78 // resolve ambiguities among virtual functions inherited from both base
79 // classes
80 virtual void Clear();
81 virtual wxString GetValue() const;
82 virtual void SetValue(const wxString& value);
83 virtual wxString GetStringSelection() const
84 { return wxChoice::GetStringSelection(); }
85
86 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
87 virtual void SetSelection(long from, long to)
88 { wxTextEntry::SetSelection(from, to); }
89 virtual int GetSelection() const { return wxChoice::GetSelection(); }
90 virtual void GetSelection(long *from, long *to) const;
91
92 virtual bool IsEditable() const;
93
94 // implementation only from now on
95 virtual bool MSWCommand(WXUINT param, WXWORD id);
96 bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
97 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
98 bool MSWShouldPreProcessMessage(WXMSG *pMsg);
99
100 // Standard event handling
101 void OnCut(wxCommandEvent& event);
102 void OnCopy(wxCommandEvent& event);
103 void OnPaste(wxCommandEvent& event);
104 void OnUndo(wxCommandEvent& event);
105 void OnRedo(wxCommandEvent& event);
106 void OnDelete(wxCommandEvent& event);
107 void OnSelectAll(wxCommandEvent& event);
108
109 void OnUpdateCut(wxUpdateUIEvent& event);
110 void OnUpdateCopy(wxUpdateUIEvent& event);
111 void OnUpdatePaste(wxUpdateUIEvent& event);
112 void OnUpdateUndo(wxUpdateUIEvent& event);
113 void OnUpdateRedo(wxUpdateUIEvent& event);
114 void OnUpdateDelete(wxUpdateUIEvent& event);
115 void OnUpdateSelectAll(wxUpdateUIEvent& event);
116
117 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
118
119 protected:
120 #if wxUSE_TOOLTIPS
121 virtual void DoSetToolTip(wxToolTip *tip);
122 #endif
123
124 // this is the implementation of GetEditHWND() which can also be used when
125 // we don't have the edit control, it simply returns NULL then
126 //
127 // try not to use this function unless absolutely necessary (as in the
128 // message handling code where the edit control might not be created yet
129 // for the messages we receive during the control creation) as normally
130 // just testing for IsEditable() and using GetEditHWND() should be enough
131 WXHWND GetEditHWNDIfAvailable() const;
132
133 virtual void EnableTextChangedEvents(bool enable)
134 {
135 m_allowTextEvents = enable;
136 }
137
138 private:
139 // this is the overridden wxTextEntry method which should only be called
140 // when we do have an edit control so it asserts if this is not the case
141 virtual WXHWND GetEditHWND() const;
142
143 // common part of all ctors
144 void Init()
145 {
146 m_allowTextEvents = true;
147 }
148
149 // normally true, false if text events are currently disabled
150 bool m_allowTextEvents;
151
152 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
153 DECLARE_EVENT_TABLE()
154 };
155
156 #endif // wxUSE_COMBOBOX
157
158 #endif // _WX_COMBOBOX_H_