]> git.saurik.com Git - wxWidgets.git/commitdiff
got rid of wxWindow::m_lDlgCode - now wxWANTS_CHARS style should work for all windows...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 6 Feb 2002 00:58:11 +0000 (00:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 6 Feb 2002 00:58:11 +0000 (00:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/scrolwin.h
include/wx/msw/textctrl.h
include/wx/msw/window.h
src/generic/scrlwing.cpp
src/msw/listctrl.cpp
src/msw/textctrl.cpp
src/msw/window.cpp

index ecf2c8fa2691f08648d14be76fa14b88ccf11b3a..5e092a91a9318f9ec9994911d103eacc018cff87 100644 (file)
@@ -42,7 +42,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
 class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
                                             public wxScrollHelper
 {
- public:
+public:
     wxGenericScrolledWindow() : wxScrollHelper(this) { }
     wxGenericScrolledWindow(wxWindow *parent,
                      wxWindowID id = -1,
@@ -71,6 +71,12 @@ protected:
     // wxScrollHelperEvtHandler::ProcessEvent()
     void OnPaint(wxPaintEvent& event);
 
+    // we need to return a special WM_GETDLGCODE value to process just the
+    // arrows but let the other navigation characters through
+#ifdef __WXMSW__
+    virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+#endif // __WXMSW__
+
 private:
     DECLARE_ABSTRACT_CLASS(wxGenericScrolledWindow)
     DECLARE_EVENT_TABLE()
index 270a4550e65ef9426d881e61cc1d522e1e084b17..cfac8c5f4b5e5999f44848ef5ff5ace7da43b0cb 100644 (file)
@@ -171,6 +171,9 @@ protected:
     // common part of all ctors
     void Init();
 
+    // intercept WM_GETDLGCODE
+    virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+
     // call this to increase the size limit (will do nothing if the current
     // limit is big enough)
     //
index ec980f4392a8ed170516ed0f90e8ae3f923cc7db..d16f521fd619e03fa2240e2efa216afeca738a9a 100644 (file)
@@ -422,9 +422,6 @@ protected:
 
     WXHMENU               m_hMenu; // Menu, if any
 
-    // the return value of WM_GETDLGCODE handler
-    long m_lDlgCode;
-
     // implement the base class pure virtuals
     virtual void DoClientToScreen( int *x, int *y ) const;
     virtual void DoScreenToClient( int *x, int *y ) const;
index cf4792b5fc5a76a6cbc465aa55b43b13706b3369..cf18c3bf8c85016308642174b75157b03126e8e5 100644 (file)
@@ -1102,11 +1102,6 @@ bool wxGenericScrolledWindow::Create(wxWindow *parent,
 
     bool ok = wxPanel::Create(parent, id, pos, size, style, name);
 
-#ifdef __WXMSW__
-    // we need to process arrows ourselves for scrolling
-    m_lDlgCode |= DLGC_WANTARROWS;
-#endif // __WXMSW__
-
     return ok;
 }
 
@@ -1123,6 +1118,25 @@ void wxGenericScrolledWindow::OnPaint(wxPaintEvent& event)
     event.Skip();
 }
 
+#ifdef __WXMSW__
+long
+wxGenericScrolledWindow::MSWWindowProc(WXUINT nMsg,
+                                       WXWPARAM wParam,
+                                       WXLPARAM lParam)
+{
+    long rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam);
+
+    // we need to process arrows ourselves for scrolling
+    if ( nMsg == WM_GETDLGCODE )
+    {
+        rc |= DLGC_WANTARROWS;
+    }
+
+    return rc;
+}
+
+#endif // __WXMSW__
+
 #if WXWIN_COMPATIBILITY
 
 void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const
index b21c61756cd06b6f9ac6ac93d08d7a3d0e497bd4..91284a31d6abc16d72f39d3ee6de0873329a7826 100644 (file)
@@ -1501,7 +1501,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     // if your compiler is as broken as this, you should really change it: this
     // code is needed for normal operation! #ifdef below is only useful for
     // automatic rebuilds which are done with a very old compiler version
-#ifdef LVM_FIRST
+#ifdef HDN_BEGINTRACKA
 
     // check for messages from the header (in report view)
     HWND hwndHdr = ListView_GetHeader(GetHwnd());
@@ -1509,11 +1509,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     // is it a message from the header?
     if ( nmhdr->hwndFrom == hwndHdr )
     {
-#ifdef __WATCOMC__
         HD_NOTIFY *nmHDR = (HD_NOTIFY *)nmhdr;
-#else
-        NMHEADER *nmHDR = (NMHEADER *)nmhdr;
-#endif
+
         event.m_itemIndex = -1;
 
         switch ( nmhdr->code )
@@ -1589,7 +1586,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
         }
     }
     else
-#endif // defined(LVM_FIRST)
+#endif // defined(HDN_BEGINTRACKA)
         if ( nmhdr->hwndFrom == GetHwnd() )
     {
         // almost all messages use NM_LISTVIEW
index 852d725fb51528d810a092c9d479917060991ae3..6f16032cc9f290dfc25cf3158cc43303e411fc7d 100644 (file)
@@ -234,21 +234,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     if ( m_windowStyle & wxTE_NOHIDESEL )
         msStyle |= ES_NOHIDESEL;
 
-    // we always want the characters and the arrows
-    m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
-
-    // we may have several different cases:
-    // 1. normal case: both TAB and ENTER are used for dialog navigation
-    // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
-    //    control in the dialog
-    // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
-    // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
-    //    the next control
-    if ( m_windowStyle & wxTE_PROCESS_ENTER )
-        m_lDlgCode |= DLGC_WANTMESSAGE;
-    if ( m_windowStyle & wxTE_PROCESS_TAB )
-        m_lDlgCode |= DLGC_WANTTAB;
-
     // do create the control - either an EDIT or RICHEDIT
     wxString windowClass = wxT("EDIT");
 
@@ -1173,6 +1158,32 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
     event.Skip();
 }
 
+long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+    // we always want the characters and the arrows
+    if ( nMsg == WM_GETDLGCODE )
+    {
+        // we always want the chars and the arrows
+        long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
+
+        // we may have several different cases:
+        // 1. normal case: both TAB and ENTER are used for dialog navigation
+        // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
+        //    control in the dialog
+        // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
+        // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
+        //    the next control
+        if ( m_windowStyle & wxTE_PROCESS_ENTER )
+            lDlgCode |= DLGC_WANTMESSAGE;
+        if ( m_windowStyle & wxTE_PROCESS_TAB )
+            lDlgCode |= DLGC_WANTTAB;
+
+        return lDlgCode;
+    }
+
+    return wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
+}
+
 bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 {
     switch (param)
index 285299a2ff7f5e9a7207caa13511a5ae07f86394..0d91882294aa19ecae29c400ee402708577d1466 100644 (file)
@@ -303,9 +303,6 @@ void wxWindowMSW::Init()
 
     m_hWnd = 0;
 
-    // pass WM_GETDLGCODE to DefWindowProc()
-    m_lDlgCode = 0;
-
     m_xThumbSize = 0;
     m_yThumbSize = 0;
     m_backgroundTransparent = FALSE;
@@ -415,14 +412,6 @@ bool wxWindowMSW::Create(wxWindow *parent,
     {
         msflags |= WS_BORDER;
     }
-
-    // calculate the value to return from WM_GETDLGCODE handler
-    if ( GetWindowStyleFlag() & wxWANTS_CHARS )
-    {
-        // want everything: i.e. all keys and WM_CHAR message
-        m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
-                     DLGC_WANTTAB | DLGC_WANTMESSAGE;
-    }
 #endif // wxUniversal/!wxUniversal
 
     if ( style & wxPOPUP_WINDOW )
@@ -2369,9 +2358,11 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif // defined(WM_DRAWITEM)
 
         case WM_GETDLGCODE:
-            if ( m_lDlgCode )
+            if ( GetWindowStyleFlag() & wxWANTS_CHARS )
             {
-                rc.result = m_lDlgCode;
+                // want everything: i.e. all keys and WM_CHAR message
+                rc.result = DLGC_WANTARROWS | DLGC_WANTCHARS |
+                            DLGC_WANTTAB | DLGC_WANTMESSAGE;
                 processed = TRUE;
             }
             //else: get the dlg code from the DefWindowProc()