Beispiel #1
0
		public DockItemContainer (DockFrame frame, DockItem item)
		{
			this.item = item;

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

			mainBox.ResizeMode = Gtk.ResizeMode.Queue;
			mainBox.Spacing = 0;
			
			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 #2
0
		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);
		}
Beispiel #3
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;
		}
Beispiel #4
0
		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;
		}
Beispiel #5
0
        public void AddItem(DockItem item)
        {
            var panel_item = new DockPanelItem(item);

            // Connect to the previous pane in the list.
            if (items.Count > 0)
            {
                items.Last().Pane.Add2(panel_item.Pane);
            }
            else
            {
                PackStart(panel_item.Pane, true, true, 0);
            }

            items.Add(panel_item);
            panel_item.Maximize(dock_bar);

            item.MinimizeClicked += (o, args) => {
                panel_item.Minimize(dock_bar);
            };
            item.MaximizeClicked += (o, args) => {
                panel_item.Maximize(dock_bar);
            };
        }
Beispiel #6
0
		public override void CopyFrom (DockObject ob)
		{
			base.CopyFrom (ob);
			DockGroupItem it = (DockGroupItem)ob;
			item = it.item;
			visibleFlag = it.visibleFlag;
			floatRect = it.floatRect;
		}
Beispiel #7
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;

			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 ();
			};
		}
Beispiel #8
0
			public PadTitleWindow (DockFrame frame, DockItem draggedItem) : base (Gtk.WindowType.Popup)
			{
				SkipTaskbarHint = true;
				Decorated = false;
				TransientFor = (Gtk.Window)frame.Toplevel;
				TypeHint = WindowTypeHint.Utility;

				var mainBox = new VBox ();

				var box = new HBox (false, 3);
				if (draggedItem.Icon != null) {
					var img = new ImageView (draggedItem.Icon);
					box.PackStart (img, false, false, 0);
				}
				var la = new Label ();
				la.Markup = draggedItem.Label;
				box.PackStart (la, false, false, 0);

				mainBox.PackStart (box, false, false, 0);

				var f = new CustomFrame ();
				f.SetPadding (12, 12, 12, 12);
				f.SetMargins (1, 1, 1, 1);
				f.Add (mainBox);

				Add (f);
				ShowAll ();
			}
Beispiel #9
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 #10
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 #11
0
		public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size): base (frame)
		{
			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;
			}

			if (frame.UseWindowsForTopLevelFrames) {
				// When using a top level window on mac, clicks on the first 4 pixels next to the border
				// are not detected. To avoid confusing the user (since the resize cursor is shown), 
				// we make the resize drag area smaller.
				switch (pos) {
				case PositionType.Left: cframe.SetPadding (0, 0, 0, 4); gripSize = 4; break;
				case PositionType.Right: cframe.SetPadding (0, 0, 4, 0); gripSize = 4; 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 #12
0
		internal void UpdatePlaceholder (DockItem item, Gdk.Size size, bool allowDocking)
		{
			container.UpdatePlaceholder (item, size, allowDocking);
		}
Beispiel #13
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 ();
		}
Beispiel #14
0
		internal void ShowPlaceholder (DockItem draggedItem)
		{
			container.ShowPlaceholder (draggedItem);
		}
Beispiel #15
0
		internal void DockInPlaceholder (DockItem item)
		{
			container.DockInPlaceholder (item);
		}
Beispiel #16
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;
		}
Beispiel #17
0
		DockGroupItem AddDefaultItem (DockGroup grp, DockItem it)
		{
			return AddItemAtLocation (grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus);
		}
Beispiel #18
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 #19
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;
			
			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;
		}
Beispiel #20
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));
 }
Beispiel #21
0
 internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
Beispiel #22
0
 public DockGroupItem(DockFrame frame, DockItem item) : base(frame)
 {
     this.item   = item;
     visibleFlag = item.Visible;
 }
Beispiel #23
0
		internal DockBarItem BarDock (Gtk.PositionType pos, DockItem item, int size)
		{
			return GetDockBar (pos).AddItem (item, size);
		}
Beispiel #24
0
		internal DockItemStatus GetStatus (DockItem item)
		{
			DockGroupItem gitem = container.FindDockGroupItem (item.Id);
			if (gitem == null)
				return DockItemStatus.Dockable;
			return gitem.Status;
		}
Beispiel #25
0
        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 #26
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,w,h;
			if (bar == dockBarLeft || bar == dockBarRight) {
				h = Allocation.Height - sTop.Height - sBot.Height;
				w = size;
				y = sTop.Height;
				if (bar == dockBarLeft)
					x = sLeft.Width;
				else
					x = Allocation.Width - size - sRgt.Width;
			} else {
				w = Allocation.Width - sLeft.Width - sRgt.Width;
				h = size;
				x = sLeft.Width;
				if (bar == dockBarTop)
					y = sTop.Height;
				else
					y = Allocation.Height - size - sBot.Height;
			}

			AddTopLevel (aframe, x, y, w, h);
			aframe.AnimateShow ();

			return aframe;
		}
Beispiel #27
0
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     container.ShowPlaceholder(draggedItem);
 }
Beispiel #28
0
 internal void UpdateStyle(DockItem item)
 {
 }
Beispiel #29
0
 internal void ShowPlaceholder(DockItem draggedItem)
 {
     padTitleWindow    = new PadTitleWindow(frame, draggedItem);
     placeholderWindow = new PlaceholderWindow(frame);
 }
Beispiel #30
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);
		}
Beispiel #31
0
 internal void DockInPlaceholder(DockItem item)
 {
     container.DockInPlaceholder(item);
 }
Beispiel #32
0
		internal bool GetVisible (DockItem item)
		{
			DockGroupItem gitem = container.FindDockGroupItem (item.Id);
			if (gitem == null)
				return false;
			return gitem.VisibleFlag;
		}
Beispiel #33
0
		internal abstract bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
Beispiel #34
0
 internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking)
 {
     container.UpdatePlaceholder(item, size, allowDocking);
 }
Beispiel #35
0
		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 #36
0
 internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size)
 {
     return(GetDockBar(pos).AddItem(item, size));
 }
Beispiel #37
0
		public DockGroupItem (DockFrame frame, DockItem item): base (frame)
		{
			this.item = item;
			visibleFlag = item.Visible;
		}
Beispiel #38
0
 DockGroupItem AddDefaultItem(DockGroup grp, DockItem it)
 {
     return(AddItemAtLocation(grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus));
 }
Beispiel #39
0
		internal void ShowPlaceholder (DockItem draggedItem)
		{
			padTitleWindow = new PadTitleWindow (frame, draggedItem);
			placeholderWindow = new PlaceholderWindow (frame);
		}
Beispiel #40
0
        public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size) : base(frame)
        {
            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;
            }

            if (frame.UseWindowsForTopLevelFrames)
            {
                // When using a top level window on mac, clicks on the first 4 pixels next to the border
                // are not detected. To avoid confusing the user (since the resize cursor is shown),
                // we make the resize drag area smaller.
                switch (pos)
                {
                case PositionType.Left: cframe.SetPadding(0, 0, 0, 4); gripSize = 4; break;

                case PositionType.Right: cframe.SetPadding(0, 0, 4, 0); gripSize = 4; 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 #41
0
		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;
			}
		}
Beispiel #42
0
		public void UpdateStyle (DockItem item)
		{
			QueueResize ();
		}
Beispiel #43
0
		public PadTitleWindow (DockFrame frame, DockItem draggedItem): base (Gtk.WindowType.Popup)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = (Gtk.Window) frame.Toplevel;
			TypeHint = WindowTypeHint.Utility;

			VBox mainBox = new VBox ();

			HBox box = new HBox (false, 3);
			if (draggedItem.Icon != null) {
				var img = new ImageView (draggedItem.Icon);
				box.PackStart (img, false, false, 0);
			}
			Gtk.Label la = new Label ();
			la.Markup = draggedItem.Label;
			box.PackStart (la, false, false, 0);

			mainBox.PackStart (box, false, false, 0);

/*			if (draggedItem.Widget.IsRealized) {
				var win = draggedItem.Widget.GdkWindow;
				var alloc = draggedItem.Widget.Allocation;
				Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height);

				double mw = 140, mh = 140;
				if (img.Width > img.Height)
					mw *= 2;
				else
					mh *= 2;

				double r = Math.Min (mw / img.Width, mh / img.Height);
				img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper);
				mainBox.PackStart (new Gtk.Image (img), false, false, 0);
			}*/

			CustomFrame f = new CustomFrame ();
			f.SetPadding (12, 12, 12, 12);
			f.SetMargins (1, 1, 1, 1);
			f.Add (mainBox);

			Add (f);
			ShowAll ();
		}
Beispiel #44
0
 public void UpdateStyle(DockItem item)
 {
     QueueResize();
 }