/// <summary> /// Transfers the windows manager contents after desealization has finished /// </summary> /// <param name="windowsManager">The windows manager.</param> private void TransferWindowsManagerContents(WindowsManager windowsManager) { windowsManager.Clear(); // Transfer auto hide and pinned windows for all dock points); foreach (Dock dockPosition in DockPositions) { DockedWindows dockedWindows = _dockedWindows[dockPosition]; foreach (DockPane pinnedPane in dockedWindows.PinnedPanes) { windowsManager.AddPinnedWindow(pinnedPane, dockPosition); } foreach (DockPane autoHidePane in dockedWindows.AutoHidePanes) { windowsManager.AddAutoHideWindow(autoHidePane, dockPosition); } } // Transfer floating windows foreach (DockPane floatingPane in _floatingWindows) { windowsManager.AddFloatingWindow(floatingPane); } // Transfer document content switch (_rootContainer.State) { case DocumentContainerState.Empty: break; case DocumentContainerState.ContainsDocuments: List <object> documents = new List <object>(_rootContainer.Documents); _rootContainer.Clear(); foreach (object document in documents) { if (document is DocumentContent) { DocumentContent documentContent = (document as DocumentContent); documentContent.DetachDockPane(); windowsManager.DocumentContainer.AddDocument(documentContent.DockPane); } } break; case DocumentContainerState.SplitHorizontally: TransferDocumentGrid(windowsManager, true); break; case DocumentContainerState.SplitVertically: TransferDocumentGrid(windowsManager, false); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Adds the dock panel as a document /// </summary> /// <param name="pane">The pane</param> public void AddDocument(DockPane pane) { DocumentContent documentContent = new DocumentContent(pane, RemoveDocumentCommand); pane.DockPaneState = DockPaneState.Content; Documents.Add(documentContent); if (DocumentsTab != null) { DocumentsTab.SelectedItem = documentContent; } State = DocumentContainerState.ContainsDocuments; }
/// <summary> /// Called when tab item is dragged /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void OnTabItemMouseMove(object sender, RoutedEventArgs args) { if ((Mouse.LeftButton != MouseButtonState.Pressed) || (!DragStarted)) { return; } // Check for minimum distance in order to start drag Vector distance = Mouse.GetPosition(this) - DragStartPoint; if ((Math.Abs(distance.X) < SystemParameters.MinimumHorizontalDragDistance) && (Math.Abs(distance.Y) < SystemParameters.MinimumVerticalDragDistance)) { return; } DragStarted = false; WindowsManager windowsManager = this.GetLogicalParent <WindowsManager>(); TabItem currentItem = (args.OriginalSource as FrameworkElement).GetVisualParent <TabItem>(); if (currentItem == null) { return; } currentItem.Header = null; currentItem.Content = null; DocumentContent dockPaneContent = currentItem.DataContext as DocumentContent; Documents.Remove(dockPaneContent); dockPaneContent.DetachDockPane(); windowsManager.DocumentContainer.MergeEmptyDocumentContainers(); Point currentMousePoint = Mouse.GetPosition(windowsManager); DockPane pane = dockPaneContent.DockPane; Canvas.SetLeft(pane, currentMousePoint.X - pane.ActualWidth / 2); Canvas.SetTop(pane, currentMousePoint.Y); windowsManager.AddFloatingWindow(pane); }
private void E_WindowsManager_DocumentClosing(Cuisine.Windows.DocumentContent documentContent) { System.Windows.Controls.Grid g = (System.Windows.Controls.Grid)documentContent.Content; // can occur when new drawingBoard is created and is not set as a document in the DocumentContainer (one with tabs) if (g == null) { return; } if (g.Children[0] is PaintualUI.Controls.DrawingBoard == false) { // TODO : may need to handle closing of VisualPropertyPage (docPane) return; } PaintualUI.Controls.DrawingBoard db = (PaintualUI.Controls.DrawingBoard)g.Children[0]; _app.ActiveContentHelper.DeleteDrawingBoard(db); }
/// <summary> /// Removes the document. /// </summary> /// <param name="documentContent">DocumentContent to remove</param> private void RemoveDocument(DocumentContent documentContent) { if (documentContent == null) { return; } Documents.Remove(documentContent); documentContent.DockPane.CloseCommand.Execute(null); if (Documents.Count == 0) { State = DocumentContainerState.Empty; WindowsManager parentWindowsManager = this.GetVisualParent <WindowsManager>(); if (parentWindowsManager != null) { ReduceChild(parentWindowsManager.DocumentContainer); } } }
private void OnDocumentClosing(DocumentContent documentContent) { DocumentClosing?.Invoke(documentContent); }
private void DocumentContainer_DocumentClosing(DocumentContent documentContent) { OnDocumentClosing(documentContent); }