Esempio n. 1
0
        void Create()
        {
            Gtk.Paned old = Control;
            if (orientation == Orientation.Horizontal)
            {
                Control = new EtoHPaned()
                {
                    Handler = this
                }
            }
            ;
            else
            {
                Control = new EtoVPaned()
                {
                    Handler = this
                }
            };
            if (container.Child != null)
            {
                container.Remove(container.Child);
            }
            container.Child = Control;
            if (old != null)
            {
                var child1 = old.Child1;
                var child2 = old.Child2;
                old.Remove(child2);
                old.Remove(child1);
                Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
                Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
                old.Destroy();
            }
            else
            {
                Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
                Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
            }
            Control.Realized += (sender, e) =>
            {
                SetInitialPosition();
                HookEvents();
            };
        }

        void HookEvents()
        {
            Control.AddNotification("position", (o, args) =>
            {
                if (Widget.ParentWindow == null || !Widget.Loaded || suppressSplitterMoved > 0)
                {
                    return;
                }
                // keep track of the desired position (for removing/re-adding/resizing the control)
                UpdateRelative();
                Callback.OnPositionChanged(Widget, EventArgs.Empty);
            });
        }
Esempio n. 2
0
 void Create()
 {
     Gtk.Paned old = Control;
     if (orientation == SplitterOrientation.Horizontal)
     {
         Control = new EtoHPaned();
     }
     else
     {
         Control = new EtoVPaned();
     }
     if (container.Child != null)
     {
         container.Remove(container.Child);
     }
     container.Child = Control;
     if (old != null)
     {
         var child1 = old.Child1;
         var child2 = old.Child2;
         old.Remove(child2);
         old.Remove(child1);
         Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
         Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
         old.Destroy();
     }
     else
     {
         Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
         Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
     }
     if (position != null)
     {
         Control.Position = position.Value;
     }
 }
Esempio n. 3
0
        void Create()
        {
            Gtk.Paned old = Control;

            if (orientation == Orientation.Horizontal)
            {
                Control = new EtoHPaned()
                {
                    Handler = this
                }
            }
            ;
            else
            {
                Control = new EtoVPaned()
                {
                    Handler = this
                }
            };

            Control.ShowAll();
            Control.Realized += Control_Realized;

            if (container.Child != null)
            {
                container.Remove(container.Child);
            }

            if (old != null)
            {
                old.Realized -= Control_Realized;
                var child1 = old.Child1;
                var child2 = old.Child2;
                old.Remove(child2);
                old.Remove(child1);
                Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
                Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
                old.Destroy();
            }
            else
            {
                Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true);
                Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true);
            }

            container.Child = Control;
        }

        void Control_Realized(object sender, EventArgs e)
        {
            HookEvents();

#if !GTK2
            EnsurePosition();
#endif
        }

        void HookEvents()
        {
            if (EtoEnvironment.Platform.IsMac)
            {
                Control.AddNotification("position", PositionChangedBefore);                 // macOS throw NRE when resizing the window without this
            }
            Control.AddNotification("position", PositionChanged);
        }