- SetFont(* parent->GetFont());
- int i;
- for (i = 0; i < n; i++)
- SendMessage(wx_combo, CB_INSERTSTRING, i, (LONG)(const char *)choices[i]);
- SendMessage(wx_combo, CB_SETCURSEL, i, 0);
+ wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
+
+ return (WXHBRUSH)brush->GetResourceHandle();
+}
+
+// ----------------------------------------------------------------------------
+// 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);
+
+ case WM_SETFOCUS:
+ return HandleSetFocus((WXHWND)wParam);
+
+ case WM_KILLFOCUS:
+ return HandleKillFocus((WXHWND)wParam);
+ }
+
+ 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:
+ {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+
+ // 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)
+ if ( sel == -1 )
+ {
+ value = GetValue();
+ }
+ else // we're synthesizing text updated event from sel change
+ {
+ // we need to do this because the user code expects
+ // wxComboBox::GetValue() to return the new value from
+ // "text updated" handler but it hadn't been updated yet
+ SetValue(value);
+ }
+
+ event.SetString(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;
+}