mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Fix hide items in HypreTreeList
Hiding items was only partially implemented and very buggy. This feature does not exist in CustomTreeCtrl but I see no reason why it couldn't be added in the future. This fix requires the arrow key fixes in order for arrow keys to work reliably in a tree with hidden items. Hidden items always report they are disabled and not expanded. Also updates the demo of HyperTreeList to add hide options to context menu so the feature can be tested.
This commit is contained in:
@@ -2061,6 +2061,9 @@ class HyperTreeList(HTL.HyperTreeList):
|
||||
|
||||
item7 = menu.Append(wx.ID_ANY, "Disable Item")
|
||||
|
||||
menu.AppendSeparator()
|
||||
item14 = menu.Append(wx.ID_ANY, "Hide Item")
|
||||
item15 = menu.Append(wx.ID_ANY, "Unhide All Items")
|
||||
menu.AppendSeparator()
|
||||
item8 = menu.Append(wx.ID_ANY, "Change Item Icons")
|
||||
menu.AppendSeparator()
|
||||
@@ -2084,6 +2087,8 @@ class HyperTreeList(HTL.HyperTreeList):
|
||||
self.Bind(wx.EVT_MENU, self.OnItemPrepend, item11)
|
||||
self.Bind(wx.EVT_MENU, self.OnItemAppend, item12)
|
||||
self.Bind(wx.EVT_MENU, self.OnItemBackground, item13)
|
||||
self.Bind(wx.EVT_MENU, self.OnHideItem, item14)
|
||||
self.Bind(wx.EVT_MENU, self.OnUnhideItems, item15)
|
||||
|
||||
self.PopupMenu(menu)
|
||||
menu.Destroy()
|
||||
@@ -2145,6 +2150,22 @@ class HyperTreeList(HTL.HyperTreeList):
|
||||
event.Skip()
|
||||
|
||||
|
||||
def OnHideItem(self, event):
|
||||
|
||||
self.HideItem(self.current)
|
||||
event.Skip()
|
||||
|
||||
|
||||
def OnUnhideItems(self, event):
|
||||
|
||||
item = self.GetRootItem()
|
||||
while item:
|
||||
if item.IsHidden():
|
||||
self.HideItem(item, False)
|
||||
item = self.GetNext(item)
|
||||
event.Skip()
|
||||
|
||||
|
||||
def OnItemIcons(self, event):
|
||||
|
||||
bitmaps = [self.itemdict["normal"], self.itemdict["selected"],
|
||||
|
||||
Reference in New Issue
Block a user