/// <summary>
        /// Create overlay window
        /// </summary>
        /// <param name="owner">Dock manager</param>
        public OverlayWindow(DockManager owner)
        {
            InitializeComponent();

            _owner = owner;

            _owner.DragPaneServices.Register(new OverlayWindowDockingButton(btnDockBottom, this));
            _owner.DragPaneServices.Register(new OverlayWindowDockingButton(btnDockTop, this));
            _owner.DragPaneServices.Register(new OverlayWindowDockingButton(btnDockLeft, this));
            _owner.DragPaneServices.Register(new OverlayWindowDockingButton(btnDockRight, this));

            _owdBottom = new OverlayWindowDockingButton(btnDockPaneBottom, this, false);
            _owdTop    = new OverlayWindowDockingButton(btnDockPaneTop, this, false);
            _owdLeft   = new OverlayWindowDockingButton(btnDockPaneLeft, this, false);
            _owdRight  = new OverlayWindowDockingButton(btnDockPaneRight, this, false);

            _owner.DragPaneServices.Register(_owdBottom);
            _owner.DragPaneServices.Register(_owdTop);
            _owner.DragPaneServices.Register(_owdLeft);
            _owner.DragPaneServices.Register(_owdRight);
        }
Exemple #2
0
        /// <summary>
        /// Deserialize layout.
        /// </summary>
        /// <param name="manager">Dock manager for initing objects.</param>
        /// <param name="rootNode">Node to parse.</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents.</param>
        public void Deserialize(DockManager manager,
                                XmlNode rootNode,
                                GetContentFromTypeString handlerObject)
        {
            if (null != _root)
            {
                Debug.Assert(_root.Type == CompositionType.Terminal);
                _root.AttachedPane.Close();
                _root = null;
            }

            if (0 == rootNode.ChildNodes.Count)
            {
                _root = null;
            }
            else
            {
                _root = new Composition();
                _root.Deserialize(manager, rootNode.ChildNodes[0], handlerObject);
                _ArrangeLayout();
            }
        }
        /// <summary>
        /// Deserialize layout.
        /// </summary>
        /// <param name="manager">Dock manager for initing objects.</param>
        /// <param name="rootNode">Node to parse.</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents.</param>
        public void Deserialize(DockManager manager,
                                XmlNode rootNode,
                                GetContentFromTypeString handlerObject)
        {
            if (null != _root)
            {
                Debug.Assert(_root.Type == CompositionType.Terminal);
                _root.AttachedPane.Close();
                _root = null;
            }

            if (0 == rootNode.ChildNodes.Count)
                _root = null;
            else
            {
                _root = new Composition();
                _root.Deserialize(manager, rootNode.ChildNodes[0], handlerObject);
                _ArrangeLayout();
            }
        }
        /// <summary>
        /// Deserialize layout
        /// </summary>
        /// <param name="manager">Dock manager for initing objects</param>
        /// <param name="node">Node to parse</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents</param>
        public void Deserialize(DockManager manager, XmlNode node, GetContentFromTypeString handlerObject)
        {
            _size = (Size)TypeDescriptor.GetConverter(typeof(Size)).ConvertFromInvariantString(node.Attributes[ATTRIBUTE_NAME_SIZE].Value);

            _dockType = (Dock)Enum.Parse(typeof(Dock), node.Attributes[ATTRIBUTE_NAME_DOCK].Value);

            PaneState state = (PaneState)Enum.Parse(typeof(PaneState), node.Attributes[ATTRIBUTE_NAME_STATE].Value);
            State = (PaneState.FloatingWindow == state) ? PaneState.DockableWindow : state;
                // NOTE: for support old versions

            _ptFloatingWindow = (Point)System.ComponentModel.TypeDescriptor.GetConverter(typeof(Point)).ConvertFromInvariantString(node.Attributes[ATTRIBUTE_NAME_PTFLOATWND].Value);
            _szFloatingWindow = (Size)System.ComponentModel.TypeDescriptor.GetConverter(typeof(Size)).ConvertFromInvariantString(node.Attributes[ATTRIBUTE_NAME_SZFLOATWND].Value);

            DockableContent content = handlerObject(node.ChildNodes[0].Name);

            // set state
            content.DockManager = manager;
            _SetContent(content);

            if ((PaneState.Docked == State) || (PaneState.Hidden == State))
                Show();
            else
            {
                tbTitle.Text = _content.Title;
                cpClientWindowContent.Content = _content.Content;
                cpClientWindowContent.Visibility = Visibility.Visible;

                _CreateFloatingWindow(_state);
                _InitFloatingWindowPosition();
            }
        }
        /// <summary>
        /// Deserialize layout
        /// </summary>
        /// <param name="manager">Dock manager for initing objects</param>
        /// <param name="node">Node to parse</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents</param>
        public void Deserialize(DockManager manager, XmlNode node, GetContentFromTypeString handlerObject)
        {
            _type = (CompositionType)Enum.Parse(typeof(CompositionType), node.Attributes[ATTRIBUTE_NAME_TYPE].Value);
            _spaceFactor = double.Parse(node.Attributes[ATTRIBUTE_NAME_SFACTOR].Value, CultureInfo.GetCultureInfo(STORAGE_CULTURE));

            if (_type == CompositionType.Terminal)
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_DOCKPANE);

                DockablePane pane = new DockablePane();
                pane.Deserialize(manager, node.ChildNodes[0], handlerObject);
                _attachedPane = pane;

                if (pane.IsDragSupported)
                    manager.DragPaneServices.Register(pane);
            }
            else
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_CHILDGROUPS);

                foreach (XmlNode nodeChild in node.ChildNodes[0].ChildNodes)
                {
                    Composition composition = new Composition();
                    composition.Deserialize(manager, nodeChild, handlerObject);
                    _children.Add(composition);
                }
            }

            _isInited = true;
        }