Exemple #1
0
 protected virtual void OnCollapsed(TreeGridViewItemEventArgs e)
 {
     if (Collapsed != null)
     {
         Collapsed(this, e);
     }
 }
Exemple #2
0
 protected virtual void OnExpanded(TreeGridViewItemEventArgs e)
 {
     if (Expanded != null)
     {
         Expanded(this, e);
     }
 }
Exemple #3
0
        private void folderView_Collapsed(object sender, TreeGridViewItemEventArgs e)
        {
            var gridItem = (TreeGridItem)e.Item;

            gridItem.Values[0] = TreeDirectoryResource;

            folderView.ReloadItem(gridItem, false);
        }
Exemple #4
0
        private void folderView_Expanded(object sender, TreeGridViewItemEventArgs e)
        {
            var gridItem = (TreeGridItem)e.Item;

            gridItem.Values[0] = ImageResources.Misc.DirectoryOpen;

            folderView.ReloadItem(gridItem, false);
        }
Exemple #5
0
            public void HandleRowExpanded(object o, Gtk.RowExpandedArgs args)
            {
                var h = Handler;
                var e = new TreeGridViewItemEventArgs(h.GetItem(args.Path) as ITreeGridItem);

                e.Item.Expanded = true;
                h.Widget.OnExpanded(e);
            }
Exemple #6
0
            public void HandleRowCollapsed(object o, Gtk.RowCollapsedArgs args)
            {
                var h = Handler;
                var e = new TreeGridViewItemEventArgs(h.GetItem(args.Path) as ITreeGridItem);

                e.Item.Expanded = false;
                h.Widget.OnCollapsed(e);
                h.SkipSelectedChange = false;
                if (h.selectCollapsingItem == true)
                {
                    h.Tree.Selection.UnselectAll();
                    h.Tree.Selection.SelectPath(args.Path);
                    h.selectCollapsingItem = null;
                }
            }
Exemple #7
0
            public void HandleRowExpanded(object o, Gtk.RowExpandedArgs args)
            {
                var h = Handler;

                if (h.suppressExpandCollapseEvents > 0)
                {
                    return;
                }
                var e = new TreeGridViewItemEventArgs(h.GetItem(args.Path) as ITreeGridItem);

                e.Item.Expanded = true;
                h.suppressExpandCollapseEvents++;
                h.collection.ExpandItems(e.Item as ITreeGridStore <ITreeGridItem>, args.Path);
                h.suppressExpandCollapseEvents--;
                h.Callback.OnExpanded(h.Widget, e);
            }
        public override void AttachEvent(string handler)
        {
            switch (handler)
            {
            case TreeGridView.ExpandingEvent:
                this.Tree.TestExpandRow += delegate(object o, Gtk.TestExpandRowArgs args) {
                    var e = new TreeGridViewItemCancelEventArgs(GetItem(args.Path) as ITreeGridItem);
                    Widget.OnExpanding(e);
                    args.RetVal = e.Cancel;
                };
                break;

            case TreeGridView.ExpandedEvent:
                this.Tree.RowExpanded += delegate(object o, Gtk.RowExpandedArgs args) {
                    var e = new TreeGridViewItemEventArgs(GetItem(args.Path) as ITreeGridItem);
                    e.Item.Expanded = true;
                    Widget.OnExpanded(e);
                };
                break;

            case TreeGridView.CollapsingEvent:
                this.Tree.TestCollapseRow += delegate(object o, Gtk.TestCollapseRowArgs args) {
                    var e = new TreeGridViewItemCancelEventArgs(GetItem(args.Path) as ITreeGridItem);
                    Widget.OnCollapsing(e);
                    args.RetVal = e.Cancel;
                    if (!e.Cancel)
                    {
                        selectCollapsingItem = AllowMultipleSelection ? false : ChildIsSelected(e.Item);
                        SkipSelectedChange   = true;
                    }
                };
                break;

            case TreeGridView.CollapsedEvent:
                this.Tree.RowCollapsed += delegate(object o, Gtk.RowCollapsedArgs args) {
                    var e = new TreeGridViewItemEventArgs(GetItem(args.Path) as ITreeGridItem);
                    e.Item.Expanded = false;
                    Widget.OnCollapsed(e);
                    SkipSelectedChange = false;
                    if (selectCollapsingItem == true)
                    {
                        Tree.Selection.UnselectAll();
                        Tree.Selection.SelectPath(args.Path);
                        selectCollapsingItem = null;
                    }
                };
                break;

            case TreeGridView.SelectedItemChangedEvent:
                this.Tree.Selection.Changed += (o, args) => {
                    var item = this.SelectedItem;
                    if (!SkipSelectedChange && !object.ReferenceEquals(item, lastSelected))
                    {
                        Widget.OnSelectedItemChanged(EventArgs.Empty);
                        lastSelected = item;
                    }
                };
                break;

            default:
                base.AttachEvent(handler);
                break;
            }
        }