public CrownDockSplitter(Control parentControl, Control control, SplitterType splitterType) { _parentControl = parentControl; _control = control; _splitterType = splitterType; switch (_splitterType) { case SplitterType.Left: case SplitterType.Right: ResizeCursor = Cursors.SizeWE; break; case SplitterType.Top: case SplitterType.Bottom: ResizeCursor = Cursors.SizeNS; break; } }
public void Init(SplitterType type) { this.positiveOutpoint = ScriptableObject.CreateInstance <ConnectionPoint>(); this.positiveOutpoint.Init(null, ConnectionPointType.Out); this.positiveOutpoint.anchored = true; this.negativeOutpoint = ScriptableObject.CreateInstance <ConnectionPoint>(); this.negativeOutpoint.Init(null, ConnectionPointType.Out); this.negativeOutpoint.anchored = true; // set the rect to be the same size as the splitter texture this.rect.width = 32f; this.rect.height = 32f; // get the texture if (type == SplitterType.Flag) { this.image = SDEStyles.outstreamFlagSplitterTexture; } else { this.image = SDEStyles.outstreamVariableSplitterTexture; } }
public static Splitter MakeSplitter(this SplitterType type) { return(type == SplitterType.Horizontal ? (Splitter) new ThemedHSplitter() : new ThemedVSplitter()); }
public void Split(SplitterType type) { FilesystemPane.Instance.Split(this, type); }
public void Split(FilesystemView fsView, SplitterType type) { var RootWidget = fsView.RootWidget; FSViewNode vn = RootWidget.Components.Get <ViewNodeComponent>().ViewNode as FSViewNode; var newFsView = new FilesystemView(); views.Add(newFsView); var newVn = new FSViewNode { Widget = newFsView.RootWidget, Path = vn.Path, ShowSelectionPreview = vn.ShowSelectionPreview, ShowCookingRulesEditor = vn.ShowCookingRulesEditor, }; // TODO: setup internal stretches of fsView here newFsView.RootWidget.Components.Add(new ViewNodeComponent { ViewNode = newVn }); newFsView.Initialize(); if (vn.Parent == null) { // Root node, need to replace on in UserPreferences Splitter s = type.MakeSplitter(); var up = FilesystemUserPreferences.Instance; var sn = new SplitterNode { Widget = s, Type = type }; up.ViewRoot = sn; newVn.Parent = sn; s.Stretches = Splitter.GetStretchesList(sn.Stretches, 1, 1); sn.Children.Add(vn); sn.Children.Add(newVn); var thisParent = RootWidget.ParentWidget; RootWidget.Unlink(); s.AddNode(RootWidget); s.AddNode(newFsView.RootWidget); s.Components.Add(new ViewNodeComponent { ViewNode = sn }); vn.Parent = sn; thisParent.Nodes.Add(s); // TODO setup stretches ^ } else if (vn.Parent is SplitterNode) { if ((vn.Parent as SplitterNode).Type == type) { var sn = vn.Parent as SplitterNode; var s = sn.Widget; s.Nodes.Insert(s.Nodes.IndexOf(RootWidget), newFsView.RootWidget); newVn.Parent = sn; sn.Children.Insert(sn.Children.IndexOf(vn), newVn); } else { Splitter s = type.MakeSplitter(); var sn = new SplitterNode { Widget = s, Type = type }; s.Components.Add(new ViewNodeComponent { ViewNode = sn }); s.Stretches = Splitter.GetStretchesList(sn.Stretches); var psn = vn.Parent as SplitterNode; // or vn.Parent.Widget int thisIndex = RootWidget.ParentWidget.Nodes.IndexOf(RootWidget); var thisParent = RootWidget.ParentWidget; RootWidget.Unlink(); s.AddNode(RootWidget); s.AddNode(newFsView.RootWidget); sn.Children.Add(vn); sn.Children.Add(newVn); vn.Parent = sn; newVn.Parent = sn; thisParent.Nodes.Insert(thisIndex, s); var ps = psn.Widget; sn.Parent = psn; psn.Children.RemoveAt(thisIndex); psn.Children.Insert(thisIndex, sn); } } else if (vn.Parent is FSViewNode) { // wat } }