]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/tree.py
add many new macros to facilitate using wx from projects using bakefile presets;...
[wxWidgets.git] / wxPython / wx / tools / XRCed / tree.py
index c08b451fd44be44d733b853788bd92003886c8c1..3c5ddf95fbc4a718402d1e1469eba2cf31fb92d9 100644 (file)
@@ -612,6 +612,7 @@ class XML_Tree(wx.TreeCtrl):
         # Reset selection object
         self.selection = None
         return node
+    
     # Find position relative to the top-level window
     def FindNodePos(self, item, obj=None):
         # Root at (0,0)
@@ -631,17 +632,18 @@ class XML_Tree(wx.TreeCtrl):
                         if g.testWin.highLight:
                             g.testWin.highLight.Remove()
                     break
-        # Find first ancestor which is a wxWindow (not a sizer)
+        # For sizers and notebooks we must select the first window-like parent
         winParent = itemParent
         while self.GetPyData(winParent).isSizer:
             winParent = self.GetItemParent(winParent)
         # Notebook children are layed out in a little strange way
-        if self.GetPyData(itemParent).treeObject().__class__ == xxxNotebook:
-            parentPos = wx.Point(0,0)
-        else:
-            parentPos = self.FindNodePos(winParent)
-        # Position (-1,-1) is really (0,0)
+        # wxGTK places NB panels relative to the NB parent
+        if wx.Platform == '__WXGTK__':
+            if self.GetPyData(itemParent).treeObject().__class__ == xxxNotebook:
+                winParent = self.GetItemParent(winParent)
+        parentPos = self.FindNodePos(winParent)
         pos = obj.GetPosition()
+        # Position (-1,-1) is really (0,0)
         if pos == (-1,-1): pos = (0,0)
         return parentPos + pos
 
@@ -700,7 +702,6 @@ class XML_Tree(wx.TreeCtrl):
             # If some data was modified, apply changes
             if g.panel.IsModified():
                 self.Apply(xxx, oldItem)
-                #if conf.autoRefresh:
                 if g.testWin:
                     if g.testWin.highLight:
                         g.testWin.highLight.Remove()
@@ -774,7 +775,7 @@ class XML_Tree(wx.TreeCtrl):
             return
         # Show item in bold
         if g.testWin:     # Reset old
-            self.Unselect()
+            self.UnselectAll()
             self.SetItemBold(g.testWin.item, False)
         try:
             wx.BeginBusyCursor()
@@ -959,9 +960,11 @@ class XML_Tree(wx.TreeCtrl):
                 testWin.toolBar = res.LoadToolBar(testWin, STD_NAME)
                 testWin.SetToolBar(testWin.toolBar)
                 testWin.Show(True)
+            # Catch some events, set highlight
             if testWin:
                 testWin.item = item
                 wx.EVT_CLOSE(testWin, self.OnCloseTestWin)
+                wx.EVT_SIZE(testWin, self.OnSizeTestWin)
                 testWin.highLight = None
                 if highLight and not self.pendingHighLight:
                     self.HighLight(highLight)
@@ -987,6 +990,11 @@ class XML_Tree(wx.TreeCtrl):
     def OnCloseTestWin(self, evt):
         self.CloseTestWindow()
 
+    def OnSizeTestWin(self, evt):
+        if g.testWin.highLight:
+            self.HighLight(g.testWin.highLight.item)
+        evt.Skip()
+
     # Return index in parent, for real window children
     def WindowIndex(self, item):
         n = 0                           # index of sibling