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 (); }; }
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(); }; }
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) : 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(); }; }