Beispiel #1
0
 private static void SelectNextTreeNode(DocumentHierarchyTreeView view)
 {
     if (!view.HasSelection())
     {
         view.SelectFirstMatch();
         return;
     }
     view.SelectNextTreeNode();
 }
Beispiel #2
0
        public HierarchyPanel(Widget rootWidget)
        {
            DocumentHierarchyTreeView view;
            EditBox searchStringEditor;

            panelWidget     = rootWidget;
            this.rootWidget = new Frame {
                Id      = "SearchPanel",
                Padding = new Thickness(5),
                Layout  = new VBoxLayout {
                    Spacing = 5
                },
                Nodes =
                {
                    (searchStringEditor = new ThemedEditBox())
                }
            };
            rootWidget.TabTravesable = new TabTraversable();
            var treeView       = new DocumentHierarchyTreeView(this.rootWidget, Document.Current.RootNode);
            var searchTreeView = new DocumentHierarchyTreeView(this.rootWidget, Document.Current.RootNode);

            searchStringEditor.AddChangeWatcher(() => searchStringEditor.Text, t => {
                if (!string.IsNullOrEmpty(t))
                {
                    if (treeView.IsAttached())
                    {
                        treeView.Detach();
                        searchTreeView.Attach();
                        view = searchTreeView;
                    }
                    searchTreeView.Filter(t.ToLower());
                }
                else
                {
                    if (!searchTreeView.IsAttached())
                    {
                        return;
                    }
                    searchTreeView.Detach();
                    treeView.Attach();
                    view = treeView;
                }
            });
            treeView.Attach();
            view = treeView;
            this.rootWidget.LateTasks.Add(new KeyRepeatHandler((input, key) => {
                if (!keyActionMap.ContainsKey(key))
                {
                    return;
                }
                input.ConsumeKey(key);
                keyActionMap[key](view);
                view.EnsureSelectionVisible();
                Window.Current.Invalidate();
            }));
        }
Beispiel #3
0
 private static void ClearSelection(DocumentHierarchyTreeView view) => view.ClearSelection();
Beispiel #4
0
 private static void ToggleSelectedTreeNode(DocumentHierarchyTreeView view) => view.ToggleSelectedTreeNode();
Beispiel #5
0
 private static void LeaveSelectedTreeNode(DocumentHierarchyTreeView view) => view.LeaveSelectedTreeNode();
Beispiel #6
0
 private static void EnterSelectedTreeNode(DocumentHierarchyTreeView view) => view.EnterSelectedTreeNode();
Beispiel #7
0
 private static void SelectPreviousTreeNode(DocumentHierarchyTreeView view) => view.SelectPreviousTreeNode();
Beispiel #8
0
 private static void NavigateToSelectedNode(DocumentHierarchyTreeView view) => view.NavigateToSelectedNode();