]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
[ 1509599 ] 'Split pickers page in widgets sample' with more icons and rebaking.
[wxWidgets.git] / src / msw / combobox.cpp
index be00b321fe9c63a25420416de21b4122106462a7..41b73b447894ab39d9ed317dbd9c2d72aa572da1 100644 (file)
 
 #if wxUSE_COMBOBOX
 
+#include "wx/combobox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/settings.h"
     #include "wx/log.h"
     // for wxEVT_COMMAND_TEXT_ENTER
     #include "wx/textctrl.h"
+    #include "wx/app.h"
+    #include "wx/brush.h"
 #endif
 
-#include "wx/app.h"
-#include "wx/combobox.h"
-#include "wx/brush.h"
 #include "wx/clipbrd.h"
 #include "wx/msw/private.h"
 
+// include <commctrl.h> "properly"
+#include "wx/msw/wrapcctl.h"
+
 #if wxUSE_TOOLTIPS
-    #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
-        #include <commctrl.h>
-    #endif
     #include "wx/tooltip.h"
 #endif // wxUSE_TOOLTIPS
 
@@ -199,7 +200,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
             {
                 wxCHECK_MSG( win, 0, _T("should have a parent") );
 
-                if ( win->GetWindowStyle() & wxPROCESS_ENTER )
+                if ( win->GetWindowStyle() & wxTE_PROCESS_ENTER )
                 {
                     // need to return a custom dlg code or we'll never get it
                     return DLGC_WANTMESSAGE;
@@ -207,28 +208,12 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
             }
             break;
 
-        // 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 ( hdr->code == TTN_NEEDTEXT )
-                {
-                    wxToolTip *tooltip = win->GetToolTip();
-                    if ( tooltip )
-                    {
-                        TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
-                        ttt->lpszText = (wxChar *)tooltip->GetTip().c_str();
-                    }
-
-                    // processed
-                    return 0;
-                }
-            }
+        case WM_CUT:
+        case WM_COPY:
+        case WM_PASTE:
+            if( win->HandleClipboardEvent( message ) )
+                return 0;
             break;
-#endif // wxUSE_TOOLTIPS
     }
 
     return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
@@ -281,9 +266,12 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
             if ( wParam == VK_RETURN )
             {
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
-                InitCommandEvent(event);
+
+                const int sel = GetSelection();
+                event.SetInt(sel);
                 event.SetString(GetValue());
-                event.SetInt(GetSelection());
+                InitCommandEventWithItems(event, sel);
+
                 if ( ProcessCommand(event) )
                 {
                     // don't let the event through to the native control
@@ -335,9 +323,10 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
             value = GetStringSelection();
             {
                 wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
-                event.SetEventObject(this);
                 event.SetInt(sel);
                 event.SetString(value);
+                InitCommandEventWithItems(event, sel);
+
                 ProcessCommand(event);
             }
 
@@ -348,7 +337,6 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
         case CBN_EDITCHANGE:
             {
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
-                event.SetEventObject(this);
 
                 // if sel != -1, value was already initialized above
                 if ( sel == -1 )
@@ -357,6 +345,8 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
                 }
 
                 event.SetString(value);
+                InitCommandEventWithItems(event, sel);
+
                 ProcessCommand(event);
             }
             break;