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 (); if (item.Widget.Parent != null) { ((Gtk.Container)item.Widget.Parent).Remove (item.Widget); } 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 (); }; }
internal DockBar(DockFrame frame, Gtk.PositionType position) { VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment(0, 0, 0, 0); if (Orientation == Gtk.Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } al.Add(box); Add(al); filler = new Label(); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd(filler); ShowAll(); UpdateVisibility(); }
public virtual bool IsNextToMargin(Gtk.PositionType margin, bool visibleOnly) { if (ParentGroup == null) { return(true); } if (!ParentGroup.IsNextToMargin(margin, visibleOnly)) { return(false); } return(ParentGroup.IsChildNextToMargin(margin, this, visibleOnly)); }
internal DockBar(DockFrame frame, Gtk.PositionType position) { frame.ShadedContainer.Add(this); VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment(0, 0, 0, 0); if (Orientation == Gtk.Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } uint sizePadding = 1; uint startPadding = 6; switch (Frame.CompactGuiLevel) { case 1: sizePadding = 2; break; case 4: startPadding = 3; break; case 5: startPadding = 0; sizePadding = 0; break; } switch (position) { case PositionType.Top: al.BottomPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Bottom: al.TopPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Left: al.RightPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; case PositionType.Right: al.LeftPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; } box.Spacing = 3; al.Add(box); Add(al); filler = new Label(); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd(filler); ShowAll(); UpdateVisibility(); }
internal void SetAutoHideMode(Gtk.PositionType pos, int size) { ResetMode(); if (widget != null) { widget.Hide(); // Avoids size allocation warning widget.Unparent(); } dockBarItem = frame.BarDock(pos, this, size); if (widget != null) { widget.UpdateBehavior(); } }
int GetAutoHideSize(Gtk.PositionType pos) { if (autoHideSize != -1) { return(autoHideSize); } if (pos == PositionType.Left || pos == PositionType.Right) { return(Allocation.Width); } else { return(Allocation.Height); } }
internal void SetAutoHideMode(Gtk.PositionType pos, int size) { ResetMode(); if (widget != null) { widget.Hide(); // Avoids size allocation warning if (widget.Parent != null) { ((Gtk.Container)widget.Parent).Remove(widget); } } dockBarItem = frame.BarDock(pos, this, size); if (widget != null) { widget.UpdateBehavior(); } }
internal DockBar(DockFrame frame, Gtk.PositionType position) { VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment(0, 0, 0, 0); if (Orientation == Gtk.Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } al.Add(box); Add(al); ShowAll(); UpdateVisibility(); }
public bool IsChildNextToMargin(Gtk.PositionType margin, DockObject obj, bool visibleOnly) { if (type == DockGroupType.Tabbed) { return(true); } else if (type == DockGroupType.Horizontal) { if (margin == PositionType.Top || margin == PositionType.Bottom) { return(true); } int i = visibleOnly ? VisibleObjects.IndexOf(obj) : Objects.IndexOf(obj); if (margin == PositionType.Left && i == 0) { return(true); } if (margin == PositionType.Right && i == (visibleOnly ? VisibleObjects.Count - 1 : Objects.Count - 1)) { return(true); } } else if (type == DockGroupType.Vertical) { if (margin == PositionType.Left || margin == PositionType.Right) { return(true); } int i = visibleOnly ? VisibleObjects.IndexOf(obj) : Objects.IndexOf(obj); if (margin == PositionType.Top && i == 0) { return(true); } if (margin == PositionType.Bottom && i == (visibleOnly ? VisibleObjects.Count - 1 : Objects.Count - 1)) { return(true); } } return(false); }
internal override void Read(XmlReader reader) { base.Read(reader); visibleFlag = bool.Parse(reader.GetAttribute("visible")) && !item.IsPositionMarker; status = (DockItemStatus)Enum.Parse(typeof(DockItemStatus), reader.GetAttribute("status")); int fx = 0, fy = 0, fw = 0, fh = 0; string s = reader.GetAttribute("floatX"); if (s != null) { fx = int.Parse(s); } s = reader.GetAttribute("floatY"); if (s != null) { fy = int.Parse(s); } s = reader.GetAttribute("floatWidth"); if (s != null) { fw = int.Parse(s); } s = reader.GetAttribute("floatHeight"); if (s != null) { fh = int.Parse(s); } s = reader.GetAttribute("autoHidePosition"); if (s != null) { barDocPosition = (PositionType)Enum.Parse(typeof(PositionType), s); } s = reader.GetAttribute("autoHideSize"); if (s != null) { autoHideSize = int.Parse(s); } floatRect = new Gdk.Rectangle(fx, fy, fw, fh); }
internal DockBar (DockFrame frame, Gtk.PositionType position) { VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment (0,0,0,0); if (Orientation == Gtk.Orientation.Horizontal) box = new HBox (); else box = new VBox (); al.Add (box); Add (al); filler = new Label (); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd (filler); ShowAll (); UpdateVisibility (); }
internal DockBar (DockFrame frame, Gtk.PositionType position) { frame.ShadedContainer.Add (this); VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment (0,0,0,0); if (Orientation == Gtk.Orientation.Horizontal) box = new HBox (); else box = new VBox (); uint sizePadding = 1; uint startPadding = 6; switch (Frame.CompactGuiLevel) { case 1: sizePadding = 2; break; case 4: startPadding = 3; break; case 5: startPadding = 0; sizePadding = 0; break; } switch (position) { case PositionType.Top: al.BottomPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Bottom: al.TopPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Left: al.RightPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; case PositionType.Right: al.LeftPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; } box.Spacing = 3; al.Add (box); Add (al); filler = new Label (); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd (filler); ShowAll (); UpdateVisibility (); }
void SetBarDocPosition() { // Determine the best position for docking the item if (Allocation.IsEmpty) { int uniqueTrue = -1; int uniqueFalse = -1; for (int n = 0; n < 4; n++) { bool inMargin = IsNextToMargin((PositionType)n, false); if (inMargin) { if (uniqueTrue == -1) { uniqueTrue = n; } else { uniqueTrue = -2; } } else { if (uniqueFalse == -1) { uniqueFalse = n; } else { uniqueFalse = -2; } } } if (uniqueTrue >= 0) { barDocPosition = (PositionType)uniqueTrue; autoHideSize = 200; return; } else if (uniqueFalse >= 0) { barDocPosition = (PositionType)uniqueFalse; switch (barDocPosition) { case PositionType.Left: barDocPosition = PositionType.Right; break; case PositionType.Right: barDocPosition = PositionType.Left; break; case PositionType.Top: barDocPosition = PositionType.Bottom; break; case PositionType.Bottom: barDocPosition = PositionType.Top; break; } autoHideSize = 200; return; } // If the item is in a group, use the dock location of other items DockObject current = this; do { if (EstimateBarDocPosition(current.ParentGroup, current, out barDocPosition, out autoHideSize)) { return; } current = current.ParentGroup; } while (current.ParentGroup != null); // Can't find a good location. Just guess. barDocPosition = PositionType.Bottom; autoHideSize = 200; return; } barDocPosition = CalcBarDocPosition(); }
internal DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size) { return(GetDockBar(pos).AddItem(item, size)); }
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 (); }; }
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(); }; }
void SetBarDocPosition () { // Determine the best position for docking the item if (Allocation.IsEmpty) { int uniqueTrue = -1; int uniqueFalse = -1; for (int n=0; n<4; n++) { bool inMargin = IsNextToMargin ((PositionType) n, false); if (inMargin) { if (uniqueTrue == -1) uniqueTrue = n; else uniqueTrue = -2; } else { if (uniqueFalse == -1) uniqueFalse = n; else uniqueFalse = -2; } } if (uniqueTrue >= 0) { barDocPosition = (PositionType) uniqueTrue; autoHideSize = 200; return; } else if (uniqueFalse >= 0) { barDocPosition = (PositionType) uniqueFalse; switch (barDocPosition) { case PositionType.Left: barDocPosition = PositionType.Right; break; case PositionType.Right: barDocPosition = PositionType.Left; break; case PositionType.Top: barDocPosition = PositionType.Bottom; break; case PositionType.Bottom: barDocPosition = PositionType.Top; break; } autoHideSize = 200; return; } // If the item is in a group, use the dock location of other items DockObject current = this; do { if (EstimateBarDocPosition (current.ParentGroup, current, out barDocPosition, out autoHideSize)) return; current = current.ParentGroup; } while (current.ParentGroup != null); // Can't find a good location. Just guess. barDocPosition = PositionType.Bottom; autoHideSize = 200; return; } barDocPosition = CalcBarDocPosition (); }
internal override void Read (XmlReader reader) { base.Read (reader); visibleFlag = bool.Parse (reader.GetAttribute ("visible")) && !item.IsPositionMarker; status = (DockItemStatus) Enum.Parse (typeof (DockItemStatus), reader.GetAttribute ("status")); int fx=0, fy=0, fw=0, fh=0; string s = reader.GetAttribute ("floatX"); if (s != null) fx = int.Parse (s); s = reader.GetAttribute ("floatY"); if (s != null) fy = int.Parse (s); s = reader.GetAttribute ("floatWidth"); if (s != null) fw = int.Parse (s); s = reader.GetAttribute ("floatHeight"); if (s != null) fh = int.Parse (s); s = reader.GetAttribute ("autoHidePosition"); if (s != null) barDocPosition = (PositionType) Enum.Parse (typeof (PositionType), s); s = reader.GetAttribute ("autoHideSize"); if (s != null) autoHideSize = int.Parse (s); floatRect = new Gdk.Rectangle (fx, fy, fw, fh); }
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(); }; }