+// ----------------------------------------------------------------------------
+// function prototypes
+// ----------------------------------------------------------------------------
+
+LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam);
+
+// ---------------------------------------------------------------------------
+// global vars
+// ---------------------------------------------------------------------------
+
+// the pointer to standard radio button wnd proc
+static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wnd proc for subclassed edit control
+// ----------------------------------------------------------------------------
+
+LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ HWND hwndCombo = ::GetParent(hWnd);
+ wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo);
+
+ switch ( message )
+ {
+ // forward some messages to the combobox
+ case WM_KEYUP:
+ case WM_KEYDOWN:
+ case WM_CHAR:
+ {
+ wxComboBox *combo = wxDynamicCast(win, wxComboBox);
+ wxCHECK_MSG( combo, 0, _T("should have combo as parent") );
+
+ if ( combo->MSWProcessEditMsg(message, wParam, lParam) )
+ return 0;
+ }
+ break;
+
+#if 0
+ case WM_GETDLGCODE:
+ {
+ wxCHECK_MSG( win, 0, _T("should have a parent") );
+
+ if ( win->GetWindowStyle() & wxPROCESS_ENTER )
+ {
+ // need to return a custom dlg code or we'll never get it
+ return DLGC_WANTMESSAGE;
+ }
+ }
+ break;
+#endif // 0
+
+ // deal with tooltips here
+#if wxUSE_TOOLTIPS && defined(TTN_NEEDTEXT)
+ case WM_NOTIFY:
+ {
+ wxCHECK_MSG( win, 0, _T("should have a parent") );
+
+ NMHDR* hdr = (NMHDR *)lParam;
+ if ( (int)hdr->code == TTN_NEEDTEXT )
+ {
+ wxToolTip *tooltip = win->GetToolTip();
+ if ( tooltip )
+ {
+ TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
+ ttt->lpszText = (wxChar *)tooltip->GetTip().c_str();
+ }
+
+ // processed
+ return 0;
+ }
+ }
+ break;
+#endif // wxUSE_TOOLTIPS
+ }
+
+ return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
+}
+
+WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
+#if wxUSE_CTL3D
+ WXUINT message,
+ WXWPARAM wParam,
+ WXLPARAM lParam
+#else
+ WXUINT WXUNUSED(message),
+ WXWPARAM WXUNUSED(wParam),
+ WXLPARAM WXUNUSED(lParam)
+#endif
+ )
+{
+#if wxUSE_CTL3D
+ if ( m_useCtl3D )
+ {
+ HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
+ return (WXHBRUSH) hbrush;
+ }
+#endif // wxUSE_CTL3D
+
+ HDC hdc = (HDC)pDC;
+ if (GetParent()->GetTransparentBackground())
+ SetBkMode(hdc, TRANSPARENT);
+ else
+ SetBkMode(hdc, OPAQUE);
+
+ wxColour colBack = GetBackgroundColour();
+
+ if (!IsEnabled())
+ colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+
+ ::SetBkColor(hdc, wxColourToRGB(colBack));
+ ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+
+ 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);
+ }
+
+ return FALSE;
+}
+