]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/TreeListCtrl.py
Another package name fix
[wxWidgets.git] / wxPython / demo / TreeListCtrl.py
index 4015c0665fe638b08e76ba81ae3de6ad46ef9984..c5371334a288bf3047cd00bd5a716145b20bd609 100644 (file)
@@ -1,7 +1,3 @@
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# 
 
 import  wx
 import  wx.gizmos   as  gizmos
@@ -16,16 +12,21 @@ class TestPanel(wx.Panel):
         wx.Panel.__init__(self, parent, -1)
         self.Bind(wx.EVT_SIZE, self.OnSize)
 
-        self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE
-                                   #| wx.TR_ROW_LINES
-                                   #| wx.TR_NO_LINES 
-                                   #| wx.TR_TWIST_BUTTONS
+        self.tree = gizmos.TreeListCtrl(self, -1, style =
+                                        wx.TR_DEFAULT_STYLE
+                                        #| wx.TR_HAS_BUTTONS
+                                        #| wx.TR_TWIST_BUTTONS
+                                        #| wx.TR_ROW_LINES
+                                        #| wx.TR_COLUMN_LINES
+                                        #| wx.TR_NO_LINES 
+                                        | wx.TR_FULL_ROW_HIGHLIGHT
                                    )
+
         isz = (16,16)
         il = wx.ImageList(isz[0], isz[1])
         fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
         fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
-        fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz))
+        fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
         smileidx    = il.Add(images.getSmilesBitmap())
 
         self.tree.SetImageList(il)
@@ -77,17 +78,11 @@ class TestPanel(wx.Panel):
 
 
     def OnRightUp(self, evt):
-        # Convert the position from being relative to the subwindow to
-        # being relative to the outer treelist window so HitTest will
-        # have the point it is expecting.
         pos = evt.GetPosition()
-        pos = self.tree.GetMainWindow().ClientToScreen(pos)
-        pos = self.tree.ScreenToClient(pos)
         item, flags, col = self.tree.HitTest(pos)
-
         if item:
-            print flags, col, self.tree.GetItemText(item, col)
-
+            self.log.write('Flags: %s, Col:%s, Text: %s' %
+                           (flags, col, self.tree.GetItemText(item, col)))
 
     def OnSize(self, evt):
         self.tree.SetSize(self.GetSize())
@@ -104,9 +99,9 @@ def runTest(frame, nb, log):
 
 
 overview = """<html><body>
-<h2><center>wxTreeListCtrl</center></h2>
+<h2><center>TreeListCtrl</center></h2>
 
-The wx.TreeListCtrl is essentially a wx.TreeCtrl with extra columns,
+The TreeListCtrl is essentially a wx.TreeCtrl with extra columns,
 such that the look is similar to a wx.ListCtrl.
 
 </body></html>
@@ -117,5 +112,5 @@ if __name__ == '__main__':
     #raw_input("Press enter...")
     import sys,os
     import run
-    run.main(['', os.path.basename(sys.argv[0])])
+    run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])