]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/winuniv.cpp
Some fixes for wxURLDataObject when wxUSE_UNICODE==1
[wxWidgets.git] / src / univ / winuniv.cpp
index dbb420c484c78fcf24e4b33ff5d96105654a78fd..33de11472160ddb1cf092b05a2e52c6d88e59f05 100644 (file)
@@ -73,6 +73,8 @@
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowGTK)
 #elif defined(__WXMGL__)
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowMGL)
+#elif defined(__WXX11__)
+    IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowX11)
 #elif defined(__WXPM__)
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowOS2)
 #endif
@@ -761,6 +763,14 @@ int wxWindow::GetScrollRange(int orient) const
 
 void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
+    // use native scrolling when available and do it in generic way
+    // otherwise:
+#ifdef __WXX11__
+
+    wxWindowNative::ScrollWindow(dx, dy, rect);
+
+#else
+
     // before scrolling it, ensure that we don't have any unpainted areas
     Update();
 
@@ -777,6 +787,21 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
         r = ScrollNoRefresh(0, dy, rect);
         Refresh(TRUE /* erase bkgnd */, &r);
     }
+    
+    // scroll children accordingly:    
+    wxPoint offset(dx, dy);
+    
+    for (wxWindowList::Node *node = GetChildren().GetFirst(); 
+         node; node = node->GetNext())
+    {
+        wxWindow *child = node->GetData();
+        if ( child != m_scrollbarVert && child != m_scrollbarHorz &&      
+             (rect == NULL || rect->Intersects(child->GetRect())) )
+        {
+            child->Move(child->GetPosition() + offset);
+        }
+    }    
+#endif
 }
 
 wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
@@ -933,53 +958,6 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
     return rect;
 }
 
-// ----------------------------------------------------------------------------
-// mouse capture
-// ----------------------------------------------------------------------------
-
-struct WXDLLEXPORT wxWindowNext
-{
-    wxWindow *win;
-    wxWindowNext *next;
-} *wxWindow::ms_winCaptureNext = NULL;
-
-void wxWindow::CaptureMouse()
-{
-    wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
-
-    wxWindow *winOld = GetCapture();
-    if ( winOld )
-    {
-        // save it on stack
-        wxWindowNext *item = new wxWindowNext;
-        item->win = winOld;
-        item->next = ms_winCaptureNext;
-        ms_winCaptureNext = item;
-    }
-    //else: no mouse capture to save
-
-    wxWindowNative::CaptureMouse();
-}
-
-void wxWindow::ReleaseMouse()
-{
-    wxWindowNative::ReleaseMouse();
-
-    if ( ms_winCaptureNext )
-    {
-        ms_winCaptureNext->win->CaptureMouse();
-
-        wxWindowNext *item = ms_winCaptureNext;
-        ms_winCaptureNext = item->next;
-        delete item;
-    }
-    //else: stack is empty, no previous capture
-
-    wxLogTrace(_T("mousecapture"),
-               _T("After ReleaseMouse() mouse is captured by 0x%08x"),
-               GetCapture());
-}
-
 // ----------------------------------------------------------------------------
 // accelerators and menu hot keys
 // ----------------------------------------------------------------------------
@@ -1036,6 +1014,22 @@ void wxWindow::OnKeyDown(wxKeyEvent& event)
             }
 #endif // wxUSE_MENUS
 
+            // if it wasn't in a menu, try to find a button
+            if ( command != -1 )
+            {
+                wxWindow* child = win->FindWindow(command);
+                if ( child && wxDynamicCast(child, wxButton) )
+                {
+                    wxCommandEvent eventCmd(wxEVT_COMMAND_BUTTON_CLICKED, command);
+                    eventCmd.SetEventObject(child);
+                    if ( child->GetEventHandler()->ProcessEvent(eventCmd) )
+                    {
+                        // skip "event.Skip()" below
+                        return;
+                    }
+                }
+            }
+
             // don't propagate accels from the child frame to the parent one
             break;
         }
@@ -1121,3 +1115,29 @@ void wxWindow::OnKeyUp(wxKeyEvent& event)
 
 #endif // wxUSE_MENUS
 
+// ----------------------------------------------------------------------------
+// MSW-specific section
+// ----------------------------------------------------------------------------
+
+#ifdef __WXMSW__
+
+#include "wx/msw/private.h"
+
+long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+    if ( message == WM_NCHITTEST )
+    {
+        // the windows which contain the other windows should let the mouse
+        // events through, otherwise a window inside a static box would
+        // never get any events at all
+        if ( IsStaticBox() )
+        {
+            return HTTRANSPARENT;
+        }
+    }
+
+    return wxWindowNative::MSWWindowProc(message, wParam, lParam);
+}
+
+#endif // __WXMSW__
+