/// <summary> /// Determines if the specific Pane's Top, Bottom, Left and Right compasses should be shown for the Dragged Pane /// </summary> private bool CanDockIn(RadPane paneToDock, RadPane paneInTargetGroup, DockPosition position) { PaneType paneToDockType = GetPaneType(paneToDock); PaneType paneInTargetGroupType = GetPaneType(paneInTargetGroup); switch (paneToDockType) { case PaneType.Green: switch (paneInTargetGroupType) { case PaneType.Green: // The Top, Bottom, Left, Right and Center compasses will be shown when dragging a Green Pane over a Green Pane //return true; // The Center compass only will be shown when dragging a Green Pane over a Green Pane return position != DockPosition.Top && position != DockPosition.Bottom && position != DockPosition.Left && position != DockPosition.Right; case PaneType.Purple: return false; } break; case PaneType.Purple: switch (paneInTargetGroupType) { case PaneType.Green: return false; case PaneType.Purple: return true; } break; } return false; }
/// <summary> /// Retrieves a <see cref="DockPosition">DockPosition</see> value from the specified <see cref="AllowedDockPosition">AllowedDockPosition</see>. /// </summary> /// <param name="position"></param> /// <returns></returns> public static DockPosition GetDockPosition(AllowedDockPosition position) { DockPosition dockPos = DockPosition.Fill; switch (position) { case AllowedDockPosition.Bottom: dockPos = DockPosition.Bottom; break; case AllowedDockPosition.Left: dockPos = DockPosition.Left; break; case AllowedDockPosition.Right: dockPos = DockPosition.Right; break; case AllowedDockPosition.Top: dockPos = DockPosition.Top; break; } return(dockPos); }
static Vector2 GetFakeMousePosition(EditorWindow window, DockPosition position) { Vector2 mousePosition = Vector2.zero; // The 20 is required to make the docking work. // Smaller values might not work when faking the mouse position. const float offset = 20; switch (position) { case DockPosition.Left: mousePosition.Set(offset, window.position.size.y / 2); break; case DockPosition.Top: // Top docking seems to require roughly a double offset in order to work, // probably due to extra space required by the tab bar. mousePosition.Set(window.position.size.x / 2, offset * 2); break; case DockPosition.Right: mousePosition.Set(window.position.size.x - offset, window.position.size.y / 2); break; case DockPosition.Bottom: mousePosition.Set(window.position.size.x / 2, window.position.size.y - offset); break; } return(new Vector2(window.position.x + mousePosition.x, window.position.y + mousePosition.y)); }
/// <summary> /// 拖拽过程中计算在当前Tabs中的可停靠区域 /// </summary> /// <param name="p_dockPos"></param> /// <param name="p_dockItem"></param> /// <returns></returns> internal Rect GetRectDimenstion(DockPosition p_dockPos, Pane p_dockItem) { Point topLeft = new Point(); Size parentSize = Size.Empty; Size size = new Size(0.0, 0.0); bool isHor = false; if (OwnWinItem != null) { parentSize = OwnWinItem.RenderSize; isHor = OwnWinItem.Orientation == Orientation.Horizontal; RelativeSizes sumOfSizes = OwnWinItem.GetSumOfRelativeSizes(); if (isHor) { sumOfSizes.LengthSum += p_dockItem.InitWidth; sumOfSizes.WithoutChange += p_dockItem.InitWidth; size.Width = sumOfSizes.LengthSum; } else { sumOfSizes.LengthSum += p_dockItem.InitHeight; sumOfSizes.WithoutChange += p_dockItem.InitHeight; size.Height = sumOfSizes.LengthSum; } size = GetSize(p_dockPos, sumOfSizes, parentSize, new Size(p_dockItem.InitWidth, p_dockItem.InitHeight)); topLeft = GetTopLeft(p_dockPos, sumOfSizes, parentSize, size); } return(new Rect(topLeft, size)); }
private void AddRandomRadButton_Click(object sender, EventArgs e) { Random random = new Random(DateTime.Now.Second); DockPosition dockPos = DockPosition.Left; int index = random.Next(1, 5); if (index == 1) { dockPos = DockPosition.Left; } else if (index == 2) { dockPos = DockPosition.Right; } else if (index == 3) { dockPos = DockPosition.Top; } else if (index == 4) { dockPos = DockPosition.Bottom; } ToolWindow window = CreatePanel("Tool Window", dockPos, new Size(100, 100), Color.FromArgb(random.Next(100, 255), random.Next(100, 255), random.Next(100, 255))); }
internal static SWF.DockStyle GetDockStyle(DockPosition dockPosition) { if (dockPosition == DockPosition.Top) { return(SWF.DockStyle.Top); } else if (dockPosition == DockPosition.Bottom) { return(SWF.DockStyle.Bottom); } else if (dockPosition == DockPosition.Left) { return(SWF.DockStyle.Left); } else if (dockPosition == DockPosition.Right) { return(SWF.DockStyle.Right); } else if (dockPosition == DockPosition.Fill) { return(SWF.DockStyle.Fill); } else { return(SWF.DockStyle.None); } }
public static void DockWindow(this EditorWindow anchor, EditorWindow docked, DockPosition position, Rect dockedPosition) { var anchorParent = GetParentOf(anchor); SetDragSource(anchorParent, GetParentOf(docked)); PerformDrop(GetWindowOf(anchorParent), docked, GetFakeMousePosition(anchor, position), dockedPosition); }
/// <summary> /// Docks the "docked" window to the "anchor" window at the given position /// </summary> public static void DockWindow(this EditorWindow self, EditorWindow child, DockPosition position) { var anchorParent = GetParentOf(self); SetDragSource(anchorParent, GetParentOf(child)); PerformDrop(GetWindowOf(anchorParent), child, GetFakeMousePosition(self, position)); }
private static DockPosition DockPositionFromGuidePosition(DockingGuidesPosition pos) { DockPosition dockPos = DockPosition.Left; switch (pos) { case DockingGuidesPosition.Top: dockPos = DockPosition.Top; break; case DockingGuidesPosition.Bottom: dockPos = DockPosition.Bottom; break; case DockingGuidesPosition.Right: dockPos = DockPosition.Right; break; case DockingGuidesPosition.Center: dockPos = DockPosition.Fill; break; } return(dockPos); }
/// <summary> /// Adds the the second window as a tab at the end of the first window tab list /// </summary> /// <param name="existingWindow"></param> /// <param name="newWindow"></param> // public static void AddTab(this EditorWindow existingWindow, EditorWindow newWindow) // { // var parent = new R_EditorWindow(existingWindow); // var child = new R_EditorWindow(newWindow); // var dockArea = new R_DockArea(parent.Parent); // dockArea.OriginalDragSource = child.Parent; // dockArea.AddTab(newWindow); // } private static Vector2 GetFakeMousePosition(EditorWindow wnd, DockPosition position) { Vector2 mousePosition = Vector2.zero; // The 20 is required to make the docking work. // Smaller values might not work when faking the mouse position. switch (position) { case DockPosition.Left: mousePosition = new Vector2(20, wnd.position.size.y / 2); break; case DockPosition.Top: mousePosition = new Vector2(wnd.position.size.x / 2, 20); break; case DockPosition.Right: mousePosition = new Vector2(wnd.position.size.x - 20, wnd.position.size.y / 2); break; case DockPosition.Bottom: mousePosition = new Vector2(wnd.position.size.x / 2, wnd.position.size.y - 20); break; } return(GUIUtility.GUIToScreenPoint(mousePosition)); }
private bool CanDockIn(object dragged, ISplitItem target, DockPosition position) { // If there is a pane that cannot be dropped in any of the targeted panes. var splitContainer = dragged as RadSplitContainer; return(!splitContainer.EnumeratePanes().Any((RadPane p) => target.EnumeratePanes().Any((RadPane p1) => !CanDockIn(p, p1, position)))); }
internal static bool IsAutoHide(DockPosition dockPosition) { return (dockPosition == DockPosition.LeftAutoHide || dockPosition == DockPosition.RightAutoHide || dockPosition == DockPosition.TopAutoHide || dockPosition == DockPosition.BottomAutoHide); }
static Vector2 GetFakeMousePosition(EditorWindow wnd, DockPosition position) { Vector2 mousePosition = Vector2.zero; // The 20 is required to make the docking work. // Smaller values might not work when faking the mouse position. switch (position) { case DockPosition.Left: mousePosition.Set(20, wnd.position.size.y / 2); break; //case DockPosition.Top: // mousePosition.Set(wnd.position.size.x / 2, 20); // break; case DockPosition.Right: mousePosition.Set(wnd.position.size.x - 20, wnd.position.size.y / 2); break; case DockPosition.Bottom: mousePosition.Set(wnd.position.size.x / 2, wnd.position.size.y - 20); break; } return(new Vector2(wnd.position.x + mousePosition.x, wnd.position.y + mousePosition.y)); }
public PrismTaskPaneAttribute( string id, string title, Type view, string regionName, string navigationValue, string regionContext, bool visible = false, bool invisibleAtStart = false, int width = 0, int height = 0, DockPosition dockPosition = DockPosition.Right, DockRestriction dockRestriction = DockRestriction.None, ScrollVisibility scrollBarHorizontal = ScrollVisibility.Auto, ScrollVisibility scrollBarVertical = ScrollVisibility.Auto) : this(id : id, title : title, view : view, regionName : regionName, navigationValue : navigationValue, visible : visible, invisibleAtStart : invisibleAtStart, width : width, height : height, dockPosition : dockPosition, dockRestriction : dockRestriction, scrollBarHorizontal : scrollBarHorizontal, scrollBarVertical : scrollBarVertical) { if (string.IsNullOrWhiteSpace(regionContext)) { throw new ArgumentNullException(nameof(regionContext)); } RegionContext = regionContext; }
public void Dock_DockPosition() { // Arrange DockPosition expectedValue = DockPosition.Bottom; ISupportsDockPattern element = FakeFactory.GetAutomationElementForMethodsOfObjectModel( new IBasePattern[] { FakeFactory.GetDockPattern(new PatternsData() { DockPattern_DockPosition = expectedValue }) }) as ISupportsDockPattern; // // Arrange // ExpandCollapseState expectedValue = ExpandCollapseState.Expanded; // ISupportsExpandCollapsePattern element = // FakeFactory.GetAutomationElementForMethodsOfObjectModel( // new IBasePattern[] { FakeFactory.GetExpandCollapsePattern(new PatternsData() { ExpandCollapsePattern_ExpandCollapseState = expectedValue }) }) as ISupportsExpandCollapsePattern; // // Act // element.SetDockPosition(expectedValue); // // // Assert // Assert.AreEqual(expectedValue, element.DockPosition); // Act // Assert CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$input | %{ $_.DockPosition; }", new [] { element }, expectedValue.ToString()); }
private void SetupArea(DockPosition position, ContentControl contentArea) { var extensionForThisArea = Extensions.Where(e => e.Metadata.Position == position).ToList(); if (extensionForThisArea.Count == 0) { contentArea.Visibility = System.Windows.Visibility.Collapsed; } else if (extensionForThisArea.Count == 1) { contentArea.Content = extensionForThisArea[0].Value; } else { TabControl tabControl = new TabControl(); foreach (var extension in extensionForThisArea) { var tabItem = new TabItem(); tabItem.Header = extension.Metadata.Name; tabItem.Content = extension.Value; tabControl.Items.Add(tabItem); } contentArea.Content = tabControl; } }
internal override void OnDockPositionChanged(DockPosition oldDockPosition, DockPosition newDockPosition) { if (Parent != null) { Parent.InvalidateState(); } }
/// <summary> /// Asks the current <see cref="DockWindow.DockManager">DockManager</see> instance (if any) to dock the window to the specified target, using the desired position. /// </summary> /// <param name="target"></param> /// <param name="position"></param> public void DockTo(DockWindow target, DockPosition position) { if (target != null && target.DockManager != null) { target.DockManager.DockWindow(this, target, position); } }
public DrawValue MoveRight (DockPosition position, double amount) { DrawValue result = new DrawValue { Center = Center, StaticCenter = StaticCenter, HoverArea = HoverArea, Zoom = Zoom }; switch (position) { case DockPosition.Top: result.Center.X += amount; result.StaticCenter.X += amount; break; case DockPosition.Left: result.Center.Y += amount; result.StaticCenter.Y += amount; break; case DockPosition.Right: result.Center.Y -= amount; result.StaticCenter.Y -= amount; break; case DockPosition.Bottom: result.Center.X -= amount; result.StaticCenter.X -= amount; break; } return result; }
Size GetSize(DockPosition p_dock, RelativeSizes p_relativeSizes, Size p_parentSize, Size p_draggedSize) { Size size = base.RenderSize; if (p_dock != DockPosition.Center) { bool isDockHor = (p_dock == DockPosition.Left) || (p_dock == DockPosition.Right); bool isParentHor = OwnWinItem.Orientation == Orientation.Horizontal; bool findHorizontal = isParentHor == (isDockHor == isParentHor); double length = 0.0; if (isDockHor != isParentHor) { double relativeSizeSum = TabItemPanel.GetLength(this, isDockHor) + GetLength(p_draggedSize, isDockHor); p_relativeSizes = GetRelativeSizesSum(relativeSizeSum); } length = GetRenderLength( 0.0, GetLength(p_draggedSize, findHorizontal), GetLength(p_parentSize, findHorizontal), p_relativeSizes); if (findHorizontal) { size.Width = length; return(size); } size.Height = length; } return(size); }
public WpfAppBar(Window window) { _currentPosition = new Position(); _window = window; // Show/Hide timers. _showTimer = new Timer(); _showTimer.AutoReset = false; _showTimer.Elapsed += OnShowTimerElapsed; _hideTimer = new Timer(); _hideTimer.AutoReset = true; _hideTimer.Elapsed += OnHideTimerElapsed; // Windows styles and events. _window.WindowStyle = WindowStyle.None; _window.ResizeMode = ResizeMode.NoResize; _window.ShowInTaskbar = false; _window.Closed += OnClose; _window.MouseLeave += OnMouseLeave; _window.AllowDrop = true; _window.PreviewDragEnter += OnDragEnter; _window.DragLeave += OnDragLeave; Microsoft.Win32.SystemEvents.DisplaySettingsChanged += OnDisplaySettingsChanged; // Default Values. PopupDelay = AppBarDefaultValues.PopupDelay; AutoHideDelay = AppBarDefaultValues.AutoHideDelay; ReserveScreen = AppBarDefaultValues.ReserveScreen; Docked = new DockPosition(AppBarDefaultValues.Docked); ActiveScreen = AppBarDefaultValues.Screen; }
protected InternalPanel(EditorWindow window, DockPosition alignment, float scale) { this.window = window; this.alignment = alignment; this.scale = scale; CalculateRect(); }
public void AddDocument(string title, DockPosition pos, Control c) { c.Dock = DockStyle.Fill; var windowTop = new DocumentWindow { Text = title, Name = title }; windowTop.Controls.Add(c); this.rda.AddDocument(windowTop, pos); }
/// <summary> /// Abre / cierra un panel lateral /// </summary> public void OpenGroup(DockPosition position) { LayoutAnchorGroup layoutGroup = GetGroupPane(Layout, position); // Abre el panel if (layoutGroup.Children.Count > 0) { // Cambia el ancho / alto del grupo switch (position) { case DockPosition.Left: case DockPosition.Right: layoutGroup.Children[0].AutoHideWidth = 400; layoutGroup.Children[0].AutoHideMinWidth = 200; break; default: layoutGroup.Children[0].AutoHideHeight = 600; layoutGroup.Children[0].AutoHideMinHeight = 600; break; } // Cambia el autohide para que aparezca //? Después de ejecutar esta instrucción, parece que se cambia el grupo, por tanto ya no podemos utilizar layoutGroup.Children[0] //? que provocaría una excepción layoutGroup.Children[0].ToggleAutoHide(); } }
/// <summary> /// 设置停靠位置属性值 /// </summary> public static void SetDock(UIElement element, DockPosition dock) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(DockProperty, dock); }
private DockWindow GetEdgeDockwindow(DockPosition dockPosition) { if (_edgeDockwindows.ContainsKey(dockPosition)) { return(_edgeDockwindows[dockPosition]); } return(null); }
/// <summary> /// Docks the "docked" window to the "anchor" window at the given position. /// </summary> /// <param name="anchor">Window to dock.</param> /// <param name="docked">Window to dock into.</param> /// <param name="position">Position to the docked into.</param> public static void DockWindow(this EditorWindow anchor, EditorWindow docked, DockPosition position) { // NOTE Code adapted from https://gist.github.com/Thundernerd/5085ec29819b2960f5ff2ee32ad57cbb#gistcomment-2834853 var anchorParent = GetParentOf(anchor); SetDragSource(anchorParent, GetParentOf(docked)); PerformDrop(GetWindowOf(anchorParent), docked, GetFakeMousePosition(anchor, position)); }
public ToolWindow AddToolWindow(string title, DockPosition pos, Control c) { c.Dock = DockStyle.Fill; var windowTop = new ToolWindow { Text = title, Name = title }; windowTop.Controls.Add(c); this.rda.DockWindow(windowTop, pos); return windowTop; }
public void SetDockPosition (DockPosition dockPosition) { try { pattern.SetDockPosition (dockPosition); } catch (Exception ex) { throw DbusExceptionTranslator.Translate (ex); } }
public void SetDockPosition(DockPosition dockPosition) { try { pattern.SetDockPosition(dockPosition); } catch (Exception ex) { throw DbusExceptionTranslator.Translate(ex); } }
public void SetDockPosition (DockPosition position, bool log) { if (log) procedureLogger.Action (string.Format ("Dock {0} to {1}.", this.NameAndType, position)); DockPattern dp = (DockPattern) element.GetCurrentPattern (DockPattern.Pattern); dp.SetDockPosition (position); }
public void SetInitialDockingPatameters(int left, int rigth, int top, int bottom, DockPosition position, Guid targetGuid) { this.m_position = position; this.m_left = left; this.m_rigth = rigth; this.m_top = top; this.m_bottom = bottom; this.m_targetGuid = targetGuid; }
private void VerifyDockPosition(DockPattern pattern, DockPosition dockPosition) { Assert.AreEqual(dockPosition, pattern.Current.DockPosition, "DockPosition " + dockPosition); Assert.AreEqual(dockPosition, splitter1Element.GetCurrentPropertyValue(DockPattern.DockPositionProperty), "DockPositionProperty " + dockPosition); }
public CloseEventArgs(DockItem dockItem) : base(dockItem) { Debug.Assert(dockItem.DockControl != null); _dockControl = dockItem.DockControl; _oldDockTreePosition = dockItem.DockTreePosition; _oldIsAutoHide = dockItem.IsAutoHide; _oldDockPosition = dockItem.DockPosition; }
Point GetTopLeft(DockPosition dock, RelativeSizes relativeSizes, Size parentRenderSize, Size draggedElementRenderSize) { Point topLeft = new Point(); bool shouldTransform = true; if (dock != DockPosition.Center) { int index = OwnWinItem.Items.IndexOf(this); if ((dock == DockPosition.Right) || (dock == DockPosition.Bottom)) { index++; } bool isDockHor = (dock == DockPosition.Left) || (dock == DockPosition.Right); bool isParentHor = OwnWinItem.Orientation == Orientation.Horizontal; double length = 0.0; if (isParentHor != isDockHor) { if ((dock == DockPosition.Right) || (dock == DockPosition.Bottom)) { length = GetLength(parentRenderSize, isDockHor) - GetLength(draggedElementRenderSize, isDockHor); } } else { for (int i = 0; i < index; i++) { FrameworkElement element = OwnWinItem.Items[i] as FrameworkElement; if (element.Visibility == Visibility.Visible) { length += GetRenderLength( TabItemPanel.GetSplitterChange(element), TabItemPanel.GetLength(element, isParentHor), GetLength(parentRenderSize, isParentHor), relativeSizes); } } shouldTransform = false; } if (isParentHor == (isDockHor == isParentHor)) { topLeft.X = length; } else { topLeft.Y = length; } } if (shouldTransform) { return(base.TransformToVisual(OwnWinItem).TransformPoint(topLeft)); } UIElement firstChild = OwnWinItem.Items[0] as UIElement; return(firstChild.TransformToVisual(OwnWinItem).TransformPoint(topLeft)); }
/// <summary> /// Retrieves the handle to the appbar associated to the edge of the screen. /// </summary> /// <returns> /// Returns the handle to the autohide appbar. The return value is 0 if an error occurs or /// if no autohide appbar is associated with the given edge. /// </returns> public IntPtr GetAutoHide(DockPosition dock) { APPBARDATA msgData = new APPBARDATA(); msgData.cbSize = Marshal.SizeOf(msgData); msgData.hWnd = _handle; msgData.uEdge = (uint)dock.ToNative(); return Win32AppBar.SHAppBarMessage(ABM.ABM_GETAUTOHIDEBAR, ref msgData); }
private void UpdateDockIndicator(DockPosition position, bool isEnabled) { var dockIndicator = _dockIndicators[(int)position]; if (dockIndicator != null) { dockIndicator.IsEnabled = isEnabled; } }
public void SetInitialDockingParameters(int left, int right, int top, int bottom, DockPosition position, Guid targetGuid) { m_position = position; m_left = left; m_right = right; m_top = top; m_bottom = bottom; m_targetGuid = targetGuid; }
public DropTarget(DockPane dockPane, DockPosition pos) { this.dockPane = dockPane; this.pos = pos; this.WidthRequest = dockPane.wh; this.HeightRequest = dockPane.wh; this.Opacity = .8f; this.BackgroundColor = DockPanel.DropTargetColor; }
/// <summary> /// Registers or unregisters an autohide appbar for an edge of the screen. /// </summary> /// <returns> /// Returns true if successful, or false if an error occurs or /// if an autohide appbar is already registered for the given edge. /// </returns> public bool SetAutoHide(DockPosition dock, bool autohide) { APPBARDATA msgData = new APPBARDATA(); msgData.cbSize = Marshal.SizeOf(msgData); msgData.hWnd = _handle; msgData.lParam = autohide ? Win32.TRUE : Win32.FALSE; msgData.uEdge = (uint)dock.ToNative(); return Win32AppBar.SHAppBarMessage(ABM.ABM_SETAUTOHIDEBAR, ref msgData).ToInt32() == Win32.TRUE; }
public void SetDockPosition(DockPosition dockPosition) { try { this._pattern.SetDockPosition((UIAutomationClient.DockPosition)dockPosition); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public void SetDockPosition (DockPosition dockPosition) { //throw new InvalidOperationException (); if (splitContainer.InvokeRequired == true) { splitContainer.BeginInvoke (new PerformSetDockPositionDelegate (SetDockPosition), new object [] { dockPosition }); return; } splitContainer.Dock = Helper.GetDockStyle (dockPosition); }
/// <summary> /// Determines if the Docking's Top, Bottom, Left and Right compasses should be shown for the Dragged Pane /// </summary> private bool CanDock(RadPane paneToDock, DockPosition position) { PaneType paneToDockType = GetPaneType(paneToDock); switch (paneToDockType) { case PaneType.Green: return true; case PaneType.Blue: return true; case PaneType.Default: return true; } return false; }
private bool CanDockIn(RadPane paneToDock, RadPane paneInTargetGroup, DockPosition position) { PaneType paneToDockType = GetPaneType(paneToDock); PaneType paneInTargetGroupType = GetPaneType(paneInTargetGroup); switch (paneToDockType) { case PaneType.Green: switch (paneInTargetGroupType) { case PaneType.Green: return true; case PaneType.OceanBlue: return position != DockPosition.Top && position != DockPosition.Bottom; case PaneType.Purple: return position != DockPosition.Top && position != DockPosition.Bottom; } break; case PaneType.OceanBlue: switch (paneInTargetGroupType) { case PaneType.Green: return position != DockPosition.Left && position != DockPosition.Right; case PaneType.OceanBlue: return true; case PaneType.Purple: return position != DockPosition.Left && position != DockPosition.Right; } break; case PaneType.Purple: switch (paneInTargetGroupType) { case PaneType.Green: return position != DockPosition.Center; case PaneType.OceanBlue: return position != DockPosition.Center; case PaneType.Purple: return true; } break; } return false; }
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; }
public static void ShowAsReflection (this DockySurface self, DockySurface target, PointD point, double zoom, double rotation, double opacity, double height, DockPosition position) { if (target == null) throw new ArgumentNullException ("target"); Cairo.Context cr = target.Context; switch (position) { case DockPosition.Left: point.X -= self.Width * zoom + height; break; case DockPosition.Top: point.Y -= self.Height * zoom + height; break; case DockPosition.Right: point.X += self.Width * zoom + height; break; case DockPosition.Bottom: point.Y += self.Height * zoom + height; break; } double cos, sin; cos = Math.Cos (rotation); sin = Math.Sin (rotation); Matrix m = new Matrix (cos, sin, -sin, cos, point.X, point.Y); cr.Transform (m); if (zoom != 1) cr.Scale (zoom, zoom); if (position == DockPosition.Left || position == DockPosition.Right) cr.Scale (-1, 1); else cr.Scale (1, -1); cr.SetSource (self.Internal, -self.Width / 2, -self.Height / 2); cr.PaintWithAlpha (opacity * .3); cr.IdentityMatrix (); }
/// <summary> /// Determines if the specific Pane's Top, Bottom, Left and Right compasses should be shown for the Dragged Pane /// </summary> private bool CanDockIn(RadPane paneToDock, RadPane paneInTargetGroup, DockPosition position) { PaneType paneToDockType = GetPaneType(paneToDock); PaneType paneInTargetGroupType = GetPaneType(paneInTargetGroup); switch (paneToDockType) { case PaneType.Green: switch (paneInTargetGroupType) { case PaneType.Green: return true; case PaneType.Blue: return false; case PaneType.Default: return false; } break; case PaneType.Blue: switch (paneInTargetGroupType) { case PaneType.Green: return false; case PaneType.Blue: return true; case PaneType.Default: return false; } break; case PaneType.Default: switch (paneInTargetGroupType) { case PaneType.Green: return false; case PaneType.Blue: return false; case PaneType.Default: return true; } break; } return false; }
public static void DockWindow( Window appbarWindow, DockPosition edge, bool autoHide ) { var info = GetRegisterInfo( appbarWindow ); info.Edge = edge; info.AutoHide = autoHide; var abd = new Shell32.Appbardata(); abd.cbSize = Marshal.SizeOf( abd ); abd.hWnd = new WindowInteropHelper( appbarWindow ).Handle; if ( edge == DockPosition.None ) { if ( info.IsRegistered ) { Shell32.SHAppBarMessage( (int)Shell32.AppBarMessages.ABM_REMOVE, ref abd ); info.IsRegistered = false; } RestoreWindow( appbarWindow ); return; } if ( !info.IsRegistered ) { info.IsRegistered = true; info.CallbackId = (int)WUser32.RegisterWindowMessage( "AppBarMessage" ); abd.uCallbackMessage = info.CallbackId; Shell32.SHAppBarMessage( (int)Shell32.AppBarMessages.ABM_NEW, ref abd ); Shell32.SHAppBarMessage( (int)Shell32.AppBarMessages.ABM_ACTIVATE, ref abd ); var source = HwndSource.FromHwnd( abd.hWnd ); if ( source != null ) source.AddHook( info.WndProc ); } appbarWindow.WindowStyle = WindowStyle.None; appbarWindow.ResizeMode = ResizeMode.NoResize; appbarWindow.Topmost = true; SetPostion( info.Edge, appbarWindow, autoHide ); }
private bool CanDock(RadPane paneToDock, DockPosition position) { PaneType paneToDockType = GetPaneType(paneToDock); switch (paneToDockType) { case PaneType.Green: return position != DockPosition.Left; case PaneType.OceanBlue: return false; case PaneType.Purple: return true; } return false; }
private bool CanDock(ISplitItem dragged, DockPosition position) { return !dragged.EnumeratePanes().Any((RadPane p) => !CanDock(p, position)); }
bool InRegion (DockGroup grp, DockPosition pos, DockObject refObject, DockGroup objToFindParent, int objToFindIndex, bool insertingPosition) { if (grp == null) return false; if (grp.Type == DockGroupType.Tabbed) { if (pos != DockPosition.Center && pos != DockPosition.CenterBefore) return InRegion (grp.ParentGroup, pos, grp, objToFindParent, objToFindIndex, insertingPosition); } if (grp.Type == DockGroupType.Horizontal) { if (pos != DockPosition.Left && pos != DockPosition.Right) return InRegion (grp.ParentGroup, pos, grp, objToFindParent, objToFindIndex, insertingPosition); } if (grp.Type == DockGroupType.Vertical) { if (pos != DockPosition.Top && pos != DockPosition.Bottom) return InRegion (grp.ParentGroup, pos, grp, objToFindParent, objToFindIndex, insertingPosition); } bool foundAtLeftSide = true; bool findingLeft = pos == DockPosition.Left || pos == DockPosition.Top || pos == DockPosition.CenterBefore; if (objToFindParent == grp) { // Check positions beyond the current range of items if (objToFindIndex < 0 && findingLeft) return true; if (objToFindIndex >= grp.Objects.Count && !findingLeft) return true; } for (int n=0; n<grp.Objects.Count; n++) { var ob = grp.Objects[n]; bool foundRefObject = ob == refObject; bool foundTargetObject = objToFindParent == grp && objToFindIndex == n; if (foundRefObject) { // Found the reference object, but if insertingPosition=true it is in the position that the new item will have, // so this position still has to be considered to be at the left side if (foundTargetObject && insertingPosition) return foundAtLeftSide == findingLeft; foundAtLeftSide = false; } else if (foundTargetObject) return foundAtLeftSide == findingLeft; else if (ob is DockGroup) { DockGroup gob = (DockGroup)ob; if (gob == objToFindParent || ObjectHasAncestor (objToFindParent, gob)) return foundAtLeftSide == findingLeft; } } return InRegion (grp.ParentGroup, pos, grp, objToFindParent, objToFindIndex, insertingPosition); }
internal void InvokeDockSet(System.Windows.Automation.AutomationElement _control, AutomationElement inputObject, DockPosition position) { try { DockPattern dockPattern = _control.GetCurrentPattern(DockPattern.Pattern) as DockPattern; if (null != dockPattern) { dockPattern.SetDockPosition(position); if (this.PassThru && null != (inputObject as AutomationElement)) { WriteObject(this, inputObject); } else { WriteObject(this, true); } } else { WriteVerbose(this, "couldn't get DockPattern"); WriteObject(this, false); } } catch { } }
//------------------------------------------------------ // // Interface IDockProvider // //------------------------------------------------------ #region Interface IDockProvider public void SetDockPosition(DockPosition dockPosition) { ElementUtil.Invoke( _peer, new DispatcherOperationCallback( SetDockPosition ), dockPosition ); }
DockGroupItem InsertObject (DockItem obj, int npos, DockPosition pos) { if (pos == DockPosition.Bottom || pos == DockPosition.Right) npos++; DockGroupItem gitem = new DockGroupItem (Frame, obj); dockObjects.Insert (npos, gitem); gitem.ParentGroup = this; return gitem; }
//------------------------------------------------------ // // Public Methods // //------------------------------------------------------ #region Public Methods /// <summary> /// Moves the window to be docked at the requested location. /// </summary> /// /// <outside_see conditional="false"> /// This API does not work inside the secure execution environment. /// <exception cref="System.Security.Permissions.SecurityPermission"/> /// </outside_see> public void SetDockPosition( DockPosition dockPosition ) { UiaCoreApi.DockPattern_SetDockPosition(_hPattern, dockPosition); }
private void UpdateDockIndicator(DockPosition position, bool isEnabled) { var dockIndicator = _dockIndicators[(int)position]; if (dockIndicator != null) dockIndicator.IsEnabled = isEnabled; }
/// <summary> /// Tests whether the mouse hits one of the <see cref="UIElement"/>s. /// </summary> /// <returns>A result that indicates which <see cref="UIElement"/> was hit.</returns> public DockPosition HitTest() { var result = DockPosition.None; for (int i = 0; i < _dockIndicators.Length; i++) { var dockIndicator = _dockIndicators[i]; if (dockIndicator != null && dockIndicator.IsEnabled) { bool hit = DockHelper.HitTest(dockIndicator); if (hit) { result = (DockPosition)i; break; } } } Result = result; UpdateVisualStates(true); return result; }
/// <summary> /// Determines whether this dragged items may be docked at the specified position. /// </summary> /// <param name="target">The target pane.</param> /// <param name="position">The position relative to <paramref name="target"/>.</param> /// <returns> /// <see langword="true"/> the specified dock position in allowed; otherwise, /// <see langword="false"/>. /// </returns> private bool CanDock(IDockPane target, DockPosition position) { Debug.Assert(_dockStrategy != null); Debug.Assert(_draggedItems.Count > 0); target = target ?? _dockStrategy.DockControl.RootPane; foreach (var item in _draggedItems) if (!_dockStrategy.CanDock(item, target, position)) return false; return true; }
private bool CanDockIn(ISplitItem dragged, ISplitItem target, DockPosition position) { // If there is a pane that cannot be dropped in any of the targeted panes. return !dragged.EnumeratePanes().Any((RadPane p) => target.EnumeratePanes().Any((RadPane p1) => !CanDockIn(p, p1, position))); }
public void SetDockPosition (DockPosition dockPosition) { Source.SetDockPosition (dockPosition); }