Exemple #1
0
 public void EndDragBar(DockToolbar bar)
 {
     if (IsPlaceHolderVisible)
     {
         HidePlaceholder();
     }
 }
Exemple #2
0
        public void DropDragBar(DockToolbar bar)
        {
            if (!IsPlaceHolderVisible)
            {
                return;
            }

            foreach (DockToolbar b in bars)
            {
                if (b.DockRow == dropRow && b.DockShiftOffset != -1)
                {
                    b.DockShiftOffset = -1;
                    b.AnchorOffset    = b.DockRow;
                }
            }

            if (dropRow != -1)
            {
                if (dropNewRow)
                {
                    InsertRow(bar, dropOffset, dropRow);
                }
                else
                {
                    MoveBar(bar, dropOffset, dropRow);
                    UpdateRowHeight(dropRow);
                }
                SortBars();
                dropRow = -1;
            }
        }
Exemple #3
0
        void RestoreStatus(DockToolbarStatus[] status)
        {
            foreach (IDockToolbar b in bars)
            {
                b.Visible = false;
            }

            if (status == null)
            {
                foreach (DockToolbar bar in bars)
                {
                    bar.Status = bar.DefaultStatus;
                }
            }
            else
            {
                foreach (DockToolbarStatus s in status)
                {
                    DockToolbar bar = (DockToolbar)GetBar(s.BarId);
                    if (bar != null)
                    {
                        bar.Status = s;
                    }
                }
            }
        }
Exemple #4
0
		internal static DockToolbarPosition Create (DockToolbar bar)
		{
			if (bar.Floating)
				return new FloatingPosition (bar);
			else
				return new DockedPosition (bar);
		} 
Exemple #5
0
        public void AddDockToolbar(DockToolbar bar)
        {
            bool ea = EnableAnimation(false);

            Put(bar, 0, 0);
            bar.Orientation = orientation;

            if (bars.Count > 0 && IsRealized)
            {
                DockToolbar last  = (DockToolbar)bars [bars.Count - 1];
                int         width = bar.DefaultSize;
                int         lastx = last.DockOffset + last.DefaultSize;

                if (lastx + width <= PanelWidth)
                {
                    MoveBar(bar, lastx, last.DockRow, false);
                }
                else
                {
                    MoveBar(bar, 0, last.DockRow + 1, false);
                }
                bar.AnchorOffset = bar.DockOffset;
                InternalAdd(bar);
                SortBars();
            }
            else
            {
                MoveBar(bar, 0, 0);
                bar.AnchorOffset = bar.DockOffset;
                InternalAdd(bar);
            }

            EnableAnimation(ea);
        }
Exemple #6
0
        void ShowPlaceholder(DockToolbar bar, bool horz, int x, int y, int w, int h)
        {
            if (orientation != Orientation.Horizontal)
            {
                horz = !horz;
            }

            PanelToWindow(x, y, w, h, out x, out y, out w, out h);

            bool created = false;

            if (placeholder == null || horz != currentPlaceholderHorz)
            {
                HidePlaceholder();
                placeholder            = new PlaceholderWindow(parentFrame);
                placeholderArrow1      = new ArrowWindow(parentFrame, horz ? ArrowWindow.Direction.Right : ArrowWindow.Direction.Down);
                placeholderArrow2      = new ArrowWindow(parentFrame, horz ? ArrowWindow.Direction.Left : ArrowWindow.Direction.Up);
                currentPlaceholderHorz = horz;
                created = true;
            }

            int sx, sy;

            this.GdkWindow.GetOrigin(out sx, out sy);
            sx += x;
            sy += y;

            int mg = -4;

            placeholder.Move(sx - mg, sy - mg);
            placeholder.Resize(w + mg * 2, h + mg * 2);

            if (horz)
            {
                placeholderArrow1.Move(sx - placeholderArrow1.Width, sy + (h / 2) - placeholderArrow1.Height / 2);
                placeholderArrow2.Move(sx + w, sy + (h / 2) - placeholderArrow1.Height / 2);
            }
            else
            {
                int px = sx + w / 2 - placeholderArrow1.Width / 2;
                if (px < 0)
                {
                    px = 0;
                }
                placeholderArrow1.Move(px, sy - placeholderArrow1.Height);
                placeholderArrow2.Move(px, sy + h);
            }

            if (created)
            {
                placeholder.Show();
                placeholder.Present();
                if (bar.FloatingDock != null)
                {
                    bar.FloatingDock.Present();
                }
                placeholderArrow1.Present();
                placeholderArrow2.Present();
            }
        }
Exemple #7
0
        public int Compare(object a, object b)
        {
            DockToolbar b1 = (DockToolbar)a;
            DockToolbar b2 = (DockToolbar)b;

            if (b1.DockRow < b2.DockRow)
            {
                return(-1);
            }
            else if (b1.DockRow > b2.DockRow)
            {
                return(1);
            }
            else if (b1.DockOffset < b2.DockOffset)
            {
                return(-1);
            }
            else if (b1.DockOffset > b2.DockOffset)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemple #8
0
        void MoveBar(DockToolbar bar, int x, int row, bool setAnchorOffset)
        {
            int rt = GetRowTop(row);

            bar.DockRow    = row;
            bar.DockOffset = x;

            if (bar.Floating)
            {
                FloatingDock win = bar.FloatingDock;
                win.Detach();
                win.Destroy();

                InternalAdd(bar);
                Put(bar, x, rt);
                SortBars();
                ResetAnchorOffsets(row);
            }
            else
            {
                if (setAnchorOffset)
                {
                    ResetAnchorOffsets(row);
                }

                InternalMove(bar, x, rt, true);
            }
        }
Exemple #9
0
		public void AddDockToolbar (DockToolbar bar)
		{
			bool ea = EnableAnimation (false);

			Put (bar, 0, 0);
			bar.Orientation = orientation;
			
			if (bars.Count > 0 && IsRealized) {
				DockToolbar last = (DockToolbar) bars [bars.Count - 1];
				int width = bar.DefaultSize;
				int lastx = last.DockOffset + last.DefaultSize;
				
				if (lastx + width <= PanelWidth)
					MoveBar (bar, lastx, last.DockRow, false);
				else
					MoveBar (bar, 0, last.DockRow + 1, false);
				bar.AnchorOffset = bar.DockOffset;
				InternalAdd (bar);
				SortBars ();
			} else {
				MoveBar (bar, 0, 0);
				bar.AnchorOffset = bar.DockOffset;
				InternalAdd (bar);
			}

			EnableAnimation (ea);
		}
Exemple #10
0
        public void RemoveToolbar(DockToolbar bar)
        {
            IDockToolbar db = (IDockToolbar)bar;

            db.Visible = false;
            bar.Destroy();
            bars.Remove(bar);
        }
Exemple #11
0
        internal void FloatBar(DockToolbar bar, Orientation orientation, int x, int y)
        {
            FloatingDock fdock = new FloatingDock(this);

            fdock.Move(x, y);
            bar.ResetSize();
            fdock.Attach(bar);
            bar.Orientation = orientation;
        }
Exemple #12
0
 DockToolbarStatus[] SaveStatus()
 {
     DockToolbarStatus[] status = new DockToolbarStatus [bars.Count];
     for (int n = 0; n < bars.Count; n++)
     {
         DockToolbar bar = (DockToolbar)bars [n];
         status [n] = bar.Status;
     }
     return(status);
 }
Exemple #13
0
 internal void EndDragBar(DockToolbar bar, uint time)
 {
     Pointer.Ungrab(time);
     if (targetPanel != null)
     {
         targetPanel.DropDragBar(bar);
         targetPanel.EndDragBar(bar);
     }
     dragBar = null;
 }
Exemple #14
0
 internal static DockToolbarPosition Create(DockToolbar bar)
 {
     if (bar.Floating)
     {
         return(new FloatingPosition(bar));
     }
     else
     {
         return(new DockedPosition(bar));
     }
 }
Exemple #15
0
		public void Attach (DockToolbar bar)
		{
			this.bar = bar;
			bar.FloatingDock = this;
			Frame f = new Frame ();
			f.Shadow = ShadowType.Out;
			f.Add (bar);
			Add (f);
			f.Show ();
			bar.Show ();
			Show ();
		}
Exemple #16
0
 int GetPanelBottom()
 {
     if (bars.Count > 0)
     {
         DockToolbar bar = (DockToolbar)bars [bars.Count - 1];
         return(GetRowTop(bar.DockRow + 1));
     }
     else
     {
         return(0);
     }
 }
Exemple #17
0
        int GetBarReduction(DockToolbar bar, int sizeToReduce, int currentReduction)
        {
            Gtk.Widget[] children  = bar.Children;
            int          w         = bar.DefaultSize;
            int          arrowSize = 0;

            bar.Forall(delegate(Gtk.Widget wa) {
                if (wa is ToggleButton)
                {
                    arrowSize = bar.Orientation == Orientation.Horizontal ? wa.SizeRequest().Width : wa.SizeRequest().Height;
                }
            });
            for (int n = children.Length - 1; n >= 1; n--)
            {
                if (!children [n].Visible)
                {
                    continue;
                }
                int x;
                if (bar.Orientation == Orientation.Horizontal)
                {
                    x = children [n].Allocation.X - bar.Allocation.X;
                }
                else
                {
                    x = children [n].Allocation.Y - bar.Allocation.Y;
                }
                int rightSize = w - x - 1;
                if (rightSize > currentReduction)
                {
                    int prevRequest = Orientation == Orientation.Horizontal ? children [n - 1].SizeRequest().Width : children [n - 1].SizeRequest().Height;
                    if (prevRequest > arrowSize * 2)
                    {
                        continue;
                    }
                    int newReduction = rightSize - currentReduction;
                    if (newReduction > sizeToReduce)
                    {
                        newReduction = sizeToReduce;
                    }

                    int minSize = Orientation == Orientation.Horizontal ? children[0].SizeRequest().Width : children[0].SizeRequest().Height;
                    minSize += arrowSize + 6;
                    if (bar.DefaultSize - (currentReduction + newReduction) < minSize)
                    {
                        newReduction = (bar.DefaultSize - minSize) - currentReduction;
                    }

                    return(newReduction);
                }
            }
            return(0);
        }
Exemple #18
0
 internal void StartDragBar(DockToolbar bar, int x, int y, uint time)
 {
     dragBar  = bar;
     xDragDif = -x;
     yDragDif = -y;
     Pointer.Grab(this.GdkWindow, false, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, handCursor, time);
     if (!bar.Floating)
     {
         DockToolbarPanel panel = (DockToolbarPanel)dragBar.Parent;
         panel.StartDragBar(bar);
     }
 }
Exemple #19
0
        public IDockToolbar AddBar(DockToolbar bar, Placement defaultPanel, bool defaultVisible)
        {
            bar.SetParentFrame(this);
            bars.Add(bar);

            DockToolbarPosition pos = new DockedPosition(defaultPanel);
            DockToolbarStatus   s   = new DockToolbarStatus(bar.Id, defaultVisible, pos);

            bar.DefaultStatus = s;
            bar.Status        = s;

            return(bar);
        }
Exemple #20
0
        internal void DockToolbar(DockToolbar bar, Placement placement, int offset, int row)
        {
            DockToolbarPanel p = GetPanel(placement);

            if (row != -1)
            {
                p.AddDockToolbar(bar, offset, row);
            }
            else
            {
                p.AddDockToolbar(bar);
            }
        }
Exemple #21
0
        public void Attach(DockToolbar bar)
        {
            this.bar         = bar;
            bar.FloatingDock = this;
            Frame f = new Frame();

            f.Shadow = ShadowType.Out;
            f.Add(bar);
            Add(f);
            f.Show();
            bar.Show();
            Show();
        }
Exemple #22
0
        bool IsSingleBarRow(DockToolbar bar)
        {
            int row = bar.DockRow;

            foreach (DockToolbar b in bars)
            {
                if (bar != b && b.DockRow == row)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #23
0
 void InsertRow(DockToolbar ibar, int offset, int row)
 {
     MoveBar(ibar, offset, row);
     foreach (DockToolbar bar in bars)
     {
         if (ibar != bar && bar.DockRow >= row)
         {
             bar.DockRow++;
         }
     }
     SortBars();
     UpdateRowHeight(row);
 }
Exemple #24
0
        public void AddDockToolbar(DockToolbar bar, int offset, int row)
        {
            bool ea = EnableAnimation(false);

            InternalAdd(bar);
            Put(bar, 0, 0);
            bar.Orientation = orientation;
            MoveBar(bar, offset, row, false);
            bar.AnchorOffset = offset;
            SortBars();
            UpdateRowSizes(bar.DockRow);
            EnableAnimation(ea);
        }
Exemple #25
0
        void SetPlaceholder(DockToolbar bar, int offset, int row)
        {
            if (dropRow != row && dropRow != -1)
            {
                RestoreShiftedBars(dropRow);
            }

            ShowPlaceholder(bar, false, offset, GetRowTop(row), GetChildWidth(bar), GetRowSize(row));

            dropOffset = offset;
            dropRow    = row;
            dropNewRow = false;
        }
Exemple #26
0
        public void RemoveBar(DockToolbar bar)
        {
            if (IsSingleBarRow(bar))
            {
                RemoveRow(bar.DockRow);
            }

            Remove(bar);
            bars.Remove(bar);
            bar.DefaultSizeChanged -= new EventHandler(OnBarSizeChanged);

            UpdateRowHeight(bar.DockRow);
            PackBars();
        }
Exemple #27
0
        void FloatBar(DockToolbar bar, int x, int y)
        {
            if (bar.Floating)
            {
                return;
            }

            int wx, wy, w, h;

            PanelToWindow(x, y, GetChildWidth(bar), bar.DefaultHeight, out x, out y, out w, out h);

            this.GdkWindow.GetOrigin(out wx, out wy);
            RemoveBar(bar);
            parentFrame.FloatBar(bar, orientation, wx + x, wy + y);
        }
Exemple #28
0
        public void Reposition(DockToolbar bar, int xcursor, int ycursor, int difx, int dify)
        {
            if (!bar.CanDockTo(this))
            {
                return;
            }

            bar.Orientation = orientation;

            int x, y;

            WindowToPanel(xcursor + difx, ycursor + dify, bar.Allocation.Width, bar.Allocation.Height, out x, out y);
            WindowToPanel(xcursor, ycursor, 0, 0, out xcursor, out ycursor);

            RepositionInternal(bar, x, y, xcursor, ycursor);
        }
Exemple #29
0
        void UpdateRowHeight(int row)
        {
            int  nr = row + 1;
            bool ea = EnableAnimation(false);

            for (int n = 0; n < bars.Count; n++)
            {
                DockToolbar b = (DockToolbar)bars [n];
                if (b.DockRow < nr)
                {
                    continue;
                }
                MoveBar(b, b.DockOffset, b.DockRow);
            }
            EnableAnimation(ea);
        }
Exemple #30
0
 void ResetAnchorOffsets(int row)
 {
     for (int n = 0; n < bars.Count; n++)
     {
         DockToolbar b = (DockToolbar)bars [n];
         if (b.DockRow < row)
         {
             continue;
         }
         if (b.DockRow > row)
         {
             return;
         }
         b.AnchorOffset = b.DockOffset;
     }
 }
Exemple #31
0
        void SetNewRowPlaceholder(DockToolbar bar, int offset, int toprow)
        {
            if (dropRow != -1)
            {
                RestoreShiftedBars(dropRow);
            }

            int y = GetRowTop(toprow) - parentFrame.DockMargin;
            int h = parentFrame.DockMargin * 2;

            ShowPlaceholder(bar, true, offset, y, GetChildWidth(bar), h);

            dropOffset = offset;
            dropRow    = toprow;
            dropNewRow = true;
        }
Exemple #32
0
        void InternalMove(DockToolbar bar, int x, int y, bool animate)
        {
            if (bar.Animation != null)
            {
                bar.Animation.Cancel();
                bar.Animation = null;
            }

            if (animate && enableAnimations)
            {
                bar.Animation = new MoveAnimation(this, bar, x, y);
                bar.Animation.Start();
            }
            else
            {
                Move(bar, x, y);
            }
        }
Exemple #33
0
        int GetRowSize(int row)
        {
            int max = 0;

            for (int n = 0; n < bars.Count; n++)
            {
                DockToolbar b = (DockToolbar)bars [n];
                if (b.DockRow < row)
                {
                    continue;
                }
                if (b.DockRow > row)
                {
                    return(max);
                }
                max = Math.Max(b.DefaultHeight, max);
            }
            return(max);
        }
Exemple #34
0
		public void DropDragBar (DockToolbar bar)
		{
			if (!IsPlaceHolderVisible) return;
			
			foreach (DockToolbar b in bars) {
				if (b.DockRow == dropRow && b.DockShiftOffset != -1) {
					b.DockShiftOffset = -1;
					b.AnchorOffset = b.DockRow;
				}
			}
			
			if (dropRow != -1) {
				if (dropNewRow)
					InsertRow (bar, dropOffset, dropRow);
				else {
					MoveBar (bar, dropOffset, dropRow);
					UpdateRowHeight (dropRow);
				}
				SortBars ();
				dropRow = -1;
			}
		}
Exemple #35
0
		internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
		{
			frame.FloatBar (bar, orientation, x, y);
		}
Exemple #36
0
		public void EndDragBar (DockToolbar bar)
		{
			if (IsPlaceHolderVisible) {
				HidePlaceholder ();
			}
		}
Exemple #37
0
		void InternalAdd (DockToolbar bar)
		{
			bars.Add (bar);
			bar.DefaultSizeChanged += new EventHandler (OnBarSizeChanged);
		}
Exemple #38
0
		internal FloatingPosition (DockToolbar bar)
		{
			orientation = bar.Orientation;
			bar.FloatingDock.GetPosition (out x, out y);
		}
Exemple #39
0
		void MoveBar (DockToolbar bar, int x, int row, bool setAnchorOffset)
		{
			int rt = GetRowTop (row);

			bar.DockRow = row;
			bar.DockOffset = x;
			
			if (bar.Floating) {
				FloatingDock win = bar.FloatingDock;
				win.Detach ();
				win.Destroy ();
				
				InternalAdd (bar);
				Put (bar, x, rt);
				SortBars ();
				ResetAnchorOffsets (row);
				
			} else {
				if (setAnchorOffset)
					ResetAnchorOffsets (row);

				InternalMove (bar, x, rt, true);
			}
		}
Exemple #40
0
		void InsertRow (DockToolbar ibar, int offset, int row)
		{
			MoveBar (ibar, offset, row);
			foreach (DockToolbar bar in bars) {
				if (ibar != bar && bar.DockRow >= row)
					bar.DockRow++;
			}
			SortBars ();
			UpdateRowHeight (row);
		}
Exemple #41
0
		public void Reposition (DockToolbar bar, int xcursor, int ycursor, int difx, int dify)
		{
			if (!bar.CanDockTo (this))
				return;

			bar.Orientation = orientation;
			
			int x, y;
			WindowToPanel (xcursor + difx, ycursor + dify, bar.Allocation.Width, bar.Allocation.Height, out x, out y);
			WindowToPanel (xcursor, ycursor, 0, 0, out xcursor, out ycursor);
			
			RepositionInternal (bar, x, y, xcursor, ycursor);
		}
Exemple #42
0
		bool IsSingleBarRow (DockToolbar bar)
		{
			int row = bar.DockRow;
			foreach (DockToolbar b in bars) {
				if (bar != b && b.DockRow == row)
					return false;
			}
			return true;
		}
Exemple #43
0
		public void AddDockToolbar (DockToolbar bar, int offset, int row)
		{
			bool ea = EnableAnimation (false);
			InternalAdd (bar);
			Put (bar, 0, 0);
			bar.Orientation = orientation;
			MoveBar (bar, offset, row, false);
			bar.AnchorOffset = offset;
			SortBars ();
			UpdateRowSizes (bar.DockRow);
			EnableAnimation (ea);
		}
Exemple #44
0
		int GetBarReduction (DockToolbar bar, int sizeToReduce, int currentReduction)
		{
			Gtk.Widget[] children = bar.Children;
			int w = bar.DefaultSize;
			int arrowSize = 0;
			bar.Forall (delegate (Gtk.Widget wa) {
				if (wa is ToggleButton) {
					arrowSize = bar.Orientation == Orientation.Horizontal ? wa.SizeRequest ().Width : wa.SizeRequest ().Height;
				}
			});
			for (int n=children.Length - 1; n >= 1; n--) {
				if (!children [n].Visible)
					continue;
				int x;
				if (bar.Orientation == Orientation.Horizontal)
					x = children [n].Allocation.X - bar.Allocation.X;
				else
					x = children [n].Allocation.Y - bar.Allocation.Y;
				int rightSize = w - x - 1;
				if (rightSize > currentReduction) {
					int prevRequest = Orientation == Orientation.Horizontal ? children [n-1].SizeRequest ().Width : children [n-1].SizeRequest ().Height;
					if (prevRequest > arrowSize*2)
						continue;
					int newReduction = rightSize - currentReduction;
					if (newReduction > sizeToReduce)
						newReduction = sizeToReduce;
					
					int minSize = Orientation == Orientation.Horizontal ? children[0].SizeRequest ().Width : children[0].SizeRequest ().Height;
					minSize += arrowSize + 6;
					if (bar.DefaultSize - (currentReduction + newReduction) < minSize)
						newReduction = (bar.DefaultSize - minSize) - currentReduction;
					
					return newReduction;
				}
			}
			return 0;
		}
Exemple #45
0
		public void StartDragBar (DockToolbar bar)
		{
		}
Exemple #46
0
		internal override void RestorePosition (DockToolbarFrame frame, DockToolbar bar)
		{
			frame.DockToolbar (bar, placement, dockOffset, dockRow);
		}
Exemple #47
0
		internal void EndDragBar (DockToolbar bar, uint time)
		{
			Pointer.Ungrab (time);
			if (targetPanel != null) {
				targetPanel.DropDragBar (bar);
				targetPanel.EndDragBar (bar);
			}
			dragBar = null;
		}
Exemple #48
0
		void MoveBar (DockToolbar bar, int x, int row)
		{
			MoveBar (bar, x, row, true);
		}
Exemple #49
0
		internal virtual void RestorePosition (DockToolbarFrame frame, DockToolbar bar) {}
Exemple #50
0
		void ShowPlaceholder (DockToolbar bar, bool horz, int x, int y, int w, int h)
		{
			if (orientation != Orientation.Horizontal)
				horz = !horz;
			
			PanelToWindow (x, y, w, h, out x, out y, out w, out h);
			
			bool created = false;
			
			if (placeholder == null || horz != currentPlaceholderHorz) {
				HidePlaceholder ();
				placeholder = new PlaceholderWindow (parentFrame);
				placeholderArrow1 = new ArrowWindow (parentFrame, horz ? ArrowWindow.Direction.Right : ArrowWindow.Direction.Down);
				placeholderArrow2 = new ArrowWindow (parentFrame, horz ? ArrowWindow.Direction.Left : ArrowWindow.Direction.Up);
				currentPlaceholderHorz = horz;
				created = true;
			}
			
			int sx, sy;
			this.GdkWindow.GetOrigin (out sx, out sy);
			sx += x;
			sy += y;
			
			int mg = -4;
			placeholder.Move (sx - mg, sy - mg);
			placeholder.Resize (w + mg*2, h + mg * 2);
			
			if (horz) {
				placeholderArrow1.Move (sx - placeholderArrow1.Width, sy + (h/2) - placeholderArrow1.Height/2);
				placeholderArrow2.Move (sx + w, sy + (h/2) - placeholderArrow1.Height/2);
			} else {
				int px = sx + w/2 - placeholderArrow1.Width/2;
				if (px < 0) px = 0;
				placeholderArrow1.Move (px, sy - placeholderArrow1.Height);
				placeholderArrow2.Move (px, sy + h);
			}
			
			if (created) {
				placeholder.Show ();
				placeholder.Present ();
				if (bar.FloatingDock != null)
					bar.FloatingDock.Present ();
				placeholderArrow1.Present ();
				placeholderArrow2.Present ();
			}
		}
Exemple #51
0
		int GetChildRightOffset (DockToolbar bar)
		{
			return bar.DockOffset + bar.Size;
		}
Exemple #52
0
		void RepositionInternal (DockToolbar bar, int x, int y, int xcursor, int ycursor)
		{
			int width = GetChildWidth (bar);
			
			ycursor = y + bar.DefaultHeight / 2;
			
			if (bars.Count == 0 && bar.Floating) {
				SetNewRowPlaceholder (bar, x, 0);
				return;
			}
			
			int dx = (x + width) - PanelWidth;
			if (dx > parentFrame.DockMargin && !bar.Floating) {
				HidePlaceholder ();
				FloatBar (bar, x, y);
				return;
			}
			else if (dx > 0)
				x -= dx;
			else if (x < -parentFrame.DockMargin && !bar.Floating) {
				HidePlaceholder ();
				FloatBar (bar, x, y);
				return;
			}
			else if (x < 0)
				x = 0;

			int nx = x;
			int row = -1;
			
			// Get the old bar y position
			 
			int panelBottom = GetPanelBottom ();
				
			if (ycursor < - parentFrame.DockMargin || ycursor > panelBottom + parentFrame.DockMargin) {
				HidePlaceholder ();
				FloatBar (bar, x, y);
				return;
			}
			
			int rtop = 0;
			int prevtop = 0;
			row = 0;
			while (ycursor >= rtop) {
				prevtop = rtop;
				row++;
				if (rtop >= panelBottom) break;
				rtop += GetRowSize (row - 1);
			}
			
			row--;
			int ry = ycursor - prevtop;
			
			if (ry <= parentFrame.DockMargin && ry >= 0) {
				SetNewRowPlaceholder (bar, x, row);
				FloatBar (bar, x, y);
				return;
			} else if (ry >= (GetRowSize(row) - parentFrame.DockMargin) || (ry < 0 && -ry < parentFrame.DockMargin)) {
				SetNewRowPlaceholder (bar, x, row + 1);
				FloatBar (bar, x, y);
				return;
			}
			
			// Can't create a new row. Try to fit the bar in the current row
			// Find the first bar in the row:
			
			int ns = -1;
			for (int n=0; n<bars.Count; n++) {
				DockToolbar b = (DockToolbar)bars[n];
				
				// Ignore the bar being moved
				if (b == bar) continue;
				
				if (b.DockRow == row) {
					ns = n;
					break;
				}
			}
			
			if (ns == -1) {
				// There are no other bars, no problem then
				if (bar.Floating) {
					SetPlaceholder (bar, nx, row);
					return;
				}

				if ((nx == bar.DockOffset && row == bar.DockRow) || (row != bar.DockRow)) {
					SetPlaceholder (bar, nx, row);
					FloatBar (bar, x, y);
					return;
				}
				
				HidePlaceholder ();
				MoveBar (bar, nx, row);
				return;
			}
			
			// Compute the available space, and find the bars at the
			// left and the right of the bar being moved
			
			int gapsTotal = 0;
			int lastx = 0;
			int leftIndex=-1, rightIndex = -1;
			int gapsLeft = 0, gapsRight = 0;
			
			for (int n=ns; n<bars.Count; n++) {
				DockToolbar b = (DockToolbar)bars[n];
				
				// Ignore the bar being moved
				if (b == bar) continue;

				if (b.DockRow != row) break;
				int bx = b.DockOffset;
				
				if (bx > x && (rightIndex == -1))
					rightIndex = n;
				else if (bx <= x)
					leftIndex = n;
				
				if (bx < x)
					gapsLeft += bx - lastx;
				else {
					if (lastx < x) {
						gapsLeft += x - lastx;
						gapsRight += bx - x;
					} else
						gapsRight += bx - lastx;
				}
				
				gapsTotal += bx - lastx;
				lastx = GetChildRightOffset (b); 
			}

			if (lastx < x) {
				gapsLeft += x - lastx;
				gapsRight += PanelWidth - x;
			} else {
				gapsRight += PanelWidth - lastx;
			}
			
			gapsTotal += PanelWidth - lastx;
			
			// Is there room for the bar? 
			if (gapsTotal < width) {
				HidePlaceholder ();
				FloatBar (bar, x, y);
				return;
			}
			
			// Shift the bars at the left and the right
			
			int oversizeLeft = 0;
			int oversizeRight = 0;
			
			if (leftIndex != -1) {
				int r = GetChildRightOffset ((DockToolbar) bars [leftIndex]);
				oversizeLeft = r - nx;
			}
			
			if (rightIndex != -1) {
				int r = ((DockToolbar) bars [rightIndex]).DockOffset;
				oversizeRight = (nx + width) - r;
			}
			
			if (oversizeLeft > gapsLeft)
				oversizeRight += (oversizeLeft - gapsLeft);
			else if (oversizeRight > gapsRight)
				oversizeLeft += (oversizeRight - gapsRight);
			
			if (leftIndex != -1 && oversizeLeft > 0) {
				ShiftBar (leftIndex, -oversizeLeft);
				nx = GetChildRightOffset ((DockToolbar) bars [leftIndex]);
			}
			
			if (rightIndex != -1 && oversizeRight > 0) {
				ShiftBar (rightIndex, oversizeRight);
				nx = ((DockToolbar) bars [rightIndex]).DockOffset - width;
			}
			
			
			if (bar.Floating) {
				SetPlaceholder (bar, nx, row);
				return;
			}

			if ((nx == bar.DockOffset && row == bar.DockRow) || (row != bar.DockRow)) {
				if (bar.Floating) {
					SetPlaceholder (bar, nx, row);
					FloatBar (bar, x, y);
				}
				return;
			}
			
			HidePlaceholder ();
			MoveBar (bar, nx, row);
		}
Exemple #53
0
		internal DockedPosition (DockToolbar bar)
		{
			dockOffset = bar.AnchorOffset;
			dockRow = bar.DockRow;
			placement = ((DockToolbarPanel)bar.Parent).Placement;
		}
Exemple #54
0
		void InternalMove (DockToolbar bar, int x, int y, bool animate)
		{
			if (bar.Animation != null) {
				bar.Animation.Cancel ();
				bar.Animation = null;
			}
			
			if (animate && enableAnimations) {
				bar.Animation = new MoveAnimation (this, bar, x, y);
				bar.Animation.Start ();
			}
			else
				Move (bar, x, y);
		}
Exemple #55
0
		internal void FloatBar (DockToolbar bar, Orientation orientation, int x, int y)
		{
			FloatingDock fdock = new FloatingDock (this);
			fdock.Move (x, y);
			bar.ResetSize ();
			fdock.Attach (bar);
			bar.Orientation = orientation;
		}
Exemple #56
0
		void SetPlaceholder (DockToolbar bar, int offset, int row)
		{
			if (dropRow != row && dropRow != -1)
				RestoreShiftedBars (dropRow);

			ShowPlaceholder (bar, false, offset, GetRowTop (row), GetChildWidth (bar), GetRowSize (row));

			dropOffset = offset;
			dropRow = row;
			dropNewRow = false;
		}
Exemple #57
0
		internal void StartDragBar (DockToolbar bar, int x, int y, uint time)
		{
			dragBar = bar;
			xDragDif = -x;
			yDragDif = -y;
			Pointer.Grab (this.GdkWindow, false, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, handCursor, time);
			if (!bar.Floating) {
				DockToolbarPanel panel = (DockToolbarPanel) dragBar.Parent;
				panel.StartDragBar (bar);
			}
		}
Exemple #58
0
		void SetNewRowPlaceholder (DockToolbar bar, int offset, int toprow)
		{
			if (dropRow != -1)
				RestoreShiftedBars (dropRow);
			
			int y = GetRowTop (toprow) - parentFrame.DockMargin;
			int h = parentFrame.DockMargin * 2;
			ShowPlaceholder (bar, true, offset, y, GetChildWidth (bar), h);
			
			dropOffset = offset;
			dropRow = toprow;
			dropNewRow = true;
		}
Exemple #59
0
		void FloatBar (DockToolbar bar, int x, int y)
		{
			if (bar.Floating) return;
			
			int wx,wy,w,h;
			PanelToWindow (x, y, GetChildWidth (bar), bar.DefaultHeight, out x, out y, out w, out h);
				
			this.GdkWindow.GetOrigin (out wx, out wy);
			RemoveBar (bar);
			parentFrame.FloatBar (bar, orientation, wx + x, wy + y);
		}
Exemple #60
0
		public void RemoveBar (DockToolbar bar)
		{
			if (IsSingleBarRow (bar))
				RemoveRow (bar.DockRow);
		
			Remove (bar);
			bars.Remove (bar);
			bar.DefaultSizeChanged -= new EventHandler (OnBarSizeChanged);
			
			UpdateRowHeight (bar.DockRow);
			PackBars ();
		}