Inheritance: ToolkitEngineBackend
示例#1
0
        public static void SetChildPlacement(IWidgetBackend childBackend)
        {
            var backend = (WidgetBackend)childBackend;
            var child   = backend.RootWidget;
            var wrapper = child.Parent as WidgetPlacementWrapper;
            var fw      = backend.Frontend;

            if (!NeedsAlignmentWrapper(fw))
            {
                if (wrapper != null)
                {
                    wrapper.Remove(child);
                    GtkEngine.ReplaceChild(wrapper, child);
                }
                return;
            }

            if (wrapper == null)
            {
                wrapper = new WidgetPlacementWrapper();
                wrapper.Show();
                GtkEngine.ReplaceChild(child, wrapper);
                wrapper.Add(child);
            }
            wrapper.UpdatePlacement(fw);
        }
示例#2
0
 public virtual void UpdateLayout()
 {
     if (frontend.Margin.HorizontalSpacing == 0 && frontend.Margin.VerticalSpacing == 0)
     {
         if (alignment != null)
         {
             alignment.Remove(alignment.Child);
             GtkEngine.ReplaceChild(alignment, EventsRootWidget);
             alignment.Destroy();
             alignment = null;
         }
     }
     else
     {
         if (alignment == null)
         {
             alignment = new Gtk.Alignment(0, 0, 1, 1);
             GtkEngine.ReplaceChild(EventsRootWidget, alignment);
             alignment.Add(EventsRootWidget);
             alignment.Visible = Widget.Visible;
         }
         alignment.LeftPadding   = (uint)frontend.Margin.Left;
         alignment.RightPadding  = (uint)frontend.Margin.Right;
         alignment.TopPadding    = (uint)frontend.Margin.Top;
         alignment.BottomPadding = (uint)frontend.Margin.Bottom;
     }
 }
示例#3
0
        protected void AllocEventBox(bool visibleWindow = false)
        {
            // Wraps the widget with an event box. Required for some
            // widgets such as Label which doesn't have its own gdk window

            if (!NeedsEventBox)
            {
                return;
            }

            if (eventBox == null && !EventsRootWidget.GetHasWindow())
            {
                if (EventsRootWidget is Gtk.EventBox)
                {
                    ((Gtk.EventBox)EventsRootWidget).VisibleWindow = true;
                    return;
                }
                eventBox               = new Gtk.EventBox();
                eventBox.Visible       = Widget.Visible;
                eventBox.Sensitive     = Widget.Sensitive;
                eventBox.VisibleWindow = visibleWindow;
                GtkEngine.ReplaceChild(Widget, eventBox);
                eventBox.Add(Widget);
            }
        }
示例#4
0
 public virtual void UpdateLayout()
 {
     if (frontend.Margin.HorizontalSpacing == 0 && frontend.Margin.VerticalSpacing == 0)
     {
         if (alignment != null)
         {
             alignment.Remove(Widget);
             Gtk.Container cont = alignment.Parent as Gtk.Container;
             if (cont != null)
             {
                 GtkEngine.ReplaceChild(cont, alignment, Widget);
             }
             alignment.Destroy();
             alignment = null;
         }
     }
     else
     {
         if (alignment == null)
         {
             alignment = new Gtk.Alignment(0, 0, 1, 1);
             Gtk.Container cont = Widget.Parent as Gtk.Container;
             if (cont != null)
             {
                 GtkEngine.ReplaceChild(cont, Widget, alignment);
             }
             alignment.Add(Widget);
         }
         alignment.LeftPadding   = (uint)frontend.Margin.Left;
         alignment.RightPadding  = (uint)frontend.Margin.Right;
         alignment.TopPadding    = (uint)frontend.Margin.Top;
         alignment.BottomPadding = (uint)frontend.Margin.Bottom;
     }
 }
示例#5
0
        public void SetContent(IWidgetBackend widget)
        {
            var newWidget = GetWidget(widget);
            var oldWidget = Widget.Child;

            if (oldWidget == null)
            {
                Widget.Child = newWidget;
            }
            else
            {
                GtkEngine.ReplaceChild(oldWidget, newWidget);
            }
        }
示例#6
0
        void AllocEventBox(bool visibleWindow = false)
        {
            // Wraps the widget with an event box. Required for some
            // widgets such as Label which doesn't have its own gdk window

            if (eventBox == null && EventsRootWidget.IsNoWindow)
            {
                eventBox               = new Gtk.EventBox();
                eventBox.Visible       = Widget.Visible;
                eventBox.Sensitive     = Widget.Sensitive;
                eventBox.VisibleWindow = visibleWindow;
                GtkEngine.ReplaceChild(Widget, eventBox);
                eventBox.Add(Widget);
            }
        }
示例#7
0
        public void SetContent(IWidgetBackend widget)
        {
            childBackend = (WidgetBackend)widget;

            var newWidget = GetWidgetWithPlacement(widget);
            var oldWidget = Widget.Child;

            if (oldWidget == null)
            {
                Widget.Child = newWidget;
            }
            else
            {
                GtkEngine.ReplaceChild(oldWidget, newWidget);
                RemoveChildPlacement(oldWidget);
            }
        }
示例#8
0
        void AllocEventBox()
        {
            // Wraps the widget with an event box. Required for some
            // widgets such as Label which doesn't have its own gdk window

            if (eventBox == null && EventsRootWidget.IsNoWindow)
            {
                eventBox           = new Gtk.EventBox();
                eventBox.Visible   = Widget.Visible;
                eventBox.Sensitive = Widget.Sensitive;
                if (alignment != null)
                {
                    alignment.Remove(alignment.Child);
                    alignment.Add(eventBox);
                }
                else
                {
                    GtkEngine.ReplaceChild(Widget, eventBox);
                }
                eventBox.Add(Widget);
            }
        }