Ejemplo n.º 1
0
 private static void SelectNextTreeNode(DocumentHierarchyTreeView view)
 {
     if (!view.HasSelection())
     {
         view.SelectFirstMatch();
         return;
     }
     view.SelectNextTreeNode();
 }
Ejemplo n.º 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();
            }));
        }
Ejemplo n.º 3
0
 private static void ClearSelection(DocumentHierarchyTreeView view) => view.ClearSelection();
Ejemplo n.º 4
0
 private static void ToggleSelectedTreeNode(DocumentHierarchyTreeView view) => view.ToggleSelectedTreeNode();
Ejemplo n.º 5
0
 private static void LeaveSelectedTreeNode(DocumentHierarchyTreeView view) => view.LeaveSelectedTreeNode();
Ejemplo n.º 6
0
 private static void EnterSelectedTreeNode(DocumentHierarchyTreeView view) => view.EnterSelectedTreeNode();
Ejemplo n.º 7
0
 private static void SelectPreviousTreeNode(DocumentHierarchyTreeView view) => view.SelectPreviousTreeNode();
Ejemplo n.º 8
0
 private static void NavigateToSelectedNode(DocumentHierarchyTreeView view) => view.NavigateToSelectedNode();