]> git.saurik.com Git - wxWidgets.git/commitdiff
Generic tree control fixes
authorJulian Smart <julian@anthemion.co.uk>
Fri, 4 Aug 2000 15:23:28 +0000 (15:23 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 4 Aug 2000 15:23:28 +0000 (15:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/treectlg.h
include/wx/treectrl.h
samples/treectrl/treectrl.cpp
src/generic/treectlg.cpp

index 4d48f81cde1220ebad88e95b9ff9965f2d0424ff..6b661d238bf5e08bd50a9cceb5c985fca90c0ae7 100644 (file)
@@ -13,7 +13,7 @@
 #define _GENERIC_TREECTRL_H_
 
 #ifdef __GNUG__
-    #pragma interface "treectrg.h"
+    #pragma interface "treectlg.h"
 #endif
 
 #include "wx/defs.h"
@@ -394,5 +394,32 @@ private:
     DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
 };
 
+#if !defined(__WXMSW__) || defined(__WIN16__)
+/*
+ * wxTreeCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl
+{
+public:
+    DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
+
+    wxTreeCtrl() {}
+
+    wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
+               const wxPoint& pos = wxDefaultPosition,
+               const wxSize& size = wxDefaultSize,
+               long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
+               const wxValidator &validator = wxDefaultValidator,
+               const wxString& name = wxTreeCtrlNameStr)
+    {
+        Create(parent, id, pos, size, style, validator, name);
+    }
+
+};
+
+#endif
+
 #endif // _GENERIC_TREECTRL_H_
 
index b30804c1e8f17e3101f294da0265c80d219b85cd..1a2cc60c1c4651c70a1288122a90ad31ae89092f 100644 (file)
     #include "wx/generic/treectlg.h"
 #endif
 
+/*
 #if !defined(__WXMSW__)
 #define wxTreeCtrl wxGenericTreeCtrl
 #define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
 #endif
+*/
 
 #endif
     // _WX_TREECTRL_H_BASE_
index cb30f162d0dad0058c0f5a8b826f22bacff0c831..e04b74f31442af5cf4c64b19aff9d451bd2fc63b 100644 (file)
@@ -215,7 +215,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
 
     m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
                                 wxDefaultPosition, wxDefaultSize,
-                                wxTR_HAS_BUTTONS |
+                                wxTR_HAS_BUTTONS | // wxTR_NO_LINES |
                                 wxTR_EDIT_LABELS |
 #ifndef NO_VARIABLE_HEIGHT
                                 wxTR_HAS_VARIABLE_ROW_HEIGHT |
index 4f5cd2480249778dbc27f6b96bd7f51d5c4337fa..3e1dcb049b2114cf476bf5411b6e605d1e36fcfd 100644 (file)
@@ -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 );
         }
     }
 }