示例#1
0
 internal DockItemToolbar(DockItem parentItem, PositionType position)
 {
     this.parentItem = parentItem;
     frame = new CustomFrame ();
     switch (position) {
         case PositionType.Top:
             frame.SetMargins (0, 0, 1, 1);
             frame.SetPadding (0, 2, 2, 0);
             break;
         case PositionType.Bottom:
             frame.SetMargins (0, 1, 1, 1);
             frame.SetPadding (2, 2, 2, 0);
             break;
         case PositionType.Left:
             frame.SetMargins (0, 1, 1, 0);
             frame.SetPadding (0, 0, 2, 2);
             break;
         case PositionType.Right:
             frame.SetMargins (0, 1, 0, 1);
             frame.SetPadding (0, 0, 2, 2);
             break;
     }
     this.position = position;
     if (position == PositionType.Top || position == PositionType.Bottom)
         box = new HBox (false, 3);
     else
         box = new VBox (false, 3);
     box.Show ();
     frame.Add (box);
     frame.GradientBackround = true;
 }
示例#2
0
        public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
        {
            this.position = pos;
            this.frame = frame;
            this.targetSize = size;
            horiz = pos == PositionType.Left || pos == PositionType.Right;
            startPos = pos == PositionType.Top || pos == PositionType.Left;
            Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;

            Box fr;
            CustomFrame cframe = new CustomFrame ();
            switch (pos) {
                case PositionType.Left: cframe.SetMargins (1, 1, 0, 1); break;
                case PositionType.Right: cframe.SetMargins (1, 1, 1, 0); break;
                case PositionType.Top: cframe.SetMargins (0, 1, 1, 1); break;
                case PositionType.Bottom: cframe.SetMargins (1, 0, 1, 1); break;
            }
            EventBox sepBox = new EventBox ();
            cframe.Add (sepBox);

            if (horiz) {
                fr = new HBox ();
                sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
                sepBox.WidthRequest = gripSize;
            } else {
                fr = new VBox ();
                sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
                sepBox.HeightRequest = gripSize;
            }

            sepBox.Events = EventMask.AllEventsMask;

            if (pos == PositionType.Left || pos == PositionType.Top)
                fr.PackEnd (cframe, false, false, 0);
            else
                fr.PackStart (cframe, false, false, 0);

            Add (fr);
            ShowAll ();
            Hide ();

            scrollable = new ScrollableContainer ();
            scrollable.ScrollMode = false;
            scrollable.Show ();

            item.Widget.Show ();
            scrollable.Add (item.Widget);
            fr.PackStart (scrollable, true, true, 0);

            sepBox.ButtonPressEvent += OnSizeButtonPress;
            sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
            sepBox.MotionNotifyEvent += OnSizeMotion;
            sepBox.ExposeEvent += OnGripExpose;
            sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); };
            sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); };
        }
示例#3
0
 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;
 }
示例#4
0
        internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
        {
            if (!Allocation.Contains(px, py) || VisibleObjects.Count == 0)
            {
                dockDelegate = null;
                rect         = Gdk.Rectangle.Zero;
                return(false);
            }

            if (type == DockGroupType.Tabbed)
            {
                // Tabs can only contain DockGroupItems
                return(((DockGroupItem)VisibleObjects[0]).GetDockTarget(item, px, py, Allocation, out dockDelegate, out rect));
            }
            else if (type == DockGroupType.Horizontal)
            {
                if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the right of the group
                    dockDelegate = delegate(DockItem it) {
                        DockTarget(it, dockObjects.Count);
                    };
                    rect = new Gdk.Rectangle(Allocation.Right - DockFrame.GroupDockSeparatorSize, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                    return(true);
                }
                else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the left of the group
                    dockDelegate = delegate(DockItem it) {
                        DockTarget(it, 0);
                    };
                    rect = new Gdk.Rectangle(Allocation.Left, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                    return(true);
                }
                // Dock in a separator
                for (int n = 0; n < VisibleObjects.Count; n++)
                {
                    DockObject ob = VisibleObjects [n];
                    if (n < VisibleObjects.Count - 1 &&
                        px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2 &&
                        px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize / 2)
                    {
                        int dn = dockObjects.IndexOf(ob);
                        dockDelegate = delegate(DockItem it) {
                            DockTarget(it, dn + 1);
                        };
                        rect = new Gdk.Rectangle(ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                        return(true);
                    }
                    else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect))
                    {
                        return(true);
                    }
                }
            }
            else if (type == DockGroupType.Vertical)
            {
                if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the bottom of the group
                    dockDelegate = delegate(DockItem it) {
                        DockTarget(it, dockObjects.Count);
                    };
                    rect = new Gdk.Rectangle(Allocation.X, Allocation.Bottom - DockFrame.GroupDockSeparatorSize, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                    return(true);
                }
                else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the top of the group
                    dockDelegate = delegate(DockItem it) {
                        DockTarget(it, 0);
                    };
                    rect = new Gdk.Rectangle(Allocation.X, Allocation.Top, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                    return(true);
                }
                // Dock in a separator
                for (int n = 0; n < VisibleObjects.Count; n++)
                {
                    DockObject ob = VisibleObjects [n];
                    if (n < VisibleObjects.Count - 1 &&
                        py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2 &&
                        py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize / 2)
                    {
                        int dn = dockObjects.IndexOf(ob);
                        dockDelegate = delegate(DockItem it) {
                            DockTarget(it, dn + 1);
                        };
                        rect = new Gdk.Rectangle(Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                        return(true);
                    }
                    else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect))
                    {
                        return(true);
                    }
                }
            }
            dockDelegate = null;
            rect         = Gdk.Rectangle.Zero;
            return(false);
        }
示例#5
0
文件: DockObject.cs 项目: rdafoe/Cage
 internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
示例#6
0
文件: DockFrame.cs 项目: rdafoe/Cage
 DockGroupItem AddDefaultItem(DockGroup grp, DockItem it)
 {
     return AddItemAtLocation (grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus);
 }
示例#7
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
 {
     container.UpdatePlaceholder (item, size, allowDocking);
 }
示例#8
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
 {
     container.UpdatePlaceholder(item, size, allowDocking);
 }
示例#9
0
 public DockGroupItem(DockFrame frame, DockItem item) : base(frame)
 {
     this.item   = item;
     visibleFlag = item.Visible;
 }
示例#10
0
 public DockGroupItem(DockFrame frame, DockItem item)
     : base(frame)
 {
     this.item = item;
     visibleFlag = item.Visible;
 }
示例#11
0
 internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
 {
     return GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect);
 }
示例#12
0
        public bool GetDockTarget(DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
        {
            dockDelegate = null;

            if (item != this.item && this.item.Visible && rect.Contains (px, py)) {
                int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
                int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2;
                DockPosition pos;

            /*				if (ParentGroup.Type == DockGroupType.Tabbed) {
                    rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
                    pos = DockPosition.CenterAfter;
                }
            */				if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
                    outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);
                    pos = DockPosition.Left;
                }
                else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
                    outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height);
                    pos = DockPosition.Right;
                }
                else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
                    outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);
                    pos = DockPosition.Top;
                }
                else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
                    outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin);
                    pos = DockPosition.Bottom;
                }
                else {
                    outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2);
                    pos = DockPosition.Center;
                }

                dockDelegate = delegate (DockItem dit) {
                    DockGroupItem it = ParentGroup.AddObject (dit, pos, Id);
                    it.SetVisible (true);
                    ParentGroup.FocusItem (it);
                };
                return true;
            }
            outrect = Gdk.Rectangle.Zero;
            return false;
        }
示例#13
0
 public override void CopyFrom(DockObject ob)
 {
     base.CopyFrom (ob);
     DockGroupItem it = (DockGroupItem)ob;
     item = it.item;
     visibleFlag = it.visibleFlag;
     floatRect = it.floatRect;
 }
示例#14
0
文件: DockGroup.cs 项目: rdafoe/Cage
 void DockTarget(DockItem item, int n)
 {
     DockGroupItem gitem = new DockGroupItem (Frame, item);
     dockObjects.Insert (n, gitem);
     gitem.ParentGroup = this;
     gitem.SetVisible (true);
     ResetVisibleGroups ();
     CalcNewSizes ();
 }
示例#15
0
文件: DockGroup.cs 项目: rdafoe/Cage
 internal void UpdateTitle(DockItem it)
 {
     if (it.Visible && type == DockGroupType.Tabbed && boundTabStrip != null)
         boundTabStrip.SetTabLabel (it.Widget, it.Icon, it.Label);
 }
示例#16
0
        public DockGroupItem AddObject(DockItem obj, DockPosition pos, string relItemId)
        {
            int npos = -1;

            if (relItemId != null)
            {
                for (int n = 0; n < dockObjects.Count; n++)
                {
                    DockGroupItem it = dockObjects [n] as DockGroupItem;
                    if (it != null && it.Id == relItemId)
                    {
                        npos = n;
                    }
                }
            }

            if (npos == -1)
            {
                if (pos == DockPosition.Left || pos == DockPosition.Top)
                {
                    npos = 0;
                }
                else
                {
                    npos = dockObjects.Count - 1;
                }
            }

            DockGroupItem gitem = null;

            if (pos == DockPosition.Left || pos == DockPosition.Right)
            {
                if (type != DockGroupType.Horizontal)
                {
                    gitem = Split(DockGroupType.Horizontal, pos == DockPosition.Left, obj, npos);
                }
                else
                {
                    gitem = InsertObject(obj, npos, pos);
                }
            }
            else if (pos == DockPosition.Top || pos == DockPosition.Bottom)
            {
                if (type != DockGroupType.Vertical)
                {
                    gitem = Split(DockGroupType.Vertical, pos == DockPosition.Top, obj, npos);
                }
                else
                {
                    gitem = InsertObject(obj, npos, pos);
                }
            }
            else if (pos == DockPosition.CenterBefore || pos == DockPosition.Center)
            {
                if (type != DockGroupType.Tabbed)
                {
                    gitem = Split(DockGroupType.Tabbed, pos == DockPosition.CenterBefore, obj, npos);
                }
                else
                {
                    if (pos == DockPosition.Center)
                    {
                        npos++;
                    }
                    gitem = new DockGroupItem(Frame, obj);
                    dockObjects.Insert(npos, gitem);
                    gitem.ParentGroup = this;
                }
            }
            ResetVisibleGroups();
            return(gitem);
        }
示例#17
0
        internal bool UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
        {
            if (placeholderWindow == null)
                return false;

            int px, py;
            GetPointer (out px, out py);

            placeholderWindow.AllowDocking = allowDocking;

            DockDelegate dockDelegate;
            Gdk.Rectangle rect;
            if (allowDocking && layout.GetDockTarget (item, px, py, out dockDelegate, out rect)) {
                int ox, oy;
                GdkWindow.GetOrigin (out ox, out oy);

                placeholderWindow.Relocate (ox + rect.X, oy + rect.Y, rect.Width, rect.Height, true);
                placeholderWindow.Show ();
                return true;
            } else {
                int ox, oy;
                GdkWindow.GetOrigin (out ox, out oy);
                placeholderWindow.Relocate (ox + px - size.Width / 2, oy + py - 18, size.Width, size.Height, false);
                placeholderWindow.Show ();
            }
            return false;
        }
示例#18
0
文件: DockFrame.cs 项目: rdafoe/Cage
        public DockItem AddItem(string id)
        {
            foreach (DockItem dit in container.Items) {
                if (dit.Id == id) {
                    if (dit.IsPositionMarker) {
                        dit.IsPositionMarker = false;
                        return dit;
                    }
                    throw new InvalidOperationException ("An item with id '" + id + "' already exists.");
                }
            }

            DockItem it = new DockItem (this, id);
            container.Items.Add (it);
            return it;
        }
示例#19
0
文件: DockFrame.cs 项目: rdafoe/Cage
 DockGroupItem AddDefaultItem(DockGroup grp, DockItem it)
 {
     return(AddItemAtLocation(grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus));
 }
示例#20
0
文件: DockFrame.cs 项目: rdafoe/Cage
 public void RemoveItem(DockItem it)
 {
     if (container.Layout != null)
         container.Layout.RemoveItemRec (it);
     foreach (DockGroup grp in layouts.Values)
         grp.RemoveItemRec (it);
     container.Items.Remove (it);
 }
示例#21
0
文件: DockGroup.cs 项目: rdafoe/Cage
 internal void Present(DockItem it, bool giveFocus)
 {
     if (type == DockGroupType.Tabbed) {
         for (int n=0; n<VisibleObjects.Count; n++) {
             DockGroupItem dit = VisibleObjects[n] as DockGroupItem;
             if (dit.Item == it) {
                 currentTabPage = n;
                 if (boundTabStrip != null)
                     boundTabStrip.CurrentPage = it.Widget;
                 break;
             }
         }
     }
     if (giveFocus && it.Visible)
         it.SetFocus ();
 }
示例#22
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void AutoHide(DockItem item, AutoHideBox widget, bool animate)
 {
     if (animate) {
         widget.Hidden += delegate {
             if (!widget.Disposed)
                 AutoHide (item, widget, false);
         };
         widget.AnimateHide ();
     }
     else {
         Gtk.Container parent = (Gtk.Container) item.Widget.Parent;
         parent.Remove (item.Widget);
         RemoveTopLevel (widget);
         widget.Disposed = true;
         widget.Destroy ();
     }
 }
示例#23
0
文件: DockFrame.cs 项目: rdafoe/Cage
        internal void UpdateTitle(DockItem item)
        {
            DockGroupItem gitem = container.FindDockGroupItem (item.Id);
            if (gitem == null)
                return;

            gitem.ParentGroup.UpdateTitle (item);
            dockBarTop.UpdateTitle (item);
            dockBarBottom.UpdateTitle (item);
            dockBarLeft.UpdateTitle (item);
            dockBarRight.UpdateTitle (item);
        }
示例#24
0
文件: DockFrame.cs 项目: rdafoe/Cage
        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;
        }
示例#25
0
文件: DockFrame.cs 项目: rdafoe/Cage
 DockGroupItem AddItemAtLocation(DockGroup grp, DockItem it, string location, bool visible, DockItemStatus status)
 {
     string[] positions = location.Split (';');
     foreach (string pos in positions) {
         int i = pos.IndexOf ('/');
         if (i == -1) continue;
         string id = pos.Substring (0,i).Trim ();
         DockGroup g = grp.FindGroupContaining (id);
         if (g != null) {
             DockPosition dpos;
             try {
                 dpos = (DockPosition) Enum.Parse (typeof(DockPosition), pos.Substring(i+1).Trim(), true);
             }
             catch {
                 continue;
             }
             DockGroupItem dgt = g.AddObject (it, dpos, id);
             dgt.SetVisible (visible);
             dgt.Status = status;
             return dgt;
         }
     }
     return null;
 }
示例#26
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size)
 {
     return GetDockBar (pos).AddItem (item, size);
 }
示例#27
0
        public DockItemContainer(DockFrame frame, DockItem item)
        {
            this.frame = frame;
            this.item  = item;

            ResizeMode = Gtk.ResizeMode.Queue;
            Spacing    = 0;

            title           = new Gtk.Label();
            title.Xalign    = 0;
            title.Xpad      = 3;
            title.UseMarkup = true;
            title.Ellipsize = Pango.EllipsizeMode.End;

            btnDock              = new Button(new Gtk.Image(pixAutoHide));
            btnDock.Relief       = ReliefStyle.None;
            btnDock.CanFocus     = false;
            btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked     += OnClickDock;

            btnClose              = new Button(new Gtk.Image(pixClose));
            btnClose.TooltipText  = Catalog.GetString("Hide");
            btnClose.Relief       = ReliefStyle.None;
            btnClose.CanFocus     = false;
            btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };

            HBox box = new HBox(false, 0);

            box.PackStart(title, true, true, 0);
            box.PackEnd(btnClose, false, false, 0);
            box.PackEnd(btnDock, false, false, 0);

            headerAlign            = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1;
            headerAlign.Add(box);

            header                     = new EventBox();
            header.Events             |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
            header.ButtonPressEvent   += HeaderButtonPress;
            header.ButtonReleaseEvent += HeaderButtonRelease;
            header.MotionNotifyEvent  += HeaderMotion;
            header.KeyPressEvent      += HeaderKeyPress;
            header.KeyReleaseEvent    += HeaderKeyRelease;
            header.Add(headerAlign);
            header.ExposeEvent += HeaderExpose;
            header.Realized    += delegate {
                header.GdkWindow.Cursor = handCursor;
            };

            foreach (Widget w in new Widget [] { header, btnDock, btnClose })
            {
                w.EnterNotifyEvent += HeaderEnterNotify;
                w.LeaveNotifyEvent += HeaderLeaveNotify;
            }

            PackStart(header, false, false, 0);
            ShowAll();

            PackStart(item.GetToolbar(PositionType.Top).Container, false, false, 0);

            HBox hbox = new HBox();

            hbox.Show();
            hbox.PackStart(item.GetToolbar(PositionType.Left).Container, false, false, 0);

            contentBox = new HBox();
            contentBox.Show();
            hbox.PackStart(contentBox, true, true, 0);

            hbox.PackStart(item.GetToolbar(PositionType.Right).Container, false, false, 0);

            PackStart(hbox, true, true, 0);

            PackStart(item.GetToolbar(PositionType.Bottom).Container, false, false, 0);

            UpdateBehavior();
        }
示例#28
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void DockInPlaceholder(DockItem item)
 {
     container.DockInPlaceholder (item);
 }
示例#29
0
        public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
        {
            this.position   = pos;
            this.frame      = frame;
            this.targetSize = size;
            horiz           = pos == PositionType.Left || pos == PositionType.Right;
            startPos        = pos == PositionType.Top || pos == PositionType.Left;
            Events          = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;

            Box         fr;
            CustomFrame cframe = new CustomFrame();

            switch (pos)
            {
            case PositionType.Left: cframe.SetMargins(1, 1, 0, 1); break;

            case PositionType.Right: cframe.SetMargins(1, 1, 1, 0); break;

            case PositionType.Top: cframe.SetMargins(0, 1, 1, 1); break;

            case PositionType.Bottom: cframe.SetMargins(1, 0, 1, 1); break;
            }
            EventBox sepBox = new EventBox();

            cframe.Add(sepBox);

            if (horiz)
            {
                fr = new HBox();
                sepBox.Realized    += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
                sepBox.WidthRequest = gripSize;
            }
            else
            {
                fr = new VBox();
                sepBox.Realized     += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
                sepBox.HeightRequest = gripSize;
            }

            sepBox.Events = EventMask.AllEventsMask;

            if (pos == PositionType.Left || pos == PositionType.Top)
            {
                fr.PackEnd(cframe, false, false, 0);
            }
            else
            {
                fr.PackStart(cframe, false, false, 0);
            }

            Add(fr);
            ShowAll();
            Hide();

            scrollable            = new ScrollableContainer();
            scrollable.ScrollMode = false;
            scrollable.Show();

            item.Widget.Show();
            scrollable.Add(item.Widget);
            fr.PackStart(scrollable, true, true, 0);

            sepBox.ButtonPressEvent   += OnSizeButtonPress;
            sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
            sepBox.MotionNotifyEvent  += OnSizeMotion;
            sepBox.ExposeEvent        += OnGripExpose;
            sepBox.EnterNotifyEvent   += delegate { insideGrip = true; sepBox.QueueDraw(); };
            sepBox.LeaveNotifyEvent   += delegate { insideGrip = false; sepBox.QueueDraw(); };
        }
示例#30
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal DockItemStatus GetStatus(DockItem item)
 {
     DockGroupItem gitem = container.FindDockGroupItem (item.Id);
     if (gitem == null)
         return DockItemStatus.Dockable;
     return gitem.Status;
 }
示例#31
0
        DockGroupItem Split(DockGroupType newType, bool addFirst, DockItem obj, int npos)
        {
            DockGroupItem item = new DockGroupItem(Frame, obj);

            if (npos == -1 || type == DockGroupType.Tabbed)
            {
                if (ParentGroup != null && ParentGroup.Type == newType)
                {
                    // No need to split. Just add the new item as a sibling of this one.
                    int i = ParentGroup.Objects.IndexOf(this);
                    if (addFirst)
                    {
                        ParentGroup.Objects.Insert(i, item);
                    }
                    else
                    {
                        ParentGroup.Objects.Insert(i + 1, item);
                    }
                    item.ParentGroup = ParentGroup;
                    item.ResetDefaultSize();
                }
                else
                {
                    DockGroup grp = Copy();
                    dockObjects.Clear();
                    if (addFirst)
                    {
                        dockObjects.Add(item);
                        dockObjects.Add(grp);
                    }
                    else
                    {
                        dockObjects.Add(grp);
                        dockObjects.Add(item);
                    }
                    item.ParentGroup = this;
                    item.ResetDefaultSize();
                    grp.ParentGroup = this;
                    grp.ResetDefaultSize();
                    Type = newType;
                }
            }
            else
            {
                DockGroup  grp      = new DockGroup(Frame, newType);
                DockObject replaced = dockObjects[npos];
                if (addFirst)
                {
                    grp.AddObject(item);
                    grp.AddObject(replaced);
                }
                else
                {
                    grp.AddObject(replaced);
                    grp.AddObject(item);
                }
                grp.CopySizeFrom(replaced);
                dockObjects [npos] = grp;
                grp.ParentGroup    = this;
            }
            return(item);
        }
示例#32
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal bool GetVisible(DockItem item)
 {
     DockGroupItem gitem = container.FindDockGroupItem (item.Id);
     if (gitem == null)
         return false;
     return gitem.VisibleFlag;
 }
示例#33
0
        internal void DockInPlaceholder(DockItem item)
        {
            if (placeholderWindow == null || !placeholderWindow.Visible)
                return;

            item.Status = DockItemStatus.Dockable;

            int px, py;
            GetPointer (out px, out py);

            DockDelegate dockDelegate;
            Gdk.Rectangle rect;
            if (placeholderWindow.AllowDocking && layout.GetDockTarget (item, px, py, out dockDelegate, out rect)) {
                DockGroupItem dummyItem = new DockGroupItem (frame, new DockItem (frame, "__dummy"));
                DockGroupItem gitem = layout.FindDockGroupItem (item.Id);
                gitem.ParentGroup.ReplaceItem (gitem, dummyItem);
                dockDelegate (item);
                dummyItem.ParentGroup.Remove (dummyItem);
                RelayoutWidgets ();
            } else {
                DockGroupItem gi = FindDockGroupItem (item.Id);
                int pw, ph;
                placeholderWindow.GetPosition (out px, out py);
                placeholderWindow.GetSize (out pw, out ph);
                gi.FloatRect = new Rectangle (px, py, pw, ph);
                item.Status = DockItemStatus.Floating;
            }
        }
示例#34
0
文件: DockFrame.cs 项目: rdafoe/Cage
        internal bool GetVisible(DockItem item, string layoutName)
        {
            DockLayout dl;
            if (!layouts.TryGetValue (layoutName, out dl))
                return false;

            DockGroupItem gitem = dl.FindDockGroupItem (item.Id);
            if (gitem == null)
                return false;
            return gitem.VisibleFlag;
        }
示例#35
0
文件: DockObject.cs 项目: rdafoe/Cage
 internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
示例#36
0
文件: DockFrame.cs 项目: rdafoe/Cage
        internal void Present(DockItem item, bool giveFocus)
        {
            DockGroupItem gitem = container.FindDockGroupItem (item.Id);
            if (gitem == null)
                return;

            gitem.ParentGroup.Present (item, giveFocus);
        }
示例#37
0
 internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
 {
     return(GetDockTarget(item, px, py, Allocation, out dockDelegate, out rect));
 }
示例#38
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void SetDockLocation(DockItem item, string placement)
 {
     bool vis = item.Visible;
     DockItemStatus stat = item.Status;
     item.ResetMode ();
     container.Layout.RemoveItemRec (item);
     AddItemAtLocation (container.Layout, item, placement, vis, stat);
 }
示例#39
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void DockInPlaceholder(DockItem item)
 {
     container.DockInPlaceholder(item);
 }
示例#40
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal void SetStatus(DockItem item, DockItemStatus status)
 {
     DockGroupItem gitem = container.FindDockGroupItem (item.Id);
     if (gitem == null) {
         item.DefaultStatus = status;
         return;
     }
     gitem.StoreAllocation ();
     gitem.Status = status;
     container.RelayoutWidgets ();
 }
示例#41
0
文件: DockFrame.cs 项目: rdafoe/Cage
 internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size)
 {
     return(GetDockBar(pos).AddItem(item, size));
 }
示例#42
0
文件: DockFrame.cs 项目: rdafoe/Cage
        internal void SetVisible(DockItem item, bool visible)
        {
            if (container.Layout == null)
                return;
            DockGroupItem gitem = container.FindDockGroupItem (item.Id);

            if (gitem == null) {
                if (visible) {
                    // The item is not present in the layout. Add it now.
                    if (!string.IsNullOrEmpty (item.DefaultLocation))
                        gitem = AddDefaultItem (container.Layout, item);

                    if (gitem == null) {
                        // No default position
                        gitem = new DockGroupItem (this, item);
                        container.Layout.AddObject (gitem);
                    }
                } else
                    return; // Already invisible
            }
            gitem.SetVisible (visible);
            container.RelayoutWidgets ();
        }