Ejemplo n.º 1
0
        /// <summary>
        ///     Execute handler for the MdiCommands.RestoreWindow command.
        /// </summary>
        private void ExecuteRestoreWindow(ExecutedRoutedEventArgs e)
        {
            MdiWindow window = Content as MdiWindow;

            Debug.Assert(window != null && MdiPanel.GetWindowState(window) != WindowState.Normal);

            RestoreWindow(window);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Execute handler for the MdiCommands.MinimizeWindow command.
        /// </summary>
        private void ExecuteMinimizeWindow(ExecutedRoutedEventArgs e)
        {
            MdiWindow window = Content as MdiWindow;

            Debug.Assert(window != null && MdiPanel.GetWindowState(window) != WindowState.Minimized);

            MinimizeWindow(window);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Execute handler for the MdiCommands.AdjustWindowRect command.
        /// </summary>
        private void ExecuteAdjustWindowRect(ExecutedRoutedEventArgs e)
        {
            UIElement originalSource      = (UIElement)e.OriginalSource;
            AdjustWindowRectParameter swp = (AdjustWindowRectParameter)e.Parameter;

            MdiWindow window = Content as MdiWindow;

            Debug.Assert(window != null && MdiPanel.GetWindowState(window) == WindowState.Normal);

            Vector delta = originalSource.TransformElementToElement(swp.Delta, window);

            AdjustWindowRect(window, delta, swp.InteractiveEdges);
        }
Ejemplo n.º 4
0
        // Bring to the front of the windows in the specified state.
        public void BringToFront(MdiWindow window, WindowState windowState)
        {
            int oldIndex = IndexOf(window);
            int newIndex = Count - 1;

            if (windowState == WindowState.Minimized)
            {
                bool foundSelf = false;

                for (newIndex = 0; newIndex < (Count - 1); newIndex++)
                {
                    if (Items[newIndex] == window)
                    {
                        foundSelf = true;
                    }

                    if (MdiPanel.GetWindowState(Items[newIndex]) != WindowState.Minimized)
                    {
                        break;
                    }
                }

                if (foundSelf)
                {
                    newIndex--;
                }
            }

            Move(oldIndex, newIndex);

            // HACK: how to coordinate Win32 ZOrder with WPF ZOrder?  This works, but assumes to many implementation details.
            if (VisualTreeHelper.GetChildrenCount(window) > 0)
            {
                AirspaceDecorator hwndClipper = VisualTreeHelper.GetChild(window, 0) as AirspaceDecorator;
                if (hwndClipper != null)
                {
                    if (VisualTreeHelper.GetChildrenCount(hwndClipper) > 0)
                    {
                        HwndSourceHost hwndSourceHost = VisualTreeHelper.GetChild(hwndClipper, 0) as HwndSourceHost;
                        if (hwndSourceHost != null)
                        {
                            HWND hwnd = new HWND(hwndSourceHost.Handle);
                            NativeMethods.SetWindowPos(hwnd, HWND.TOP, 0, 0, 0, 0, SWP.NOMOVE | SWP.NOSIZE);
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     CanExecute handler for the MdiCommands.RestoreWindow command.
        /// </summary>
        private void CanExecuteRestoreWindow(CanExecuteRoutedEventArgs e)
        {
            MdiWindow window = Content as MdiWindow;

            e.CanExecute = (window != null && MdiPanel.GetWindowState(window) != WindowState.Normal);
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     CanExecute handler for the MdiCommands.MinimizeWindow command.
        /// </summary>
        private void CanExecuteMinimizeWindow(CanExecuteRoutedEventArgs e)
        {
            MdiWindow window = Content as MdiWindow;

            e.CanExecute = (window != null && MdiPanel.GetWindowState(window) != WindowState.Minimized);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     CanExecute handler for the MdiCommands.AdjustWindowRect command.
        /// </summary>
        private void CanExecuteAdjustWindowRect(CanExecuteRoutedEventArgs e)
        {
            MdiWindow window = Content as MdiWindow;

            e.CanExecute = (window != null && MdiPanel.GetWindowState(window) == WindowState.Normal);
        }