]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/tree.py
compilation fixes after wxGTK_CONV_BACK changes
[wxWidgets.git] / wxPython / wx / tools / XRCed / tree.py
index 8e515841aeec6fadf93140e34ca0a05187f5ae23..da78f48859c5252ab8921a5eb7e86aa8fa28480f 100644 (file)
@@ -612,6 +612,7 @@ class XML_Tree(wx.TreeCtrl):
         # Reset selection object
         self.selection = None
         return node
         # 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)
     # Find position relative to the top-level window
     def FindNodePos(self, item, obj=None):
         # Root at (0,0)
@@ -631,15 +632,12 @@ class XML_Tree(wx.TreeCtrl):
                         if g.testWin.highLight:
                             g.testWin.highLight.Remove()
                     break
                         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
         winParent = itemParent
-        while self.GetPyData(winParent).isSizer:
+        while self.GetPyData(winParent).isSizer or \
+                  self.GetPyData(winParent).treeObject().__class__ == xxxNotebook:
             winParent = self.GetItemParent(winParent)
             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)
+        parentPos = self.FindNodePos(winParent)
         # Position (-1,-1) is really (0,0)
         pos = obj.GetPosition()
         if pos == (-1,-1): pos = (0,0)
         # Position (-1,-1) is really (0,0)
         pos = obj.GetPosition()
         if pos == (-1,-1): pos = (0,0)
@@ -700,7 +698,6 @@ class XML_Tree(wx.TreeCtrl):
             # If some data was modified, apply changes
             if g.panel.IsModified():
                 self.Apply(xxx, oldItem)
             # 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()
                 if g.testWin:
                     if g.testWin.highLight:
                         g.testWin.highLight.Remove()
@@ -959,9 +956,11 @@ class XML_Tree(wx.TreeCtrl):
                 testWin.toolBar = res.LoadToolBar(testWin, STD_NAME)
                 testWin.SetToolBar(testWin.toolBar)
                 testWin.Show(True)
                 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)
             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)
                 testWin.highLight = None
                 if highLight and not self.pendingHighLight:
                     self.HighLight(highLight)
@@ -987,6 +986,11 @@ class XML_Tree(wx.TreeCtrl):
     def OnCloseTestWin(self, evt):
         self.CloseTestWindow()
 
     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
     # Return index in parent, for real window children
     def WindowIndex(self, item):
         n = 0                           # index of sibling
@@ -1149,10 +1153,11 @@ class XML_Tree(wx.TreeCtrl):
         self.PopupMenu(menu, evt.GetPosition())
         menu.Destroy()
 
         self.PopupMenu(menu, evt.GetPosition())
         menu.Destroy()
 
-    # Redefine to force the update of font dimentions
-    def SetItemBold(self, item):
-        wx.TreeCtrl.SetItemBold(self, item)
-        self.SetIndent(self.GetIndent())
+    # Redefine to force the update of font dimentions on wxGTK
+    if wx.Platform == '__WXGTK__':
+        def SetItemBold(self, item, state=True):
+            wx.TreeCtrl.SetItemBold(self, item, state)
+            self.SetIndent(self.GetIndent())
 
     # Apply changes
     def Apply(self, xxx, item):
 
     # Apply changes
     def Apply(self, xxx, item):