Esempio n. 1
0
        public void SetChild(IWidgetBackend child)
        {
            RemoveChildPlacement(currentChild);

            if (Widget.Child != null)
            {
                if (Widget.Child is Gtk.Bin)
                {
                    Gtk.Bin vp = (Gtk.Bin)Widget.Child;
                    vp.Remove(vp.Child);
                }
                Widget.Remove(Widget.Child);
            }

            if (child != null)
            {
                var w = currentChild = GetWidgetWithPlacement(child);

                WidgetBackend wb = (WidgetBackend)child;

                if (wb.EventSink.SupportsCustomScrolling())
                {
                    CustomViewPort vp = new CustomViewPort(wb.EventSink);
                    vp.Show();
                    vp.Add(w);
                    Widget.Child = vp;
                }
                                #if XWT_GTK3
                else if (w is Gtk.IScrollable)
                {
                    Widget.Child = w;
                }
                                #else
                // Gtk2 has no interface for natively scrollable widgets, therefore we manually check
                // for types that should not be packed into a Viewport.
                // see: https://developer.gnome.org/gtk2/stable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport
                else if (w is Gtk.Viewport || w is Gtk.TreeView || w is Gtk.TextView || w is Gtk.Layout || w is WebKit.WebView)
                {
                    Widget.Child = w;
                }
                                #endif
                else
                {
                    Gtk.Viewport vp = new Gtk.Viewport();
                    vp.Show();
                    vp.Add(w);
                    Widget.Child = vp;
                }
            }

            UpdateBorder();
        }
Esempio n. 2
0
 public void SetContent(IWidgetBackend child)
 {
     Gtk.Bin parent = paddingAlign != null ? paddingAlign : Widget;
     if (child != null)
     {
         var w = GetWidget(child);
         if (parent.Child != null)
         {
             parent.Remove(parent.Child);
         }
         parent.Child = w;
     }
     else
     {
         parent.Child = null;
     }
 }
Esempio n. 3
0
        public void SetChild(IWidgetBackend child)
        {
            RemoveChildPlacement(currentChild);

            if (Widget.Child != null)
            {
                if (Widget.Child is Gtk.Bin)
                {
                    Gtk.Bin vp = (Gtk.Bin)Widget.Child;
                    vp.Remove(vp.Child);
                }
                Widget.Remove(Widget.Child);
            }

            if (child != null)
            {
                var w = currentChild = GetWidgetWithPlacement(child);

                WidgetBackend wb = (WidgetBackend)child;

                if (wb.EventSink.SupportsCustomScrolling())
                {
                    CustomViewPort vp = new CustomViewPort(wb.EventSink);
                    vp.Show();
                    vp.Add(w);
                    Widget.Child = vp;
                }
                else if (w is Gtk.Viewport)
                {
                    Widget.Child = w;
                }
                else
                {
                    Gtk.Viewport vp = new Gtk.Viewport();
                    vp.Show();
                    vp.Add(w);
                    Widget.Child = vp;
                }
            }

            UpdateBorder();
        }