wxMSW fixes for tree control
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
03319b655c
commit
83173c7a4d
@ -1,3 +1,9 @@
|
||||
0.1.6-2
|
||||
-------
|
||||
|
||||
wxMSW wxTreeCtrl behaviour is still different from wxGTK for
|
||||
wxTR_MULTIPLE, some fixes for this.
|
||||
|
||||
0.1.6-1
|
||||
-------
|
||||
|
||||
|
@ -15,7 +15,7 @@ import sys
|
||||
# Global constants
|
||||
|
||||
progname = 'XRCed'
|
||||
version = '0.1.6-1'
|
||||
version = '0.1.6-2'
|
||||
# Can be changed to set other default encoding different
|
||||
#defaultEncoding = ''
|
||||
# you comment above and can uncomment this:
|
||||
|
@ -419,6 +419,7 @@ class XML_Tree(wxTreeCtrl):
|
||||
EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemExpandedCollapsed)
|
||||
|
||||
self.selection = None
|
||||
self.selectionChanging = False
|
||||
self.needUpdate = False
|
||||
self.pendingHighLight = None
|
||||
self.ctrl = self.shift = False
|
||||
@ -486,7 +487,7 @@ class XML_Tree(wxTreeCtrl):
|
||||
self.root = self.AddRoot('XML tree', self.rootImage,
|
||||
data=wxTreeItemData(self.rootObj))
|
||||
self.SetItemHasChildren(self.root)
|
||||
self.Unselect()
|
||||
self.UnselectAll()
|
||||
self.Expand(self.root)
|
||||
|
||||
# Clear old data and set new
|
||||
@ -510,7 +511,7 @@ class XML_Tree(wxTreeCtrl):
|
||||
self.mainNode.removeChild(node)
|
||||
node.unlink()
|
||||
self.Expand(self.root)
|
||||
self.Unselect()
|
||||
self.UnselectAll()
|
||||
|
||||
# Add tree item for given parent item if node is DOM element node with
|
||||
# object/object_ref tag. xxxParent is parent xxx object
|
||||
@ -641,7 +642,11 @@ class XML_Tree(wxTreeCtrl):
|
||||
return child
|
||||
|
||||
def OnSelChanged(self, evt):
|
||||
self.ChangeSelection(evt.GetItem())
|
||||
if self.selectionChanging: return
|
||||
self.selectionChanging = True
|
||||
self.UnselectAll()
|
||||
self.SelectItem(evt.GetItem())
|
||||
self.selectionChanging = False
|
||||
|
||||
def ChangeSelection(self, item):
|
||||
# Apply changes
|
||||
@ -965,6 +970,14 @@ class XML_Tree(wxTreeCtrl):
|
||||
return False
|
||||
return not (self.IsExpanded(item) and self.GetChildrenCount(item, False))
|
||||
|
||||
# Override to use like single-selection tree
|
||||
def GetSelection(self):
|
||||
self.GetSelections(self)[:1]
|
||||
def SelectItem(self, item):
|
||||
self.UnselectAll()
|
||||
self.ChangeSelection(item)
|
||||
wxTreeCtrl.SelectItem(self, item)
|
||||
|
||||
# Pull-down
|
||||
def OnRightDown(self, evt):
|
||||
pullDownMenu = g.pullDownMenu
|
||||
|
@ -74,7 +74,7 @@ class UndoCutDelete:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.needUpdate = True
|
||||
self.elem = g.tree.RemoveLeaf(item)
|
||||
g.tree.Unselect()
|
||||
g.tree.UnselectAll()
|
||||
g.panel.Clear()
|
||||
|
||||
class UndoPasteCreate:
|
||||
|
Loading…
Reference in New Issue
Block a user