public DragService(LayoutFloatingWindowControl floatingWindow) { _floatingWindow = floatingWindow; _manager = floatingWindow.Model.Root.Manager; GetOverlayWindowHosts(); }
/// <summary> /// Constructor /// </summary> public DesktopForm() { #if !MONO SplashScreenManager.DismissSplashScreen(this); #endif InitializeComponent(); //Set both to be initially invisible, since there's nothing on them. _toolbar.Visible = false; _mainMenu.Visible = false; // manually subscribe this event handler *after* the call to InitializeComponent() _toolbar.ParentChanged += OnToolbarParentChanged; _dockingManager = new DockingManager(_toolStripContainer.ContentPanel, VisualStyle.IDE2005); _dockingManager.ActiveColor = SystemColors.Control; _dockingManager.InnerControl = _tabbedGroups; _dockingManager.TabControlCreated += OnDockingManagerTabControlCreated; _tabbedGroups.DisplayTabMode = DisplayTabModes.HideAll; _tabbedGroups.TabControlCreated += OnTabbedGroupsTabControlCreated; if (_tabbedGroups.ActiveLeaf != null) { InitializeTabControl(_tabbedGroups.ActiveLeaf.TabControl); } ToolStripSettings.Default.PropertyChanged += OnToolStripSettingsPropertyChanged; OnToolStripSettingsPropertyChanged(ToolStripSettings.Default, new PropertyChangedEventArgs("WrapLongToolstrips")); OnToolStripSettingsPropertyChanged(ToolStripSettings.Default, new PropertyChangedEventArgs("IconSize")); }
internal NavigatorWindow(DockingManager manager) { _manager = manager; _internalSetSelectedDocument = true; SetAnchorables( _manager.Layout.Descendents() .OfType<LayoutAnchorable>() .Where(a => a.IsVisible) .Select(d => (LayoutAnchorableItem) _manager.GetLayoutItemFromModel(d)) .ToArray()); SetDocuments( _manager.Layout.Descendents() .OfType<LayoutDocument>() .OrderByDescending(d => d.LastActivationTimeStamp.GetValueOrDefault()) .Select(d => (LayoutDocumentItem) _manager.GetLayoutItemFromModel(d)) .ToArray()); _internalSetSelectedDocument = false; if (Documents.Length > 1) InternalSetSelectedDocument(Documents[1]); DataContext = this; Loaded += OnLoaded; Unloaded += OnUnloaded; UpdateThemeResources(); }
internal DockingManagerOverlayArea(IOverlayWindow overlayWindow, DockingManager manager) : base(overlayWindow) { _manager = manager; base.SetScreenDetectionArea(new Rect( _manager.PointToScreenDPI(new Point()), _manager.TransformActualSizeToAncestor())); }
public void InitPanes(DockingManager dock) { if(IsInitialized) { throw new Exception("Panes already initialized"); } _dock=dock; _dock.NewDockStateEndLoad+=new EventHandler(_dock_NewDockStateEndLoad); }
public LayoutSerializer(DockingManager manager) { if (manager == null) throw new ArgumentNullException("manager"); _manager = manager; _previousAnchorables = _manager.Layout.Descendents().OfType<LayoutAnchorable>().ToArray(); _previousDocuments = _manager.Layout.Descendents().OfType<LayoutDocument>().ToArray(); }
internal DockingManagerOverlayArea(IOverlayWindow overlayWindow, DockingManager manager) : base(overlayWindow) { var manager1 = manager; SetScreenDetectionArea(new Rect( manager1.PointToScreenDpi(new Point()), manager1.TransformActualSizeToAncestor())); }
internal static void FinalizeFocusManagement(DockingManager manager) { manager.PreviewGotKeyboardFocus -= new KeyboardFocusChangedEventHandler(manager_PreviewGotKeyboardFocus); _managers.Remove(manager); if (_managers.Count == 0) { //InputManager.Current.EnterMenuMode -= new EventHandler(InputManager_EnterMenuMode); //InputManager.Current.LeaveMenuMode -= new EventHandler(InputManager_LeaveMenuMode); if (_windowHandler != null) { _windowHandler.FocusChanged -= new EventHandler<FocusChangeEventArgs>(WindowFocusChanging); //_windowHandler.Activate -= new EventHandler<WindowActivateEventArgs>(WindowActivating); _windowHandler.Detach(); _windowHandler = null; } } }
internal static void SetupFocusManagement(DockingManager manager) { if (_managers.Count == 0) { //InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode); //InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode); _windowHandler = new WindowHookHandler(); _windowHandler.FocusChanged += new EventHandler<FocusChangeEventArgs>(WindowFocusChanging); //_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating); _windowHandler.Attach(); if (Application.Current != null) Application.Current.Exit += new ExitEventHandler(Current_Exit); } manager.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(manager_PreviewGotKeyboardFocus); _managers.Add(manager); }
protected override System.Runtime.InteropServices.HandleRef BuildWindowCore(System.Runtime.InteropServices.HandleRef hwndParent) { _wpfContentHost = new HwndSource(new HwndSourceParameters() { ParentWindow = hwndParent.Handle, WindowStyle = Win32Helper.WS_CHILD | Win32Helper.WS_VISIBLE | Win32Helper.WS_CLIPSIBLINGS | Win32Helper.WS_CLIPCHILDREN, Width = 1, Height = 1 }); _rootPresenter = new Border() { Child = new AdornerDecorator() { Child = Content }, Focusable = true }; _rootPresenter.SetBinding(Border.BackgroundProperty, new Binding("Background") { Source = _owner }); _wpfContentHost.RootVisual = _rootPresenter; _wpfContentHost.SizeToContent = SizeToContent.Manual; _manager = _owner.Model.Root.Manager; _manager.InternalAddLogicalChild(_rootPresenter); return new HandleRef(this, _wpfContentHost.Handle); }
/// <summary> /// save the state /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSaveState(object sender, RoutedEventArgs e) { switch (m_storageFormat) { case StorageFormat.Xml: case StorageFormat.Binary: IFormatter formatter = null; #if !NETCORE formatter = m_bIsSoapFormatter ? (IFormatter) new SoapFormatter() : (IFormatter) new BinaryFormatter(); #else formatter = (IFormatter) new BinaryFormatter(); #endif DockingManager.SaveDockState(formatter, m_storageFormat, m_strStoragePath + m_storageFormat.ToString().Substring(0, 3)); break; case StorageFormat.Registry: DockingManager.SaveDockState(new BinaryFormatter()); break; } }
/// <summary> /// Loads the layout of a particular docking manager instance from persistence /// and checks whether a file should really be reloaded (some files may no longer /// be available). /// </summary> /// <param name="docManager"></param> private void LoadDockingManagerLayout(DockingManager docManager) { string layoutFileName = System.IO.Path.Combine(AppData.StoredAppData.GetDirectory(), "layout.xml"); if (System.IO.File.Exists(layoutFileName) == false) { return; } var layoutSerializer = new XmlLayoutSerializer(docManager); layoutSerializer.LayoutSerializationCallback += (s, args) => { // This can happen if the previous session was loading a file // but was unable to initialize the view ... if (args.Model.ContentId == null) { args.Cancel = true; return; } }; //layoutSerializer.Deserialize(layoutFileName); }
internal NavigatorWindow(DockingManager manager) { this._manager = manager; this._internalSetSelectedDocument = true; this.SetAnchorables(( from a in this._manager.Layout.Descendents().OfType <LayoutAnchorable>() where a.IsVisible select a into d select(LayoutAnchorableItem) this._manager.GetLayoutItemFromModel(d)).ToArray <LayoutAnchorableItem>()); this.SetDocuments(( from d in this._manager.Layout.Descendents().OfType <LayoutDocument>() orderby d.LastActivationTimeStamp.GetValueOrDefault() descending select(LayoutDocumentItem) this._manager.GetLayoutItemFromModel(d)).ToArray <LayoutDocumentItem>()); this._internalSetSelectedDocument = false; if ((int)this.Documents.Length > 1) { this.InternalSetSelectedDocument(this.Documents[1]); } base.DataContext = this; base.Loaded += new RoutedEventHandler(this.OnLoaded); base.Unloaded += new RoutedEventHandler(this.OnUnloaded); this.UpdateThemeResources(null); }
private void SetState(DependencyObject obj, IChildrenElement element) { if (element.State == DockState.Document) { DockingManager.SetState(obj, Syncfusion.Windows.Tools.Controls.DockState.Document); } else if (element.State == DockState.Hidden) { DockingManager.SetState(obj, Syncfusion.Windows.Tools.Controls.DockState.Hidden); } else if (element.State == DockState.Float) { DockingManager.SetState(obj, Syncfusion.Windows.Tools.Controls.DockState.Float); } else if (element.State == DockState.AutoHidden) { DockingManager.SetState(obj, Syncfusion.Windows.Tools.Controls.DockState.AutoHidden); } else { DockingManager.SetState(obj, Syncfusion.Windows.Tools.Controls.DockState.Dock); } }
/// <summary> /// Called when [is fixed size changed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void OnIsFixedSizeChanged(object sender, RoutedEventArgs e) { MenuItem item = sender as MenuItem; FrameworkElement element = DockingManager.ActiveWindow; if (element != null) { switch ((string)item.Header) { case "IsFixedSize": DockingManager.SetIsFixedSize(element, !item.IsChecked); break; case "IsFixedHeight": DockingManager.SetIsFixedHeight(element, !item.IsChecked); break; case "IsFixedWidth": DockingManager.SetIsFixedWidth(element, !item.IsChecked); break; } } }
private void AnimationSpeed_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem selectedItem = (sender as ComboBox).SelectedItem as ComboBoxItem; // Set animation speed as very slow if (selectedItem.Content.ToString() == "Very Slow") { DockingManager.SetAnimationDelay(dockingManager, new Duration(new TimeSpan(30000000))); } // Set animation speed as slow else if (selectedItem.Content.ToString() == "Slow") { DockingManager.SetAnimationDelay(dockingManager, new Duration(new TimeSpan(10000000))); } // Set animation speed as normal else if (selectedItem.Content.ToString() == "Normal") { DockingManager.SetAnimationDelay(dockingManager, new Duration(new TimeSpan(5000000))); } // Set animation speed as fast else if (selectedItem.Content.ToString() == "Fast") { DockingManager.SetAnimationDelay(dockingManager, new Duration(new TimeSpan(1000000))); } // Set animation speed as very fast else if (selectedItem.Content.ToString() == "Very Fast") { DockingManager.SetAnimationDelay(dockingManager, new Duration(new TimeSpan(10000))); } valueLabel.IsEnabled = false; textBox1.IsEnabled = false; if (selectedItem.Content.ToString() == "Custom(ms)") { valueLabel.IsEnabled = true; textBox1.IsEnabled = true; } }
protected void InternalConstruct(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex) { // Must provide a valid manager instance if (manager == null) { throw new ArgumentNullException("DockingManager"); } // Define the initial object state _control = control; _title = title; _imageList = imageList; _imageIndex = imageIndex; _manager = manager; _parentWindowContent = null; _order = _counter++; _visible = false; _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize); _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize); _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize); _displayLocation = new Point(_defaultLocation, _defaultLocation); _defaultRestore = new RestoreContentState(State.DockLeft, this); _floatingRestore = new RestoreContentState(State.Floating, this); _autoHideRestore = new RestoreAutoHideState(State.DockLeft, this); _dockingRestore = _defaultRestore; _autoHidePanel = null; _docked = true; _captionBar = true; _closeButton = true; _hideButton = true; _autoHidden = false; _fullTitle = title; }
/// <summary> /// Load the state /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnLoadState(object sender, RoutedEventArgs e) { switch (m_storageFormat) { case StorageFormat.Xml: case StorageFormat.Binary: IFormatter formatter = null; #if !NETCORE formatter = m_bIsSoapFormatter ? (IFormatter) new SoapFormatter() : (IFormatter) new BinaryFormatter(); #else formatter = (IFormatter) new BinaryFormatter(); #endif //try //{ DockingManager.LoadDockState(formatter, m_storageFormat, m_strStoragePath + m_storageFormat.ToString().Substring(0, 3)); //} //catch //{ //}; break; case StorageFormat.Registry: try { DockingManager.LoadDockState(new BinaryFormatter()); } catch { }; break; } }
public MainForm() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // _dockingManager = new DockingManager(this, VisualStyle.Plain); _dockingManager.OuterControl = statusBar1; listView1 = new ListView(); listView1.Columns.Add("代号", 100, HorizontalAlignment.Left); listView1.Columns.Add("原因", 300, HorizontalAlignment.Left); listView1.View = View.Details; Content infoCont = _dockingManager.Contents.Add(listView1, "信息", imageList1, 1); _dockingManager.AddContentWithState(infoCont, State.DockBottom); _dockingManager.HideAllContents(); }
internal static void SetupFocusManagement(DockingManager manager) { if (_managers.Count == 0) { //InputManager.Current.EnterMenuMode += new EventHandler(InputManager_EnterMenuMode); //InputManager.Current.LeaveMenuMode += new EventHandler(InputManager_LeaveMenuMode); _windowHandler = new WindowHookHandler(); _windowHandler.FocusChanged += new EventHandler <FocusChangeEventArgs>(WindowFocusChanging); //_windowHandler.Activate += new EventHandler<WindowActivateEventArgs>(WindowActivating); _windowHandler.Attach(); if (Application.Current != null) { //Application.Current.Exit += new ExitEventHandler( Current_Exit ); //Application.Current.Dispatcher.Invoke(new Action(() => Application.Current.Exit += new ExitEventHandler(Current_Exit))); var disp = Application.Current.Dispatcher; Action subscribeToExitAction = new Action(() => Application.Current.Exit += new ExitEventHandler(Current_Exit)); if (disp.CheckAccess()) { // if we are already on the dispatcher thread we don't need to call Invoke/BeginInvoke subscribeToExitAction(); } else { // For resolve issue "System.InvalidOperationException: Cannot perform this operation while dispatcher processing is suspended." make async subscribing instead of sync subscribing. int disableProcessingCount = (int?)typeof(Dispatcher).GetField("_disableProcessingCount", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(disp) ?? 0; var dispatcherResult = disableProcessingCount == 0 ? disp.Invoke(subscribeToExitAction) : disp.BeginInvoke(subscribeToExitAction); } } } manager.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(manager_PreviewGotKeyboardFocus); _managers.Add(manager); }
public ShellWindow(ShellViewModel viewModel, MenuManager menuManager, DockingManager dockingManager) { InitializeComponent(); Docking.MouseDown += (_, e) => { if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed && e.OriginalSource is FrameworkElement element) { if (element.ParentOfType <RadPane>() is RadPane pane) { MessageBus.Current.ClosePanel(pane); } else if (element.ParentOfType <PaneHeader>() is PaneHeader paneHeader) { MessageBus.Current.ClosePanel(paneHeader.SelectedPane); } } }; ViewModel = viewModel; menuManager.PopulateMenu(Menu); dockingManager.AttachDocking(Docking); }
private ContentControl AddControl(IControlDefinition def) { var contentControl = new ContentControl { Content = (def.Control as UserControl), Name = def.ControlName }; controlDefs.Add(contentControl); DockingManager.SetHeader(contentControl, def.ControlHeader); dmMainDock.Children.Add(contentControl); contentControl.GotFocus += ContentControl_GotFocus; DockingManager.SetState(contentControl, (DockState)def.DefaultState); DockingManager.SetDockAbility(contentControl, DockAbility.All); if (def.DefaultState == (int)DockState.Dock) { DockingManager.SetDesiredWidthInDockedMode(contentControl, 400); DockingManager.SetDesiredHeightInDockedMode(contentControl, 300); DockingManager.SetSideInDockedMode(contentControl, DockSide.Tabbed); } return(contentControl); }
bool LoadLayoutFromBytes(DockingManager dockManager, Byte[] bytes) { InitializeTools(); var serializer = new XmlLayoutSerializer(dockManager); serializer.LayoutSerializationCallback += MatchLayoutContent; try { using (var stream = new MemoryStream(bytes)) { serializer.Deserialize(stream); } RestoreDocumentsFromBytes(bytes); return(true); } catch (Exception ex) { return(false); } }
private void UpdateChildren() { ILayoutControl[] array = base.Children.OfType <ILayoutControl>().ToArray <ILayoutControl>(); this.DetachOldSplitters(); this.DetachPropertChangeHandler(); base.Children.Clear(); base.ColumnDefinitions.Clear(); base.RowDefinitions.Clear(); if (this._model == null || this._model.Root == null) { return; } DockingManager manager = this._model.Root.Manager; if (manager == null) { return; } foreach (T child in this._model.Children) { ILayoutElement layoutElement = child; ILayoutControl layoutControl = array.FirstOrDefault <ILayoutControl>((ILayoutControl chVM) => chVM.Model == layoutElement); if (layoutControl == null) { base.Children.Add(manager.CreateUIElementForModel(layoutElement)); } else { base.Children.Add(layoutControl as UIElement); } } this.CreateSplitters(); this.UpdateRowColDefinitions(); this.AttachNewSplitters(); this.AttachPropertyChangeHandler(); }
/// <summary> /// Close this content without notifications /// </summary> internal void InternalClose() { DockingManager manager = Manager; DocumentPane parentPane = ContainerPane as DocumentPane; FloatingDocumentPane floatingParentPane = ContainerPane as FloatingDocumentPane; if (floatingParentPane != null) { floatingParentPane.RemoveContent(0); if (floatingParentPane.FloatingWindow != null && !floatingParentPane.FloatingWindow.IsClosing) { floatingParentPane.FloatingWindow.Close(); } } else if (parentPane != null) { parentPane.Items.Remove(this); parentPane.CheckContentsEmpty(); } if (manager != null) { if (manager.ActiveContent == this) { manager.ActiveContent = null; } if (manager.ActiveDocument == this) { manager.ActiveDocument = null; } } }
public static void RestoreDefaultLayout(this DockingManager dockingManager) { var thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); using (Stream strm = thisAssembly.GetManifestResourceStream(Constants.AvalonDockDefaultLayoutFile)) { // check if default layout was found if (strm == null) { return; } var ls = new Xceed.Wpf.AvalonDock.Layout.Serialization.XmlLayoutSerializer(dockingManager); ls.Deserialize(strm); } // delete the saved layout file if it exists var layoutFileName = ApplicationPaths.AvalonDockLayoutFile; if (File.Exists(layoutFileName)) { File.Delete(layoutFileName); } }
private void InitDockingWindows() { dockingManager = new DockingManager(this, VisualStyle.IDE); dockingManager.InnerControl = firstControl; //Add message windows MessagesForm messageForm = new MessagesForm(); Content messageContent = dockingManager.Contents.Add(messageForm, "System Messages"); WindowContent messageWindowContent = dockingManager.AddContentWithState(messageContent, State.DockBottom) as WindowContent; //Set main windows Panel welcomePanel = new Panel(); tabControl = new Crownwood.Magic.Controls.TabControl(); tabControl.TabPages.Add(new Crownwood.Magic.Controls.TabPage("First", welcomePanel)); tabControl.TabPages.Add(new Crownwood.Magic.Controls.TabPage("Third", new MessagesForm())); tabControl.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiDocument; tabControl.Dock = DockStyle.Fill; tabControl.IDEPixelBorder = true; //tabControl. SuspendLayout(); Controls.Add(tabControl); //Set the region for docking. //RichTextBox filler = new RichTextBox(); //filler. Dock = DockStyle. Fill; StatusBar status = new StatusBar(); status.Dock = DockStyle.Bottom; dockingManager.OuterControl = status; }
/// <summary> /// レイアウトを読み込みます /// </summary> /// <param name="dockManager"></param> public void LoadLayout(DockingManager dockManager) { // backup default layout using (var ms = new MemoryStream()) { var serializer = new XmlLayoutSerializer(dockManager); serializer.Serialize(ms); m_defaultLayout = ms.ToArray(); } // load file Byte[] bytes; try { bytes = System.IO.File.ReadAllBytes(LayoutFile); } catch (FileNotFoundException ex) { return; } // restore layout LoadLayoutFromBytes(dockManager, bytes); }
public MainWindowViewModel(DockingManager dm, WorkflowDesigner wf) { SaveCommand = new DelegateCommand((o) => { var of = new SaveFileDialog(); of.Filter = "Workflow File (*.wf;*.xaml)|*.wf;*.xaml"; if (of.ShowDialog().Value) { wf.Save(of.FileName); } }, (o) => true); LoadCommand = new DelegateCommand((o) => { var of = new OpenFileDialog(); of.Filter = "Workflow File (*.wf;*.xaml)|*.wf;*.xaml"; if (of.ShowDialog().Value) { wf.Load(of.FileName); } }, (o) => true); }
/// <summary> /// Get the active window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnGetActiveWindowProperties(object sender, RoutedEventArgs e) { if (DockingManager.ActiveWindow != null) { MenuItem item = sender as MenuItem; FrameworkElement element = DockingManager.ActiveWindow; DockState state = DockingManager.GetState(element); foreach (Control control in item.Items) { if (control is MenuItem) { MenuItem subitem = control as MenuItem; string header = (string)subitem.Header; if (!subitem.HasItems) { subitem.IsChecked = GetDockOption(header, element); subitem.IsEnabled = GetStateLock(header, element); } } } } }
private static void OnFrameworkElement_Saved(object sender, RoutedEventArgs e) { DockingManager frameworkElement = sender as DockingManager; if (frameworkElement == null) { return; } ICommand SaveLayoutCommand = AvalonDockLayoutSerializer.GetSaveLayoutCommand(frameworkElement); // There may not be a command bound to this after all if (SaveLayoutCommand == null) { return; } string xmlLayoutString = ""; using (StringWriter fs = new StringWriter()) { var serializer = new XmlLayoutSerializer(frameworkElement); serializer.Serialize(fs); xmlLayoutString = fs.ToString(); } if (SaveLayoutCommand is RoutedCommand) { (SaveLayoutCommand as RoutedCommand).Execute(xmlLayoutString, frameworkElement); } else { SaveLayoutCommand.Execute(xmlLayoutString); } }
private void DockingManagerWindowActivatedEventHandler(DockingManager dm, Window wd) { var content = ((WindowContent) wd).CurrentContent; // seems that content may sometimes be null - not sure why // in this case, just ignore the event if (content != null) { var shelfView = (ShelfView)content.Tag; // when activated, report both visible and active status shelfView.SetVisibleStatus(true); shelfView.SetActiveStatus(true); } }
public static void LayoutFromString(this DockingManager dockManager, string layoutXml) { StringReader sr = new StringReader(layoutXml); dockManager.RestoreLayout(sr); }
/// <summary> /// Add the anchorable to a DockingManager layout /// </summary> /// <param name="manager"></param> /// <param name="strategy"></param> public void AddToLayout(DockingManager manager, AnchorableShowStrategy strategy) { if (IsVisible || IsHidden) { throw new InvalidOperationException(); } bool most = (strategy & AnchorableShowStrategy.Most) == AnchorableShowStrategy.Most; bool left = (strategy & AnchorableShowStrategy.Left) == AnchorableShowStrategy.Left; bool right = (strategy & AnchorableShowStrategy.Right) == AnchorableShowStrategy.Right; bool top = (strategy & AnchorableShowStrategy.Top) == AnchorableShowStrategy.Top; bool bottom = (strategy & AnchorableShowStrategy.Bottom) == AnchorableShowStrategy.Bottom; if (!most) { var side = AnchorSide.Left; if (left) { side = AnchorSide.Left; } if (right) { side = AnchorSide.Right; } if (top) { side = AnchorSide.Top; } if (bottom) { side = AnchorSide.Bottom; } var anchorablePane = manager.Layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault(p => p.GetSide() == side); if (anchorablePane != null) { anchorablePane.Children.Add(this); } else { most = true; } } if (most) { if (manager.Layout.RootPanel == null) { manager.Layout.RootPanel = new LayoutPanel() { Orientation = (left || right ? Orientation.Horizontal : Orientation.Vertical) } } ; if (left || right) { if (manager.Layout.RootPanel.Orientation == Orientation.Vertical && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Horizontal; if (left) { manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); } else { manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); } } else { if (manager.Layout.RootPanel.Orientation == Orientation.Horizontal && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Vertical; if (top) { manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); } else { manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); } } } }
private void OnAutoHiddenGroupStoringPage(object sender, UniqueNameEventArgs e) { // We only allow a single 'store' page in this docking location at a time DockingManager.PropogateAction(DockingPropogateAction.ClearAutoHiddenStoredPages, new string[] { e.UniqueName }); }
/// <summary> /// Get the state lock /// </summary> /// <param name="optionName"></param> /// <param name="element"></param> private bool GetStateLock(string optionName, FrameworkElement element) { bool result = true; DockState state = DockingManager.GetState(element); switch (optionName) { // Get the Dock state case "CanDock": result = state != DockState.Dock; break; // Get the Float state case "CanFloat": result = state != DockState.Float; break; // Get the Hidden state case "CanClose": result = state != DockState.Hidden; break; // Get the AutoHidden state case "CanAutoHide": result = state != DockState.AutoHidden; break; // Get the Document state case "CanDocument": result = state != DockState.Document; break; // Get the hidden state case "CanDrag": result = state != DockState.Hidden; break; //Get the dockstate state case "CanDragAutoHidden": result = state != DockState.Document? state != DockState.Float:false; break; // Get the Dock state case "Dock": result = DockingManager.GetCanDock(element); break; // Get the state lock as Dock case "Float": result = DockingManager.GetCanFloat(element); break; // Get the Document state case "Document": result = DockingManager.GetCanDocument(element); break; // Get the Autohidden state case "Autohidden": result = DockingManager.GetCanAutoHide(element); break; // Get the Hidden state case "Hidden": result = DockingManager.GetCanClose(element); break; } return(result); }
/// <summary> /// Add the anchorable to a DockingManager layout /// </summary> /// <param name="manager"></param> /// <param name="strategy"></param> public void AddToLayout(DockingManager manager, AnchorableShowStrategy strategy) { if (IsVisible || IsHidden) throw new InvalidOperationException(); bool most = (strategy & AnchorableShowStrategy.Most) == AnchorableShowStrategy.Most; bool left = (strategy & AnchorableShowStrategy.Left) == AnchorableShowStrategy.Left; bool right = (strategy & AnchorableShowStrategy.Right) == AnchorableShowStrategy.Right; bool top = (strategy & AnchorableShowStrategy.Top) == AnchorableShowStrategy.Top; bool bottom = (strategy & AnchorableShowStrategy.Bottom) == AnchorableShowStrategy.Bottom; if (!most) { var side = AnchorSide.Left; if (left) side = AnchorSide.Left; if (right) side = AnchorSide.Right; if (top) side = AnchorSide.Top; if (bottom) side = AnchorSide.Bottom; var anchorablePane = manager.Layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(p => p.GetSide() == side); if (anchorablePane != null) anchorablePane.Children.Add(this); else most = true; } if (most) { if (manager.Layout.RootPanel == null) manager.Layout.RootPanel = new LayoutPanel() { Orientation = (left || right ? Orientation.Horizontal : Orientation.Vertical) }; if (left || right) { if (manager.Layout.RootPanel.Orientation == Orientation.Vertical && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Horizontal; if (left) manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); else manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); } else { if (manager.Layout.RootPanel.Orientation == Orientation.Horizontal && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Vertical; if (top) manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); else manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); } } }
public XmlLayoutSerializer(DockingManager manager) : base(manager) { }
internal void Hide() { if (_model == null) return; _model.PropertyChanged -= _model_PropertyChanged; RemoveInternalGrid(); _anchor = null; _model = null; _manager = null; Visibility = Visibility.Hidden; Trace.WriteLine("LayoutAutoHideWindowControl.Hide()"); }
internal void Show(LayoutAnchorControl anchor) { if (_model != null) throw new InvalidOperationException(); _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); Visibility = System.Windows.Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Debug.WriteLine("LayoutAutoHideWindowControl.Show()"); }
internal void Hide() { if (_model == null) return; _model.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); RemoveInternalGrid(); _anchor = null; _model = null; _manager = null; Visibility = System.Windows.Visibility.Hidden; Debug.WriteLine("LayoutAutoHideWindowControl.Hide()"); }
protected override HandleRef BuildWindowCore(HandleRef hwndParent) { _wpfContentHost = new HwndSource(new HwndSourceParameters() { ParentWindow = hwndParent.Handle, WindowStyle = Win32Helper.WsChild | Win32Helper.WsVisible | Win32Helper.WsClipsiblings | Win32Helper.WsClipchildren, Width = 1, Height = 1 }); _rootPresenter = new Border() {Child = new AdornerDecorator() {Child = Content}, Focusable = true}; _rootPresenter.SetBinding(Border.BackgroundProperty, new Binding("Background") {Source = _owner}); _wpfContentHost.RootVisual = _rootPresenter; _wpfContentHost.SizeToContent = SizeToContent.Manual; _manager = _owner.Model.Root.Manager; _manager.InternalAddLogicalChild(_rootPresenter); return new HandleRef(this, _wpfContentHost.Handle); }
public PaneDisplay(DockingManager dock) { InitPanes(dock); }
internal void method_0(SandDockManager manager, DockContainer container, LayoutSystemBase layoutSystem, DockControl control, int int_2, Point point_0, DockingHints dockingHints, DockingManager dockingManager_0) { if (dockingManager_0 == DockingManager.Whidbey && AbstractManager.smethod_0()) { class7_0 = new Class8(manager, DockContainer, this, control, int_2, point_0, dockingHints); } else { class7_0 = new Class7(manager, DockContainer, this, control, int_2, point_0, dockingHints); } class7_0.DockingManagerFinished += OnDockingManagerFinished; class7_0.Cancalled += OnCancalled; class7_0.OnMouseMove(Cursor.Position); }
/// <summary> /// Reset the state /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnResetState(object sender, RoutedEventArgs e) { DockingManager.ResetState(); }
protected override void OnInitialized(EventArgs e) { CreateInternalGrid(); SetupCloseTimer(); _manager = _model.Root.Manager; _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); base.OnInitialized(e); }
/// <summary> /// Set the active window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnActivateWindow(object sender, RoutedEventArgs e) { string name = (sender as MenuItem).Tag as string; DockingManager.ActivateWindow(name); }
internal AutoHideWindowManager(DockingManager manager) { _manager = manager; SetupCloseTimer(); }
public AnimatContent(DockingManager manager) : base(manager) { }
public AnimatContent(DockingManager manager, Control control) : base(manager, control) { }
/// <summary> /// Get the dock option /// </summary> /// <param name="optionName"></param> /// <param name="element"></param> private bool GetDockOption(string optionName, FrameworkElement element) { bool result = true; DockState state = DockingManager.GetState(element); switch (optionName) { // Get the dock option as CanDock case "CanDock": result = DockingManager.GetCanDock(element); break; // Get the dock option as CanFloat case "CanFloat": result = DockingManager.GetCanFloat(element); break; // Get the dock option as CanClose case "CanClose": result = DockingManager.GetCanClose(element); break; // Get the dock option as CanAutoHide case "CanAutoHide": result = DockingManager.GetCanAutoHide(element); break; //Get the dock option as CanDragAutoHidden case "CanDragAutoHidden": result = DockingManager.GetCanDragAutoHidden(element); break; // Get the dock option as CanDocument case "CanDocument": result = DockingManager.GetCanDocument(element); break; // Get the dock option as CanDrag case "CanDrag": result = DockingManager.GetCanDrag(element); break; // Get the dock option as NoHeader case "NoHeader": result = DockingManager.GetNoHeader(element); break; //Get the dock option as AllowSnap case "AllowSnap": result = DockingManager.GetAllowSnap(element); break; // Get the dock option as Dock case "Dock": result = state == DockState.Dock; break; // Get the dock option as Float case "Float": result = state == DockState.Float; break; // Get the dock option as Document case "Document": result = state == DockState.Document; break; // Get the dock option as AutoHidden case "AutoHidden": result = state == DockState.AutoHidden; break; // Get the dock option as Hidden case "Hidden": result = state == DockState.Hidden; break; } return(result); }
public AnimatContent(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex) : base(manager, control, title, imageList, imageIndex) { }
void Awake() { if (s_instance == null) { s_instance = this; } else { Destroy(gameObject); } }
public AnimatContent(DockingManager manager, Control control, string title, Icon icon) : base(manager, control, title, icon) { }
public override bool ApplyChange(Point screenPos, Redocker parent) { // Should always be the appropriate type RedockerContent redock = parent as RedockerContent; DockingManager dockingManager = redock.DockingManager; Zone newZone = null; // Manageing Zones should remove display AutoHide windows dockingManager.RemoveShowingAutoHideWindows(); switch (redock.DockingSource) { case RedockerContent.Source.RawContent: { // Perform State specific Restore actions redock.Content.ContentBecomesFloating(); // Create a new Window to host Content Window w = dockingManager.CreateWindowForContent(redock.Content); // We need to create a Zone for containing the transfered content newZone = dockingManager.CreateZoneForContent(State.Floating); // Add into Zone newZone.Windows.Add(w); } break; case RedockerContent.Source.WindowContent: // Perform State specific Restore actions foreach (Content c in redock.WindowContent.Contents) { c.ContentBecomesFloating(); } // Remove WindowContent from old Zone if (redock.WindowContent.ParentZone != null) { redock.WindowContent.ParentZone.Windows.Remove(redock.WindowContent); } // We need to create a Zone for containing the transfered content newZone = dockingManager.CreateZoneForContent(State.Floating); // Add into new Zone newZone.Windows.Add(redock.WindowContent); break; case RedockerContent.Source.ContentInsideWindow: { // Perform State specific Restore actions redock.Content.ContentBecomesFloating(); // Remove Content from existing WindowContent if (redock.Content.ParentWindowContent != null) { redock.Content.ParentWindowContent.Contents.Remove(redock.Content); } // Create a new Window to host Content Window w = dockingManager.CreateWindowForContent(redock.Content); // We need to create a Zone for containing the transfered content newZone = dockingManager.CreateZoneForContent(State.Floating); // Add into Zone newZone.Windows.Add(w); } break; case RedockerContent.Source.FloatingForm: redock.FloatingForm.Location = new Point(screenPos.X - _offset.X, screenPos.Y - _offset.Y); return(false); } dockingManager.UpdateInsideFill(); // Create a new floating form FloatingForm floating = new FloatingForm(redock.DockingManager, newZone, new ContextHandler(dockingManager.OnShowContextMenu)); // Find screen location/size _drawRect = new Rectangle(screenPos.X, screenPos.Y, _newSize.Width, _newSize.Height); // Adjust for mouse starting position relative to source control _drawRect.X -= _offset.X; _drawRect.Y -= _offset.Y; // Define its location/size floating.Location = new Point(_drawRect.Left, _drawRect.Top); floating.Size = new Size(_drawRect.Width, _drawRect.Height); // Show it! floating.Show(); return(true); }
public XmlLayoutSerializer(DockingManager manager) : base(manager) { _serializer = new XmlSerializer(typeof(LayoutRoot)); }
private void AvalonDockView_Loaded(object sender, RoutedEventArgs e) { _PART_DockView = Template.FindName("PART_DockView", this) as DockingManager; }
private void FormDockingManagerWindowDeactivatedEventHandler(DockingManager dm, Window wd) { var content = ((WindowContent) wd).CurrentContent; // seems that content may sometimes be null - not sure why // in this case, just ignore the event if (content != null) { var shelfView = (ShelfView)content.Tag; shelfView.SetActiveStatus(false); } }