348
348
if (type == DockGroupType.Tabbed) {
349
349
if (boundTabStrip != null) {
350
350
int tabsHeight = boundTabStrip.SizeRequest ().Height;
351
boundTabStrip.SizeAllocate (new Gdk.Rectangle (newAlloc.X, newAlloc.Bottom - tabsHeight, newAlloc.Width, tabsHeight));
351
boundTabStrip.SizeAllocate (new Gdk.Rectangle (newAlloc.X, newAlloc.Y, newAlloc.Width, tabsHeight));
353
353
if (allocStatus == AllocStatus.Valid && newAlloc == oldAlloc) {
354
354
// Even if allocation has not changed, SizeAllocation has to be called on all items to avoid redrawing issues.
359
359
if (VisibleObjects.Count > 1 && boundTabStrip != null) {
360
360
int tabsHeight = boundTabStrip.SizeRequest ().Height;
361
361
newAlloc.Height -= tabsHeight;
362
newAlloc.Y += tabsHeight;
362
363
boundTabStrip.QueueDraw ();
363
364
} else if (VisibleObjects.Count != 0) {
364
365
((DockGroupItem)VisibleObjects [0]).Item.Widget.Show ();
406
407
else if (allocStatus != AllocStatus.NewSizeRequest) {
407
// Available space has changed, so the size of the items must be changed.
409
// Don't proportionally resize the pads. Instead, resize only those pads with the Expand flag.
410
// This logic is implemented in CalcNewSizes, so no need to reimplement it
413
// Disabled the proportional resize of pads for the above reason
415
/* // Available space has changed, so the size of the items must be changed.
408
416
// First of all, get the change fraction
619
627
// Add missing pages
620
628
foreach (DockObject ob in VisibleObjects) {
621
629
DockGroupItem it = ob as DockGroupItem;
622
ts.AddTab (it.Item.Widget, it.Item.Icon, it.Item.Label);
630
ts.AddTab (it.Item.TitleTab);
625
633
boundTabStrip = ts;
627
if (currentTabPage != -1 && currentTabPage < boundTabStrip.TabCount) {
635
if (oldpage != null) {
636
boundTabStrip.CurrentPage = oldpage;
638
else if (currentTabPage != -1 && currentTabPage < boundTabStrip.TabCount) {
628
639
boundTabStrip.CurrentTab = currentTabPage;
629
// Discard the currentTabPage value. Current page is now tracked by the tab strip
632
else if (oldpage != null)
633
boundTabStrip.CurrentPage = oldpage;
642
// Discard the currentTabPage value. Current page is now tracked by the tab strip
635
645
if (boundTabStrip.CurrentTab == -1) {
636
646
if (oldtab != -1) {
637
647
if (oldtab < boundTabStrip.TabCount)
691
707
public void LayoutWidgets ()
709
Frame.UpdateRegionStyle (this);
693
711
foreach (DockObject ob in VisibleObjects) {
694
712
DockGroupItem it = ob as DockGroupItem;
695
713
if (it != null) {
696
if (it.Item.Widget.Parent != Frame.Container) {
697
if (it.Item.Widget.Parent != null) {
698
((Gtk.Container)it.Item.Widget.Parent).Remove (it.Item.Widget);
700
Frame.Container.Add (it.Item.Widget);
715
Frame.UpdateRegionStyle (it);
716
it.Item.SetRegionStyle (it.VisualStyle);
702
if (!it.Item.Widget.Visible && type != DockGroupType.Tabbed)
703
it.Item.Widget.Show ();
706
720
((DockGroup)ob).LayoutWidgets ();
724
public void AddRemoveWidgets ()
726
foreach (DockObject ob in Objects) {
727
DockGroupItem it = ob as DockGroupItem;
730
// Add the dock item to the container and show it if visible
731
if (it.Item.Widget.Parent != Frame.Container) {
732
if (it.Item.Widget.Parent != null) {
733
((Gtk.Container)it.Item.Widget.Parent).Remove (it.Item.Widget);
735
Frame.Container.Add (it.Item.Widget);
737
if (!it.Item.Widget.Visible && type != DockGroupType.Tabbed)
738
it.Item.Widget.Show ();
740
// Do the same for the title tab
741
if ((type != DockGroupType.Tabbed || VisibleObjects.Count == 1) && (it.Item.Behavior & DockItemBehavior.NoGrip) == 0) {
742
var tab = it.Item.TitleTab;
743
if (tab.Parent != Frame.Container) {
744
if (tab.Parent != null) {
745
((Gtk.Container)tab.Parent).Remove (tab);
747
Frame.Container.Add (tab);
753
if (it.Item.Widget.Parent == Frame.Container)
754
Frame.Container.Remove (it.Item.Widget);
755
var tab = it.Item.TitleTab;
756
if (tab.Parent == Frame.Container)
757
Frame.Container.Remove (tab);
761
((DockGroup)ob).AddRemoveWidgets ();
710
765
internal override void GetDefaultSize (out int width, out int height)
712
767
if (type == DockGroupType.Tabbed) {
786
841
public void Draw (Gdk.Rectangle exposedArea, DockGroup currentHandleGrp, int currentHandleIndex)
788
843
if (type != DockGroupType.Tabbed) {
789
DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, false, false, null);
844
DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, DrawSeparatorOperation.Draw, false, null);
790
845
foreach (DockObject it in VisibleObjects) {
791
846
DockGroup grp = it as DockGroup;
798
public void DrawSeparators (Gdk.Rectangle exposedArea, DockGroup currentHandleGrp, int currentHandleIndex, bool invalidateOnly, List<Gdk.Rectangle> areasList)
853
public void DrawSeparators (Gdk.Rectangle exposedArea, DockGroup currentHandleGrp, int currentHandleIndex, DrawSeparatorOperation oper, List<Gdk.Rectangle> areasList)
800
DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, invalidateOnly, true, areasList);
855
DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, oper, true, areasList);
803
void DrawSeparators (Gdk.Rectangle exposedArea, DockGroup currentHandleGrp, int currentHandleIndex, bool invalidateOnly, bool drawChildrenSep, List<Gdk.Rectangle> areasList)
858
void DrawSeparators (Gdk.Rectangle exposedArea, DockGroup currentHandleGrp, int currentHandleIndex, DrawSeparatorOperation oper, bool drawChildrenSep, List<Gdk.Rectangle> areasList)
805
860
if (type == DockGroupType.Tabbed || VisibleObjects.Count == 0)
812
867
int y = Allocation.Y;
813
868
int hw = horiz ? Frame.HandleSize : Allocation.Width;
814
869
int hh = horiz ? Allocation.Height : Frame.HandleSize;
815
Gtk.Orientation or = horiz ? Gtk.Orientation.Vertical : Gtk.Orientation.Horizontal;
873
if (areasList == null && oper == DrawSeparatorOperation.Draw) {
874
hgc = new Gdk.GC (Frame.Container.GdkWindow);
875
hgc.RgbFgColor = Styles.DockFrameBackground;
817
878
for (int n=0; n<VisibleObjects.Count; n++) {
818
879
DockObject ob = VisibleObjects [n];
819
880
DockGroup grp = ob as DockGroup;
820
881
if (grp != null && drawChildrenSep)
821
grp.DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, invalidateOnly, areasList);
882
grp.DrawSeparators (exposedArea, currentHandleGrp, currentHandleIndex, oper, areasList);
822
883
if (ob != last) {
824
885
x += ob.Allocation.Width + Frame.HandlePadding;
826
887
y += ob.Allocation.Height + Frame.HandlePadding;
828
if (areasList != null) {
890
case DrawSeparatorOperation.CollectAreas:
829
891
if (Frame.ShadedSeparators)
830
892
areasList.Add (new Gdk.Rectangle (x, y, hw, hh));
831
} else if (invalidateOnly) {
894
case DrawSeparatorOperation.Invalidate:
832
895
Frame.Container.QueueDrawArea (x, y, hw, hh);
835
if (Frame.ShadedSeparators) {
836
Frame.ShadedContainer.DrawBackground (Frame.Container, new Gdk.Rectangle (x, y, hw, hh));
838
StateType state = (currentHandleGrp == this && currentHandleIndex == n) ? StateType.Prelight : StateType.Normal;
839
if (!DockFrame.IsWindows)
840
Gtk.Style.PaintHandle (Frame.Style, Frame.Container.GdkWindow, state, ShadowType.None, exposedArea, Frame, "paned", x, y, hw, hh, or);
897
case DrawSeparatorOperation.Draw:
898
Frame.Container.GdkWindow.DrawRectangle (hgc, true, x, y, hw, hh);
900
case DrawSeparatorOperation.Allocate:
901
Frame.Container.AllocateSplitter (this, n, new Gdk.Rectangle (x, y, hw, hh));
907
970
internal override bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
909
if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0) {
911
rect = Gdk.Rectangle.Zero;
973
rect = Gdk.Rectangle.Zero;
975
if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0)
915
978
if (type == DockGroupType.Tabbed) {
916
979
// Tabs can only contain DockGroupItems
917
return ((DockGroupItem)VisibleObjects[0]).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect);
980
var sel = boundTabStrip != null ? VisibleObjects[boundTabStrip.CurrentTab] : VisibleObjects[VisibleObjects.Count - 1];
981
return ((DockGroupItem)sel).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect);
919
983
else if (type == DockGroupType.Horizontal) {
920
984
if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize) {
985
// Check if the item is allowed to be docked here
986
var s = Frame.GetRegionStyleForObject (VisibleObjects[VisibleObjects.Count - 1]);
987
if (s.SingleColumnMode.Value)
921
989
// Dock to the right of the group
922
990
dockDelegate = delegate (DockItem it) {
923
991
DockTarget (it, dockObjects.Count);
928
996
else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize) {
997
// Check if the item is allowed to be docked here
998
var s = Frame.GetRegionStyleForObject (VisibleObjects[0]);
999
if (s.SingleColumnMode.Value)
929
1001
// Dock to the left of the group
930
1002
dockDelegate = delegate (DockItem it) {
931
1003
DockTarget (it, 0);
940
1012
px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2 &&
941
1013
px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize/2)
943
int dn = dockObjects.IndexOf (ob);
1015
// Check if the item is allowed to be docked here
1016
int dn = dockObjects.IndexOf (ob) + 1;
1017
var s = Frame.GetRegionStyleForPosition (this, dn, true);
1018
if (s.SingleColumnMode.Value)
944
1020
dockDelegate = delegate (DockItem it) {
945
DockTarget (it, dn+1);
1021
DockTarget (it, dn);
947
1023
rect = new Gdk.Rectangle (ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
954
1030
else if (type == DockGroupType.Vertical) {
955
1031
if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize) {
1032
// Check if the item is allowed to be docked here
1033
var s = Frame.GetRegionStyleForObject (VisibleObjects[VisibleObjects.Count - 1]);
1034
if (s.SingleRowMode.Value)
956
1036
// Dock to the bottom of the group
957
1037
dockDelegate = delegate (DockItem it) {
958
1038
DockTarget (it, dockObjects.Count);
963
1043
else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize) {
1044
// Check if the item is allowed to be docked here
1045
var s = Frame.GetRegionStyleForObject (VisibleObjects[0]);
1046
if (s.SingleRowMode.Value)
964
1048
// Dock to the top of the group
965
1049
dockDelegate = delegate (DockItem it) {
966
1050
DockTarget (it, 0);
975
1059
py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2 &&
976
1060
py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize/2)
978
int dn = dockObjects.IndexOf (ob);
1062
// Check if the item is allowed to be docked here
1063
int dn = dockObjects.IndexOf (ob) + 1;
1064
var s = Frame.GetRegionStyleForPosition (this, dn, true);
1065
if (s.SingleRowMode.Value)
979
1067
dockDelegate = delegate (DockItem it) {
980
DockTarget (it, dn+1);
1068
DockTarget (it, dn);
982
1070
rect = new Gdk.Rectangle (Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2, Allocation.Width, DockFrame.GroupDockSeparatorSize);