public DockItemTitleTab(DockItem item, DockFrame frame)
        {
            this.item = item;
             this.frame = frame;
             this.VisibleWindow = false;
             UpdateVisualStyle();
             NoShowAll = true;

             Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask;
             KeyPressEvent += HeaderKeyPress;
             KeyReleaseEvent += HeaderKeyRelease;

             this.SubscribeLeaveEvent(OnLeave);
        }
        internal DockItemToolbar(DockItem parentItem, PositionType position)
        {
            this.parentItem = parentItem;

            topFrame = new CustomFrame ();
            topFrame.SetPadding (3,3,3,3);

            /*			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 = box;
            frame = topFrame;
            topFrame.Add (box);

            //			topFrame.GradientBackround = true;
        }
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     padTitleWindow = new PadTitleWindow(frame, draggedItem);
      placeholderWindow = new PlaceholderWindow(frame);
 }
        public bool GetDockTarget(DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
        {
            outrect = Gdk.Rectangle.Zero;
            dockDelegate = null;

            if (item != this.item && this.item.Visible && rect.Contains (px, py)) {

                // Check if the item is allowed to be docked here
                var s = Frame.GetRegionStyleForObject (this);

                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) {
                    if (s.SingleColumnMode.Value)
                        return false;
                    outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height);
                    pos = DockPosition.Left;
                }
                else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) {
                    if (s.SingleColumnMode.Value)
                        return false;
                    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) {
                    if (s.SingleRowMode.Value)
                        return false;
                    outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin);
                    pos = DockPosition.Top;
                }
                else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) {
                    if (s.SingleRowMode.Value)
                        return false;
                    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;
            }
            return false;
        }
 public DockGroupItem(DockFrame frame, DockItem item)
     : base(frame)
 {
     this.item = item;
     visibleFlag = item.Visible;
 }
Beispiel #6
0
 internal void AddItem(DockItem item)
 {
     container.Add(item);
 }
Beispiel #7
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(0, 0, 1, 1); break;

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

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

            case PositionType.Bottom: cframe.SetMargins(1, 1, 0, 0); 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();

#if ANIMATE_DOCKING
            scrollable            = new ScrollableContainer();
            scrollable.ScrollMode = false;
            scrollable.Show();
#endif
            VBox itemBox = new VBox();
            itemBox.Show();
            item.TitleTab.Active = true;
            itemBox.PackStart(item.TitleTab, false, false, 0);
            itemBox.PackStart(item.Widget, true, true, 0);

            item.Widget.Show();
#if ANIMATE_DOCKING
            scrollable.Add(itemBox);
            fr.PackStart(scrollable, true, true, 0);
#else
            fr.PackStart(itemBox, true, true, 0);
#endif

            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(); };
        }
Beispiel #8
0
 internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size)
 {
     return(GetDockBar(pos).AddItem(item, size));
 }
 internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size)
 {
     return GetDockBar (pos).AddItem (item, size);
 }
Beispiel #10
0
        internal void Present(DockItem item, bool giveFocus)
        {
            DockGroupItem gitem = container.FindDockGroupItem (item.Id);
            if (gitem == null)
                return;

            gitem.ParentGroup.Present (item, giveFocus);
        }
Beispiel #11
0
 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);
 }
Beispiel #12
0
 internal bool GetVisible(DockItem item)
 {
     DockGroupItem gitem = container.FindDockGroupItem (item.Id);
     if (gitem == null)
         return false;
     return gitem.VisibleFlag;
 }
Beispiel #13
0
        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;
        }
Beispiel #14
0
 internal DockItemStatus GetStatus(DockItem item)
 {
     DockGroupItem gitem = container.FindDockGroupItem (item.Id);
     if (gitem == null)
         return DockItemStatus.Dockable;
     return gitem.Status;
 }
Beispiel #15
0
 internal DockVisualStyle GetRegionStyleForItem(DockItem item)
 {
     DockVisualStyle s;
     if (stylesById.TryGetValue (item.Id, out s)) {
         var ds = DefaultVisualStyle.Clone ();
         ds.CopyValuesFrom (s);
         return ds;
     }
     return DefaultVisualStyle;
 }
Beispiel #16
0
 internal void DockInPlaceholder(DockItem item)
 {
     container.DockInPlaceholder (item);
 }
Beispiel #17
0
 public void UpdateStyle(DockItem item)
 {
     QueueResize();
 }
Beispiel #18
0
 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 ();
 }
Beispiel #19
0
 internal void DockInPlaceholder(DockItem item)
 {
     container.DockInPlaceholder(item);
 }
Beispiel #20
0
        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 ();
        }
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     padTitleWindow    = new PadTitleWindow(frame, draggedItem);
     placeholderWindow = new PlaceholderWindow(frame);
 }
Beispiel #22
0
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     container.ShowPlaceholder (draggedItem);
 }
Beispiel #23
0
 public void UpdateStyle(DockItem item)
 {
     QueueResize();
 }
Beispiel #24
0
 internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
 {
     container.UpdatePlaceholder (item, size, allowDocking);
 }
        public DockItemContainer(DockFrame frame, DockItem item)
        {
            this.item = item;

             mainBox = new VBox ();
             Add (mainBox);

             mainBox.ResizeMode = Gtk.ResizeMode.Queue;
             mainBox.Spacing = 0;
             mainBox.BorderWidth = 5;

             ShowAll ();

             mainBox.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);

             mainBox.PackStart (hbox, true, true, 0);

             mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
        }
Beispiel #26
0
        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);
        }
 public override void CopyFrom(DockObject ob)
 {
     base.CopyFrom (ob);
     DockGroupItem it = (DockGroupItem)ob;
     item = it.item;
     visibleFlag = it.visibleFlag;
     floatRect = it.floatRect;
 }
Beispiel #28
0
 DockGroupItem AddDefaultItem(DockGroup grp, DockItem it)
 {
     return AddItemAtLocation (grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus);
 }
 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);
 }
Beispiel #30
0
 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;
 }
        internal void DockInPlaceholder(DockItem item)
        {
            if (placeholderWindow == null || !placeholderWindow.Visible)
            return;

             if (placeholderWindow.AllowDocking && placeholderWindow.DockDelegate != null)
             {
            item.Status = DockItemStatus.Dockable;
            DockGroupItem dummyItem = new DockGroupItem(frame, new DockItem(frame, "__dummy"));
            DockGroupItem gitem = layout.FindDockGroupItem(item.Id);
            gitem.ParentGroup.ReplaceItem(gitem, dummyItem);
            placeholderWindow.DockDelegate(item);
            dummyItem.ParentGroup.Remove(dummyItem);
            RelayoutWidgets();
             }
             else
             {
            int px, py;
            GetPointer(out px, out py);
            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;
             }
        }
 internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
        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;

             int ox, oy;
             GdkWindow.GetOrigin(out ox, out oy);

             int tw, th;
             padTitleWindow.GetSize(out tw, out th);
             padTitleWindow.Move(ox + px - tw / 2, oy + py - th / 2);
             padTitleWindow.GdkWindow.KeepAbove = true;

             DockDelegate dockDelegate;
             Gdk.Rectangle rect;
             if (allowDocking && layout.GetDockTarget(item, px, py, out dockDelegate, out rect))
             {
            placeholderWindow.Relocate(ox + rect.X, oy + rect.Y, rect.Width, rect.Height, true);
            placeholderWindow.Show();
            placeholderWindow.SetDockInfo(dockDelegate, rect);
            return true;
             }
             else
             {
            int w, h;
            var gi = layout.FindDockGroupItem(item.Id);
            if (gi != null)
            {
               w = gi.Allocation.Width;
               h = gi.Allocation.Height;
            }
            else
            {
               w = item.DefaultWidth;
               h = item.DefaultHeight;
            }
            placeholderWindow.Relocate(ox + px - w / 2, oy + py - h / 2, w, h, false);
            placeholderWindow.Show();
            placeholderWindow.AllowDocking = false;
             }

             return false;
        }
 internal void Remove(DockItem item)
 {
     items.Remove(item.Id);
 }
Beispiel #35
0
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     container.ShowPlaceholder(draggedItem);
 }
Beispiel #36
0
 internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
Beispiel #37
0
 internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
 {
     container.UpdatePlaceholder(item, size, allowDocking);
 }
        public bool GetDockTarget(DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect)
        {
            outrect      = Gdk.Rectangle.Zero;
            dockDelegate = null;

            if (item != this.item && this.item.Visible && rect.Contains(px, py))
            {
                // Check if the item is allowed to be docked here
                var s = Frame.GetRegionStyleForObject(this);

                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)
                {
                    if (s.SingleColumnMode.Value)
                    {
                        return(false);
                    }
                    outrect = new Gdk.Rectangle(rect.X, rect.Y, xdockMargin, rect.Height);
                    pos     = DockPosition.Left;
                }
                else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal)
                {
                    if (s.SingleColumnMode.Value)
                    {
                        return(false);
                    }
                    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)
                {
                    if (s.SingleRowMode.Value)
                    {
                        return(false);
                    }
                    outrect = new Gdk.Rectangle(rect.X, rect.Y, rect.Width, ydockMargin);
                    pos     = DockPosition.Top;
                }
                else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical)
                {
                    if (s.SingleRowMode.Value)
                    {
                        return(false);
                    }
                    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);
            }
            return(false);
        }
Beispiel #39
0
 DockGroupItem AddDefaultItem(DockGroup grp, DockItem it)
 {
     return(AddItemAtLocation(grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus));
 }
Beispiel #40
0
 internal void UpdateStyle(DockItem item)
 {
 }
 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));
 }
Beispiel #42
0
        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 DockGroupItem(DockFrame frame, DockItem item) : base(frame)
 {
     this.item   = item;
     visibleFlag = item.Visible;
 }
        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();
             };
        }
        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 (0, 0, 1, 1); break;
                case PositionType.Right: cframe.SetMargins (0, 0, 1, 1); break;
                case PositionType.Top: cframe.SetMargins (1, 1, 0, 0); break;
                case PositionType.Bottom: cframe.SetMargins (1, 1, 0, 0); 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();

            #if ANIMATE_DOCKING
                scrollable = new ScrollableContainer();
                scrollable.ScrollMode = false;
                scrollable.Show();
            #endif
            VBox itemBox = new VBox ();
            itemBox.Show ();
            item.TitleTab.Active = true;
            itemBox.PackStart (item.TitleTab, false, false, 0);
            itemBox.PackStart (item.Widget, true, true, 0);

            item.Widget.Show();
            #if ANIMATE_DOCKING
            scrollable.Add (itemBox);
                fr.PackStart(scrollable, true, true, 0);
            #else
            fr.PackStart (itemBox, true, true, 0);
            #endif

            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 (); };
        }
Beispiel #46
0
        public TabSelector(bool active)
        {
            Active      = active;
            ActiveIndex = -1;
            mTracker    = new MouseTracker(this)
            {
                MotionEvents        = true,
                EnterLeaveEvents    = true,
                ButtonPressedEvents = true
            };

            mTracker.EnterNotify += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.LeaveNotify += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.MouseMoved += (sender, e) =>
            {
                QueueDraw();
            };

            mTracker.ButtonPressed += (sender, e) =>
            {
                if (e.Event.TriggersContextMenu())
                {
                    int index;
                    if (CalculateIndexAtPosition(mTracker.MousePosition.X, out index))
                    {
                        var t = mTabs.ElementAt(index).DockItemTitleTab;
                        if (t != null)
                        {
                            t.item.ShowDockPopupMenu(e.Event.Time, this);
                        }
                    }
                }
                else if (e.Event.Button == 1 && e.Event.Type == Gdk.EventType.ButtonPress)
                {
                    int index;
                    if (CalculateIndexAtPosition(mTracker.MousePosition.X, out index))
                    {
                        if (ActiveIndex != index)
                        {
                            ActiveIndex = index;
                            CurrentTab  = ActiveIndex;
                            if (SelectTab != null)
                            {
                                SelectTab(this, new SelectTabEventArgs(ActiveIndex, true));
                            }
                            QueueDraw();
                        }
                        // else
                        {
                            tabPressed = true;
                            pressX     = e.Event.X;
                            pressY     = e.Event.Y;
                        }
                    }
                }
            };

            mTracker.ButtonReleased += (sender, e) =>
            {
                const int LEFT_MOUSE_BUTTON = 1;

                var t = mTabs.ElementAt(m_CurrentTab).DockItemTitleTab;
                if (tabActivated)
                {
                    tabActivated = false;
                    if (t.item.Status == DockItemStatus.AutoHide)
                    {
                        t.item.Status = DockItemStatus.Dockable;
                    }
                    else
                    {
                        t.item.Status = DockItemStatus.AutoHide;
                    }
                }
                else if (!e.Event.TriggersContextMenu() && e.Event.Button == LEFT_MOUSE_BUTTON)
                {
                    t.frame.DockInPlaceholder(t.item);
                    t.frame.HidePlaceholder();
                    if (GdkWindow != null)
                    {
                        GdkWindow.Cursor = null;
                    }
                    t.frame.Toplevel.KeyPressEvent   -= HeaderKeyPress;
                    t.frame.Toplevel.KeyReleaseEvent -= HeaderKeyRelease;
                    DockItem.SetFocus(t.Page);
                }
                tabPressed = false;
            };

            mTracker.MouseMoved += (sender, e) =>
            {
                if (m_CurrentTab != -1)
                {
                    var t = mTabs.ElementAt(m_CurrentTab).DockItemTitleTab;

                    if (tabPressed && !t.item.Behavior.HasFlag(DockItemBehavior.NoGrip) && Math.Abs(e.Event.X - pressX) > 3 && Math.Abs(e.Event.Y - pressY) > 3)
                    {
                        t.frame.ShowPlaceholder(t.item);
                        GdkWindow.Cursor = fleurCursor;
                        t.frame.Toplevel.KeyPressEvent   += HeaderKeyPress;
                        t.frame.Toplevel.KeyReleaseEvent += HeaderKeyRelease;
                        allowPlaceholderDocking           = true;
                        tabPressed = false;
                    }
                    t.frame.UpdatePlaceholder(t.item, Allocation.Size, allowPlaceholderDocking);
                }
            };
        }