]> git.saurik.com Git - wxWidgets.git/commitdiff
Solved a bug in generic wxTreeCtrl whereby CalculatePositions was not completing
authorJulian Smart <julian@anthemion.co.uk>
Fri, 18 Dec 1998 18:22:43 +0000 (18:22 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 18 Dec 1998 18:22:43 +0000 (18:22 +0000)
due to a missing '!', so scrollbars were not set properly. Tidied up wxMotif
scrollbar setting.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/motif.rsp
docs/motif/changes.txt
src/generic/treectrl.cpp
src/motif/window.cpp

index 13158238aff71b05dbcd7fae2566e16e208dbb81..356a7bfab7228ca17236328d1e6762f935855164 100644 (file)
@@ -6,6 +6,7 @@ config.guess
 config.sub
 wx-config.in
 mkinstalldirs
 config.sub
 wx-config.in
 mkinstalldirs
+wxinstall
 
 src/makeenvs/*.env
 
 
 src/makeenvs/*.env
 
index 000fb7f9c02239c02dfabba93586057bd965fb12..0ea25952168c757080952044f4b5feffc57794ab 100644 (file)
@@ -89,3 +89,4 @@ More recently:
 - Fixed a bug in wxStaticBox.
 - Controls sample runs, though wxRadioBox doesn't appear and
   the notebook flickers for a while.
 - Fixed a bug in wxStaticBox.
 - Controls sample runs, though wxRadioBox doesn't appear and
   the notebook flickers for a while.
+- Cured wxTreeCtrl bug: now works pretty well!
\ No newline at end of file
index 1f986f385b2f3770adcf1a1d2d98308caf053996..775eadb61c8e72b6d23c3c469c3c4d5785c67bf9 100644 (file)
@@ -779,6 +779,7 @@ void wxTreeCtrl::Expand(const wxTreeItemId& itemId)
   }
 
   item->Expand();
   }
 
   item->Expand();
+  CalculatePositions();
 
   RefreshSubtree(item);
 
 
   RefreshSubtree(item);
 
@@ -890,7 +891,7 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item)
         m_anchor->GetSize( x, y );
         y += 2*m_lineHeight;
         int x_pos = GetScrollPos( wxHORIZONTAL );
         m_anchor->GetSize( x, y );
         y += 2*m_lineHeight;
         int x_pos = GetScrollPos( wxHORIZONTAL );
-        SetScrollbars( 10, 10, x/10, y/10, x_pos, item_y/10 );
+       SetScrollbars( 10, 10, x/10, y/10, x_pos, item_y/10 );
         return;
     }
 
         return;
     }
 
@@ -1381,8 +1382,10 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item,
   item->SetY( y-m_lineHeight/3-2 );
   item->SetHeight( m_lineHeight );
 
   item->SetY( y-m_lineHeight/3-2 );
   item->SetHeight( m_lineHeight );
 
-  if ( item->IsExpanded() )
-    return;
+  //  if ( item->IsExpanded() )
+  //    return;
+  if ( !item->IsExpanded() ) // Surely this is correct? JACS
+     return;
 
   wxArrayTreeItems& children = item->GetChildren();
   size_t count = children.Count();
 
   wxArrayTreeItems& children = item->GetChildren();
   size_t count = children.Count();
index 3d78814a448c77a22aa1e16e15979e1dc169b696..545f469e13be402a8362daedcf3ebc74d37e5f9e 100644 (file)
@@ -370,6 +370,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
                                            xmScrolledWindowWidgetClass, m_borderWidget ? (Widget) m_borderWidget : parentWidget,
                                   XmNspacing, 0,
                                  XmNscrollingPolicy, XmAPPLICATION_DEFINED,
                                            xmScrolledWindowWidgetClass, m_borderWidget ? (Widget) m_borderWidget : parentWidget,
                                   XmNspacing, 0,
                                  XmNscrollingPolicy, XmAPPLICATION_DEFINED,
+ //                                  XmNscrollBarDisplayPolicy, XmAS_NEEDED,
                                            NULL);
 
   XtTranslations ptr;
                                            NULL);
 
   XtTranslations ptr;
@@ -1174,6 +1175,9 @@ void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
     if (thumbVisible == 0)
       thumbVisible = 1;
 
     if (thumbVisible == 0)
       thumbVisible = 1;
 
+    if (thumbVisible > range)
+      thumbVisible = range;
+
     XtVaSetValues(scrollBar,
          XmNvalue, pos,
          XmNminimum, 0,
     XtVaSetValues(scrollBar,
          XmNvalue, pos,
          XmNminimum, 0,
@@ -1185,6 +1189,66 @@ void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
         m_scrollPosX = pos;
     else
         m_scrollPosY = pos;
         m_scrollPosX = pos;
     else
         m_scrollPosY = pos;
+
+    // See notes below. If the scrollbars didn't leave a ghost presence,
+    // this would be OK.
+#if 0
+    if (range == thumbVisible)
+    {
+        XtUnmanageChild(scrollBar);
+        if (orient == wxHORIZONTAL)
+          XtVaSetValues((Widget) m_scrolledWindow,
+             XmNhorizontalScrollBar, (Widget) 0,
+             NULL);
+        else
+          XtVaSetValues((Widget) m_scrolledWindow,
+             XmNverticalScrollBar, (Widget) 0,
+             NULL);
+    }
+    else
+    {
+        XtManageChild(scrollBar);
+        if (orient == wxHORIZONTAL)
+          XtVaSetValues((Widget) m_scrolledWindow,
+             XmNhorizontalScrollBar, (Widget) m_hScrollBar,
+             NULL);
+        else
+          XtVaSetValues((Widget) m_scrolledWindow,
+             XmNverticalScrollBar, (Widget) m_vScrollBar,
+             NULL);
+    }
+#else
+    // Either both scrollbars are on, or they are off,
+    // otherwise you get a gap where one scrollbar
+    // isn't shown. TODO: try to eliminate this problem.
+    if ((GetScrollThumb(wxHORIZONTAL) >= GetScrollRange(wxHORIZONTAL)) && 
+        (GetScrollThumb(wxVERTICAL) >= GetScrollRange(wxVERTICAL)))
+    {
+        if (m_hScrollBar)
+            XtUnmanageChild((Widget) m_hScrollBar);
+        if (m_vScrollBar)
+            XtUnmanageChild((Widget) m_vScrollBar);
+        XtVaSetValues((Widget) m_scrolledWindow,
+           XmNhorizontalScrollBar, (Widget) 0,
+           XmNverticalScrollBar, (Widget) 0,
+           NULL);
+                     //        XmScrolledWindowSetAreas((Widget) m_scrolledWindow,
+                     //           (Widget) 0, (Widget) 0, (Widget) m_drawingArea);
+    }
+    else
+    {
+        if (m_hScrollBar)
+            XtManageChild((Widget) m_hScrollBar);
+        if (m_vScrollBar)
+            XtManageChild((Widget) m_vScrollBar);
+        XtVaSetValues((Widget) m_scrolledWindow,
+           XmNhorizontalScrollBar, (Widget) m_hScrollBar,
+           XmNverticalScrollBar, (Widget) m_vScrollBar,
+           NULL);
+       //        XmScrolledWindowSetAreas((Widget) m_scrolledWindow,
+       //           (Widget) m_hScrollBar, (Widget) m_vScrollBar, (Widget) m_drawingArea);
+    }
+#endif
 }
 
 // Does a physical scroll
 }
 
 // Does a physical scroll