]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
wxMotif Solaris 2.6 compilation fixes
[wxWidgets.git] / src / msw / treectrl.cpp
index 577946bc0b925ae2ff0f44d9d394c6e4ff3ae1b2..061374546bba7d5291ce30a3a048fb62f64fa4fb 100644 (file)
 
 #include "wx/msw/private.h"
 
 
 #include "wx/msw/private.h"
 
+#ifdef __GNUWIN32__
+#include "wx/msw/gnuwin32/extra.h"
+#endif
+
 #if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
     #include <commctrl.h>
 #endif
 #if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
     #include <commctrl.h>
 #endif
@@ -136,7 +140,8 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
 
     m_windowId = (id == -1) ? NewControlId() : id;
 
 
     m_windowId = (id == -1) ? NewControlId() : id;
 
-    DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | TVS_HASLINES;
+    DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | TVS_HASLINES | TVS_SHOWSELALWAYS ;
+
 
     bool want3D;
     WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
 
     bool want3D;
     WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
@@ -463,11 +468,11 @@ wxTreeItemId wxTreeCtrl::GetLastChild(const wxTreeItemId& item) const
     long cookie;
 
     wxTreeItemId childLast,
     long cookie;
 
     wxTreeItemId childLast,
-    child = GetFirstChild(last, cookie);
+    child = GetFirstChild(item, cookie);
     while ( child.IsOk() )
     {
         childLast = child;
     while ( child.IsOk() )
     {
         childLast = child;
-        child = GetNextChild(last, cookie);
+        child = GetNextChild(item, cookie);
     }
 
     return childLast;
     }
 
     return childLast;
@@ -806,9 +811,29 @@ wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
     return wxTreeItemId((WXHTREEITEM) hitTestInfo.hItem);
 }
 
     return wxTreeItemId((WXHTREEITEM) hitTestInfo.hItem);
 }
 
+bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
+                                 wxRect& rect,
+                                 bool textOnly) const
+{
+    RECT rc;
+    if ( TreeView_GetItemRect(wxhWnd, (HTREEITEM)(WXHTREEITEM)item,
+                              &rc, textOnly) )
+    {
+        rect = wxRect(wxPoint(rc.left, rc.top), wxPoint(rc.right, rc.bottom));
+
+        return TRUE;
+    }
+    else
+    {
+        // couldn't retrieve rect: for example, item isn't visible
+        return FALSE;
+    }
+}
+
 // ----------------------------------------------------------------------------
 // sorting stuff
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // sorting stuff
 // ----------------------------------------------------------------------------
+
 static int CALLBACK TreeView_CompareCallback(wxTreeItemData *pItem1,
                                              wxTreeItemData *pItem2,
                                              wxTreeCtrl *tree)
 static int CALLBACK TreeView_CompareCallback(wxTreeItemData *pItem1,
                                              wxTreeItemData *pItem2,
                                              wxTreeCtrl *tree)