]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
header files for carbon targets
[wxWidgets.git] / src / generic / treectlg.cpp
index 4f5cd2480249778dbc27f6b96bd7f51d5c4337fa..76bf9030ab17a773e8f93d39a57c6b91817ca2dc 100644 (file)
@@ -84,7 +84,7 @@ public:
                     const wxString &value = wxEmptyString,
                     const wxPoint &pos = wxDefaultPosition,
                     const wxSize &size = wxDefaultSize,
-                    int style = 0,
+                    int style = wxSIMPLE_BORDER,
                     const wxValidator& validator = wxDefaultValidator,
                     const wxString &name = wxTextCtrlNameStr );
 
@@ -580,6 +580,15 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl,wxScrolledWindow)
     EVT_IDLE           (wxGenericTreeCtrl::OnIdle)
 END_EVENT_TABLE()
 
+#if !defined(__WXMSW__) || defined(__WIN16__)
+/*
+ * wxTreeCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxGenericTreeCtrl)
+#endif
+
 // -----------------------------------------------------------------------------
 // construction/destruction
 // -----------------------------------------------------------------------------
@@ -1687,6 +1696,8 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
     int exposed_x = dc.LogicalToDeviceX( 0 );
     int exposed_y = dc.LogicalToDeviceY( item->GetY() );
 
+    bool drawLines = ((GetWindowStyle() & wxTR_NO_LINES) == 0);
+
     if (IsExposed( exposed_x, exposed_y, 10000, GetLineHeight(item) ))  // 10000 = very much
     {
         int startX = horizX;
@@ -1695,11 +1706,13 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
 //        if (!item->HasChildren()) endX += (m_indent+5);
         if (!item->HasChildren()) endX += 20;
 
-        dc.DrawLine( startX, y, endX, y );
+        if (drawLines)
+            dc.DrawLine( startX, y, endX, y );
 
         if (item->HasPlus())
         {
-            dc.DrawLine( horizX+(m_indent+5), y, horizX+(m_indent+15), y );
+            if (drawLines)
+                dc.DrawLine( horizX+(m_indent+5), y, horizX+(m_indent+15), y );
             dc.SetPen( *wxGREY_PEN );
             dc.SetBrush( *wxWHITE_BRUSH );
             dc.DrawRectangle( horizX+(m_indent-5), y-4, 11, 9 );
@@ -1766,7 +1779,8 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
         if (count > 0)
         {
             semiOldY+=GetLineHeight(children[--n])/2;
-            dc.DrawLine( horizX+m_indent, oldY+5, horizX+m_indent, semiOldY );
+            if (drawLines)
+                dc.DrawLine( horizX+m_indent, oldY+5, horizX+m_indent, semiOldY );
         }
     }
 }
@@ -2095,6 +2109,27 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags)
     return m_anchor->HitTest( wxPoint(x, y), this, flags);
 }
 
+// get the bounding rectangle of the item (or of its label only)
+bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
+                         wxRect& rect,
+                         bool textOnly) const
+{
+    wxCHECK2_MSG( item.IsOk(), FALSE, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );
+
+    wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem;
+
+    int startX, startY;
+    GetViewStart(& startX, & startY);
+
+    rect.x = i->GetX() - startX*PIXELS_PER_UNIT; rect.y = i->GetY()*PIXELS_PER_UNIT;
+    rect.width = i->GetWidth(); rect.height = i->GetHeight();
+
+    return TRUE;
+
+    // wxFAIL_MSG(wxT("GetBoundingRect unimplemented"));
+    // return FALSE;
+}
+
 /* **** */
 
 void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )