コード例 #1
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            Widget ww = Widget.Lookup(oldChild);

            if (ww != null && ww.ShowScrollbars && ParentWrapper != null)
            {
                // The viewport is bound to the child widget. Remove it together with the child
                ParentWrapper.ReplaceChild(Wrapped, newChild, false);
                return;
            }

            if (scrolled.Child is Gtk.Viewport && oldChild != scrolled.Child)
            {
                Gtk.Viewport vp = (Gtk.Viewport)scrolled.Child;
                vp.Remove(oldChild);
                scrolled.Remove(vp);
                vp.Destroy();
            }
            else
            {
                scrolled.Remove(scrolled.Child);
            }

            if (newChild.SetScrollAdjustments(null, null))
            {
                scrolled.Add(newChild);
            }
            else
            {
                AddWithViewport(newChild);
            }

            NotifyChildAdded(scrolled.Child);
        }
コード例 #2
0
        protected override void ReplaceChild(Gtk.Widget oldChild, Gtk.Widget newChild)
        {
            Widget ww = Widget.Lookup(oldChild);

            if ((oldChild is Placeholder) && (ParentWrapper is ScrolledWindow) && newChild.SetScrollAdjustments(null, null))
            {
                Widget wrapper = Widget.Lookup(newChild);
                wrapper.ShowScrollbars = false;
                ParentWrapper.ReplaceChild(Wrapped, newChild, false);
            }
            else if (ww != null && ww.ShowScrollbars && (ParentWrapper is ScrolledWindow) && ParentWrapper.ParentWrapper != null)
            {
                // The viewport is bound to the child widget. Remove it together with the child
                ParentWrapper.ParentWrapper.ReplaceChild(ParentWrapper.Wrapped, newChild, false);
            }
            else
            {
                base.ReplaceChild(oldChild, newChild);
            }
        }