internal AnchorablePaneControlOverlayArea(
			IOverlayWindow overlayWindow,
			LayoutAnchorablePaneControl anchorablePaneControl)
            : base(overlayWindow)
        {
            var anchorablePaneControl1 = anchorablePaneControl;
            SetScreenDetectionArea(new Rect(
                anchorablePaneControl1.PointToScreenDpi(new Point()),
                anchorablePaneControl1.TransformActualSizeToAncestor()));
        }
Example #2
0
        internal AnchorablePaneControlOverlayArea(
            IOverlayWindow overlayWindow,
            LayoutAnchorablePaneControl anchorablePaneControl)
            : base(overlayWindow)
        {
            var anchorablePaneControl1 = anchorablePaneControl;

            SetScreenDetectionArea(new Rect(
                                       anchorablePaneControl1.PointToScreenDpi(new Point()),
                                       anchorablePaneControl1.TransformActualSizeToAncestor()));
        }
        // ReSharper disable once InconsistentNaming
        internal UIElement CreateUIElementForModel(ILayoutElement model)
        {
            var panel = model as LayoutPanel;
            if (panel != null)
                return new LayoutPanelControl(panel);
            var @group = model as LayoutAnchorablePaneGroup;
            if (@group != null)
                return new LayoutAnchorablePaneGroupControl(@group);
            var paneGroup = model as LayoutDocumentPaneGroup;
            if (paneGroup != null)
                return new LayoutDocumentPaneGroupControl(paneGroup);

            var side = model as LayoutAnchorSide;
            if (side != null)
            {
                var templateModelView = new LayoutAnchorSideControl(side);
                templateModelView.SetBinding(TemplateProperty, new Binding("AnchorSideTemplate") { Source = this });
                return templateModelView;
            }
            var anchorGroup = model as LayoutAnchorGroup;
            if (anchorGroup != null)
            {
                var templateModelView = new LayoutAnchorGroupControl(anchorGroup);
                templateModelView.SetBinding(TemplateProperty, new Binding("AnchorGroupTemplate") { Source = this });
                return templateModelView;
            }

            var documentPane = model as LayoutDocumentPane;
            if (documentPane != null)
            {
                var templateModelView = new LayoutDocumentPaneControl(documentPane);
                templateModelView.SetBinding(StyleProperty, new Binding("DocumentPaneControlStyle") { Source = this });
                return templateModelView;
            }
            var pane = model as LayoutAnchorablePane;
            if (pane != null)
            {
                var templateModelView = new LayoutAnchorablePaneControl(pane);
                templateModelView.SetBinding(StyleProperty, new Binding("AnchorablePaneControlStyle") { Source = this });
                return templateModelView;
            }

            var fw = model as LayoutAnchorableFloatingWindow;
            if (fw != null)
            {
                if (DesignerProperties.GetIsInDesignMode(this))
                    return null;
                var modelFw = fw;
                var newFw = new LayoutAnchorableFloatingWindowControl(modelFw);
                newFw.SetParentToMainWindowOf(this);

                var paneForExtensions = modelFw.RootPanel.Children.OfType<LayoutAnchorablePane>().FirstOrDefault();
                if (paneForExtensions != null)
                {
                    //ensure that floating window position is inside current (or nearest) monitor
                    paneForExtensions.KeepInsideNearestMonitor();

                    newFw.Left = paneForExtensions.FloatingLeft;
                    newFw.Top = paneForExtensions.FloatingTop;
                    newFw.Width = paneForExtensions.FloatingWidth;
                    newFw.Height = paneForExtensions.FloatingHeight;
                }

                newFw.ShowInTaskbar = false;
                newFw.Show();
                // Do not set the WindowState before showing or it will be lost
                if (paneForExtensions != null && paneForExtensions.IsMaximized)
                {
                    newFw.WindowState = WindowState.Maximized;
                }
                return newFw;
            }

            var window = model as LayoutDocumentFloatingWindow;
            if (window != null)
            {
                if (DesignerProperties.GetIsInDesignMode(this))
                    return null;
                var modelFw = window;
                var newFw = new LayoutDocumentFloatingWindowControl(modelFw);
                newFw.SetParentToMainWindowOf(this);

                var paneForExtensions = modelFw.RootDocument;
                if (paneForExtensions != null)
                {
                    //ensure that floating window position is inside current (or nearest) monitor
                    paneForExtensions.KeepInsideNearestMonitor();

                    newFw.Left = paneForExtensions.FloatingLeft;
                    newFw.Top = paneForExtensions.FloatingTop;
                    newFw.Width = paneForExtensions.FloatingWidth;
                    newFw.Height = paneForExtensions.FloatingHeight;
                }

                newFw.ShowInTaskbar = true;
                newFw.Show();
                // Do not set the WindowState before showing or it will be lost
                if (paneForExtensions != null && paneForExtensions.IsMaximized)
                {
                    newFw.WindowState = WindowState.Maximized;
                }
                return newFw;
            }

            var document = model as LayoutDocument;
            if (document != null)
            {
                var templateModelView = new LayoutDocumentControl { Model = document };
                return templateModelView;
            }

            return null;
        }