public DockFrame()
        {
            Docking.Helper.GtkWorkarounds.FixContainerLeak(this);

            dockBarTop    = new DockBar(this, Gtk.PositionType.Top);
            dockBarBottom = new DockBar(this, Gtk.PositionType.Bottom);
            dockBarLeft   = new DockBar(this, Gtk.PositionType.Left);
            dockBarRight  = new DockBar(this, Gtk.PositionType.Right);

            container = new DockContainer(this);
            HBox hbox = new HBox();

            hbox.PackStart(dockBarLeft, false, false, 0);
            hbox.PackStart(container, true, true, 0);
            hbox.PackStart(dockBarRight, false, false, 0);
            mainBox = new VBox();
            mainBox.PackStart(dockBarTop, false, false, 0);
            mainBox.PackStart(hbox, true, true, 0);
            mainBox.PackStart(dockBarBottom, false, false, 0);
            Add(mainBox);
            mainBox.ShowAll();
            mainBox.NoShowAll = true;
            CompactGuiLevel   = 2;
            dockBarTop.UpdateVisibility();
            dockBarBottom.UpdateVisibility();
            dockBarLeft.UpdateVisibility();
            dockBarRight.UpdateVisibility();

            DefaultVisualStyle = new DockVisualStyle();
        }
        public DockBarItem(DockBar bar, DockItem it, int size)
        {
            Events        = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
            this.size     = size;
            this.bar      = bar;
            this.it       = it;
            VisibleWindow = false;
            UpdateTab();
            lastFrameSize            = bar.Frame.Allocation.Size;
            bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

            tracker                 = new MouseTracker(this);
            tracker.TrackMotion     = false;
            tracker.HoveredChanged += (sender, e) => {
                if (crossfade == null)
                {
                    return;
                }

                AnimateHover(tracker.Hovered);
                if (tracker.Hovered)
                {
                    crossfade.ShowSecondary();
                }
                else
                {
                    crossfade.ShowPrimary();
                }
            };
        }
Exemple #3
0
        public DockFrame()
        {
            HandleSize        = 4;
            HandlePadding     = 2;
            DefaultItemWidth  = 300;
            DefaultItemHeight = 250;
            AutoShowDelay     = 400;
            AutoHideDelay     = 500;
            TabType           = TabAlgorithm.Proven;

            dockBarTop    = new DockBar(this, Gtk.PositionType.Top);
            dockBarBottom = new DockBar(this, Gtk.PositionType.Bottom);
            dockBarLeft   = new DockBar(this, Gtk.PositionType.Left);
            dockBarRight  = new DockBar(this, Gtk.PositionType.Right);

            container = new DockContainer(this);
            HBox hbox = new HBox();

            hbox.PackStart(dockBarLeft, false, false, 0);
            hbox.PackStart(container, true, true, 0);
            hbox.PackStart(dockBarRight, false, false, 0);
            mainBox = new VBox();
            mainBox.PackStart(dockBarTop, false, false, 0);
            mainBox.PackStart(hbox, true, true, 0);
            mainBox.PackStart(dockBarBottom, false, false, 0);
            Add(mainBox);
            mainBox.ShowAll();
            mainBox.NoShowAll = true;
            dockBarTop.UpdateVisibility();
            dockBarBottom.UpdateVisibility();
            dockBarLeft.UpdateVisibility();
            dockBarRight.UpdateVisibility();

            DefaultVisualStyle = new DockVisualStyle();
        }
 Gdk.Size GetBarFrameSize(DockBar bar)
 {
     if (bar.OriginalBar != null)
     {
         bar = bar.OriginalBar;
     }
     if (!bar.Visible)
     {
         return(new Gdk.Size(0, 0));
     }
     Gtk.Requisition req = bar.SizeRequest();
     return(new Gdk.Size(req.Width, req.Height));
 }
        public DockBar ExtractDockBar(PositionType pos)
        {
            DockBar db = new DockBar(this, pos);

            switch (pos)
            {
            case PositionType.Left: db.OriginalBar = dockBarLeft; dockBarLeft = db; break;

            case PositionType.Top: db.OriginalBar = dockBarTop; dockBarTop = db; break;

            case PositionType.Right: db.OriginalBar = dockBarRight; dockBarRight = db; break;

            case PositionType.Bottom: db.OriginalBar = dockBarBottom; dockBarBottom = db; break;
            }
            return(db);
        }
        internal AutoHideBox AutoShow(DockItem item, DockBar bar, int size)
        {
            AutoHideBox aframe = new AutoHideBox(this, item, bar.Position, size);

            Gdk.Size sTop  = GetBarFrameSize(dockBarTop);
            Gdk.Size sBot  = GetBarFrameSize(dockBarBottom);
            Gdk.Size sLeft = GetBarFrameSize(dockBarLeft);
            Gdk.Size sRgt  = GetBarFrameSize(dockBarRight);

            int x, y;

            if (bar == dockBarLeft || bar == dockBarRight)
            {
                aframe.HeightRequest = Allocation.Height - sTop.Height - sBot.Height;
                aframe.WidthRequest  = size;
                y = sTop.Height;
                if (bar == dockBarLeft)
                {
                    x = sLeft.Width;
                }
                else
                {
                    x = Allocation.Width - size - sRgt.Width;
                }
            }
            else
            {
                aframe.WidthRequest  = Allocation.Width - sLeft.Width - sRgt.Width;
                aframe.HeightRequest = size;
                x = sLeft.Width;
                if (bar == dockBarTop)
                {
                    y = sTop.Height;
                }
                else
                {
                    y = Allocation.Height - size - sBot.Height;
                }
            }
            AddTopLevel(aframe, x, y);
            aframe.AnimateShow();
            return(aframe);
        }
        internal void UpdateSize(DockBar bar, AutoHideBox aframe)
        {
            Gdk.Size sTop  = GetBarFrameSize(dockBarTop);
            Gdk.Size sBot  = GetBarFrameSize(dockBarBottom);
            Gdk.Size sLeft = GetBarFrameSize(dockBarLeft);
            Gdk.Size sRgt  = GetBarFrameSize(dockBarRight);

            if (bar == dockBarLeft || bar == dockBarRight)
            {
                aframe.HeightRequest = Allocation.Height - sTop.Height - sBot.Height;
                if (bar == dockBarRight)
                {
                    aframe.X = Allocation.Width - aframe.Allocation.Width - sRgt.Width;
                }
            }
            else
            {
                aframe.WidthRequest = Allocation.Width - sLeft.Width - sRgt.Width;
                if (bar == dockBarBottom)
                {
                    aframe.Y = Allocation.Height - aframe.Allocation.Height - sBot.Height;
                }
            }
        }
        public DockBarItem(DockBar bar, DockItem it, int size)
        {
            Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
             this.size = size;
             this.bar = bar;
             this.it = it;
             VisibleWindow = false;
             UpdateTab();
             lastFrameSize = bar.Frame.Allocation.Size;
             bar.Frame.SizeAllocated += HandleBarFrameSizeAllocated;

             tracker = new MouseTracker(this);
             tracker.TrackMotion = false;
             tracker.HoveredChanged += (sender, e) =>
             {

            if (crossfade == null)
               return;

            AnimateHover(tracker.Hovered);
            if (tracker.Hovered)
               crossfade.ShowSecondary();
            else
               crossfade.ShowPrimary();
             };
        }
 Gdk.Size GetBarFrameSize(DockBar bar)
 {
     if (bar.OriginalBar != null)
         bar = bar.OriginalBar;
     if (!bar.Visible)
         return new Gdk.Size (0,0);
     Gtk.Requisition req = bar.SizeRequest ();
     return new Gdk.Size (req.Width, req.Height);
 }
        public DockFrame()
        {
            Docking.Helper.GtkWorkarounds.FixContainerLeak (this);

            dockBarTop = new DockBar (this, Gtk.PositionType.Top);
            dockBarBottom = new DockBar (this, Gtk.PositionType.Bottom);
            dockBarLeft = new DockBar (this, Gtk.PositionType.Left);
            dockBarRight = new DockBar (this, Gtk.PositionType.Right);

            container = new DockContainer (this);
            HBox hbox = new HBox ();
            hbox.PackStart (dockBarLeft, false, false, 0);
            hbox.PackStart (container, true, true, 0);
            hbox.PackStart (dockBarRight, false, false, 0);
            mainBox = new VBox ();
            mainBox.PackStart (dockBarTop, false, false, 0);
            mainBox.PackStart (hbox, true, true, 0);
            mainBox.PackStart (dockBarBottom, false, false, 0);
            Add (mainBox);
            mainBox.ShowAll ();
            mainBox.NoShowAll = true;
            CompactGuiLevel = 2;
            dockBarTop.UpdateVisibility ();
            dockBarBottom.UpdateVisibility ();
            dockBarLeft.UpdateVisibility ();
            dockBarRight.UpdateVisibility ();

            DefaultVisualStyle = new DockVisualStyle ();
        }
        internal void UpdateSize(DockBar bar, AutoHideBox aframe)
        {
            Gdk.Size sTop = GetBarFrameSize (dockBarTop);
            Gdk.Size sBot = GetBarFrameSize (dockBarBottom);
            Gdk.Size sLeft = GetBarFrameSize (dockBarLeft);
            Gdk.Size sRgt = GetBarFrameSize (dockBarRight);

            if (bar == dockBarLeft || bar == dockBarRight) {
                aframe.HeightRequest = Allocation.Height - sTop.Height - sBot.Height;
                if (bar == dockBarRight)
                    aframe.X = Allocation.Width - aframe.Allocation.Width - sRgt.Width;
            } else {
                aframe.WidthRequest = Allocation.Width - sLeft.Width - sRgt.Width;
                if (bar == dockBarBottom)
                    aframe.Y = Allocation.Height - aframe.Allocation.Height - sBot.Height;
            }
        }
        internal AutoHideBox AutoShow(DockItem item, DockBar bar, int size)
        {
            AutoHideBox aframe = new AutoHideBox (this, item, bar.Position, size);
            Gdk.Size sTop = GetBarFrameSize (dockBarTop);
            Gdk.Size sBot = GetBarFrameSize (dockBarBottom);
            Gdk.Size sLeft = GetBarFrameSize (dockBarLeft);
            Gdk.Size sRgt = GetBarFrameSize (dockBarRight);

            int x,y;
            if (bar == dockBarLeft || bar == dockBarRight) {
                aframe.HeightRequest = Allocation.Height - sTop.Height - sBot.Height;
                aframe.WidthRequest = size;
                y = sTop.Height;
                if (bar == dockBarLeft)
                    x = sLeft.Width;
                else
                    x = Allocation.Width - size - sRgt.Width;
            } else {
                aframe.WidthRequest = Allocation.Width - sLeft.Width - sRgt.Width;
                aframe.HeightRequest = size;
                x = sLeft.Width;
                if (bar == dockBarTop)
                    y = sTop.Height;
                else
                    y = Allocation.Height - size - sBot.Height;
            }
            AddTopLevel (aframe, x, y);
            aframe.AnimateShow ();
            return aframe;
        }
 public DockBar ExtractDockBar(PositionType pos)
 {
     DockBar db = new DockBar (this, pos);
     switch (pos) {
         case PositionType.Left: db.OriginalBar = dockBarLeft; dockBarLeft = db; break;
         case PositionType.Top: db.OriginalBar = dockBarTop; dockBarTop = db; break;
         case PositionType.Right: db.OriginalBar = dockBarRight; dockBarRight = db; break;
         case PositionType.Bottom: db.OriginalBar = dockBarBottom; dockBarBottom = db; break;
     }
     return db;
 }