+// ----------------------------------------------------------------------------
+// wxComboBox
+// ----------------------------------------------------------------------------
+
+bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ switch ( msg )
+ {
+ case WM_CHAR:
+ return HandleChar(wParam, lParam, TRUE /* isASCII */);
+
+ case WM_KEYDOWN:
+ return HandleKeyDown(wParam, lParam);
+
+ case WM_KEYUP:
+ return HandleKeyUp(wParam, lParam);
+ }
+
+ return FALSE;
+}
+
+bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
+{
+ wxString value;
+ int sel = -1;
+ switch ( param )
+ {
+ case CBN_SELCHANGE:
+ sel = GetSelection();
+ if ( sel > -1 )
+ {
+ value = GetString(sel);
+
+ wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
+ event.SetInt(sel);
+ event.SetEventObject(this);
+ event.SetString(value);
+ ProcessCommand(event);
+ }
+ else
+ {
+ break;
+ }
+
+ // fall through: for compability with wxGTK, also send the text
+ // update event when the selection changes (this also seems more
+ // logical as the text does change)
+
+ case CBN_EDITCHANGE:
+ {
+ // if sel != -1, value was initialized above (and we can't use
+ // GetValue() here as it would return the old selection and we
+ // want the new one)
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+ event.SetString(sel == -1 ? GetValue() : value);
+ event.SetEventObject(this);
+ ProcessCommand(event);
+ }
+ break;
+ }
+
+ // there is no return value for the CBN_ notifications, so always return
+ // FALSE from here to pass the message to DefWindowProc()
+ return FALSE;
+}
+
+WXHWND wxComboBox::GetEditHWND() const
+{
+ // this function should not be called for wxCB_READONLY controls, it is
+ // the callers responsability to check this
+ wxASSERT_MSG( !(GetWindowStyle() & wxCB_READONLY),
+ _T("read-only combobox doesn't have any edit control") );
+
+ POINT pt;
+ pt.x = pt.y = 4;
+ HWND hwndEdit = ::ChildWindowFromPoint(GetHwnd(), pt);
+ if ( !hwndEdit || hwndEdit == GetHwnd() )
+ {
+ wxFAIL_MSG(_T("not read only combobox without edit control?"));
+ }