]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/scrlwing.cpp
adding OS level Window Menu by default
[wxWidgets.git] / src / generic / scrlwing.cpp
index 4578f661933037ec4b1cac8dc855217d3ffb19ac..7c21cb2f1d09e84191a53adb4216ab7935b85eb7 100644 (file)
@@ -365,7 +365,11 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX,
 
     // The above should arguably be deprecated, this however we still need.
 
-    m_targetWindow->SetVirtualSize( w, h );
+    // take care not to set 0 virtual size, 0 means that we don't have any
+    // scrollbars and hence we should use the real size instead of the virtual
+    // one which is indicated by using wxDefaultCoord
+    m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord,
+                                    h ? h : wxDefaultCoord);
 
     if (do_refresh && !noRefresh)
         m_targetWindow->Refresh(true, GetScrollRect());
@@ -420,6 +424,9 @@ void wxScrollHelper::SetWindow(wxWindow *win)
 void wxScrollHelper::DoSetTargetWindow(wxWindow *target)
 {
     m_targetWindow = target;
+#ifdef __WXMAC__
+    target->MacSetClipChildren( true ) ;
+#endif
 
     // install the event handler which will intercept the events we're
     // interested in (but only do it for our real window, not the target window
@@ -642,8 +649,13 @@ void wxScrollHelper::AdjustScrollbars()
     //     it here for now but it would be better to ensure that all ports
     //     generate EVT_SIZE when scrollbars [dis]appear, emulating it if
     //     necessary, and remove it later
+    // JACS: Stop potential infinite loop by limiting number of iterations
+    int iterationCount = 0;
+    const int iterationMax = 5;
     do
     {
+        iterationCount ++;
+        
         GetTargetSize(&w, 0);
 
         // scroll lines per page: if 0, no scrolling is needed
@@ -755,7 +767,7 @@ void wxScrollHelper::AdjustScrollbars()
         oldh = h;
 
         GetTargetSize( &w, &h );
-    } while ( w != oldw || h != oldh );
+    } while ( (w != oldw || h != oldh) && (iterationCount < iterationMax) );
 
 #ifdef __WXMOTIF__
     // Sorry, some Motif-specific code to implement a backing pixmap
@@ -1246,6 +1258,9 @@ bool wxGenericScrolledWindow::Create(wxWindow *parent,
                               const wxString& name)
 {
     m_targetWindow = this;
+#ifdef __WXMAC__
+    MacSetClipChildren( true ) ;
+#endif
 
     bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name);