Esempio n. 1
0
        public static void Register(Form form, AppBarEdge edge, Screen screen)
        {
            Rectangle screenArea = screen.WorkingArea;

            if (edge == AppBarEdge.Top || edge == AppBarEdge.Bottom)
            {
                form.Left  = screenArea.Left;
                form.Width = screenArea.Width;
                form.Top   = edge == AppBarEdge.Top ? screenArea.Top : screenArea.Bottom - form.Height;
            }
            else
            {
                form.Left   = edge == AppBarEdge.Left ? screenArea.Left : screenArea.Right - form.Width;
                form.Height = screenArea.Height;
                form.Top    = screenArea.Top;
            }
            form.FormBorderStyle = FormBorderStyle.None;
            uint callbackId = RegisterWindowMessage(form.GetHashCode().ToString("x"));

            APPBARDATA appData = new APPBARDATA();

            appData.cbSize           = (uint)Marshal.SizeOf(appData);
            appData.uCallbackMessage = callbackId;
            appData.hWnd             = form.Handle;

            uint ret = SHAppBarMessage(AppBarMessage.New, ref appData);

            if (ret != 0)
            {
                _appBars.Add(form);
                form.FormClosing += (s, e) => Unregister(form);
                AppBarPosition(form, edge, AppBarMessage.QueryPos);
                AppBarPosition(form, edge, AppBarMessage.SetPos);
            }
        }
Esempio n. 2
0
        public Taskbar(ICairoApplication cairoApplication,
                       ShellManager shellManager,
                       IWindowManager windowManager,
                       IDesktopManager desktopManager,
                       IAppGrabber appGrabber,
                       AppBarScreen screen,
                       AppBarEdge edge)
            : base(cairoApplication, shellManager, windowManager, screen, edge, 0)
        {
            object taskBarWindowAllowsTransparencyResource = CairoApplication.Current.Resources["TaskBarWindowAllowsTransparency"];

            if (taskBarWindowAllowsTransparencyResource is bool resourceValue)
            {
                AllowsTransparency = resourceValue;
            }

            InitializeComponent();
            _appGrabber     = appGrabber;
            _desktopManager = desktopManager;
            _shellManager   = shellManager;

            if (!Screen.Primary && !Settings.Instance.EnableMenuBarMultiMon)
            {
                ProcessScreenChanges = true;
            }
            else
            {
                ProcessScreenChanges = false;
            }

            setupTaskbar();
            setupTaskbarAppearance();
        }
Esempio n. 3
0
        public double GetAppBarEdgeWindowsHeight(AppBarEdge edge, AppBarScreen screen)
        {
            double edgeHeight   = 0;
            double dpiScale     = 1;
            Rect   workAreaRect = GetWorkArea(ref dpiScale, screen, true, true);

            switch (edge)
            {
            case AppBarEdge.Top:
                edgeHeight += (workAreaRect.Top - screen.Bounds.Top) / dpiScale;
                break;

            case AppBarEdge.Bottom:
                edgeHeight += (screen.Bounds.Bottom - workAreaRect.Bottom) / dpiScale;
                break;

            case AppBarEdge.Left:
                edgeHeight += (workAreaRect.Left - screen.Bounds.Left) / dpiScale;
                break;

            case AppBarEdge.Right:
                edgeHeight += (screen.Bounds.Right - workAreaRect.Right) / dpiScale;
                break;
            }

            return(edgeHeight);
        }
Esempio n. 4
0
        public static void Register(Form form, AppBarEdge edge, Screen screen)
        {
            Rectangle screenArea = screen.WorkingArea;
            if (edge == AppBarEdge.Top || edge == AppBarEdge.Bottom)
            {
                form.Left = screenArea.Left;
                form.Width = screenArea.Width;
                form.Top = edge == AppBarEdge.Top ? screenArea.Top : screenArea.Bottom - form.Height;
            }
            else
            {
                form.Left = edge == AppBarEdge.Left ? screenArea.Left : screenArea.Right - form.Width;
                form.Height = screenArea.Height;
                form.Top = screenArea.Top;
            }
            form.FormBorderStyle = FormBorderStyle.None;
            uint callbackId = RegisterWindowMessage(form.GetHashCode().ToString("x"));

            APPBARDATA appData = new APPBARDATA();
            appData.cbSize = (uint)Marshal.SizeOf(appData);
            appData.uCallbackMessage = callbackId;
            appData.hWnd = form.Handle;

            uint ret = SHAppBarMessage(AppBarMessage.New, ref appData);
            if (ret != 0)
            {
                _appBars.Add(form);
                form.FormClosing += (s, e) => Unregister(form);
                AppBarPosition(form, edge, AppBarMessage.QueryPos);
                AppBarPosition(form, edge, AppBarMessage.SetPos);
            }
        }
Esempio n. 5
0
        public void GetBounds(out AppBarEdge edge, out System.Windows.Rect bounds)
        {
            var barData = new APPBARDATA();
            int ret     = SHAppBarMessage(AppBarMessage.GetTaskBarPos, ref barData);

            edge   = barData.uEdge;
            bounds = barData.rc.ToRectangle();
        }
Esempio n. 6
0
        public static void GetTaskBarInfo(out AppBarEdge taskBarEdge, out Rectangle region)
        {
            APPBARDATA appData = new APPBARDATA();

            uint ret = SHAppBarMessage(AppBarMessage.GetTaskBarPos, ref appData);

            taskBarEdge = appData.uEdge;
            region      = appData.rc.ToRectangle();
        }
Esempio n. 7
0
        public static void GetTaskBarInfo(out AppBarEdge taskBarEdge, out Rectangle region)
        {
            APPBARDATA appData = new APPBARDATA();

            uint ret = SHAppBarMessage(AppBarMessage.GetTaskBarPos, ref appData);

            taskBarEdge = appData.uEdge;
            region = appData.rc.ToRectangle();
        }
Esempio n. 8
0
        public static void MoveAppBarWindow(IntPtr target, AppBarEdge dockingPosition)
        {
            AppBarPreference preference;

            if (!managedAppBars.TryGetValue(target, out preference))
            {
                return;
            }
            preference.DockingPosition = dockingPosition;
            commands.Enqueue(new RefreshAppBarCommand(target, false));
        }
Esempio n. 9
0
            /// <summary>
            /// 更新一个窗口的停靠方向。
            /// </summary>
            /// <param name="value">停靠方向。</param>
            public async void Update(AppBarEdge value)
            {
                var hwndSource = await _hwndSourceTask.Task;

                Edge = value;


                var bounds = TransformToAppBar(hwndSource.Handle, _window.RestoreBounds, value);

                ForceWindowProperties();
                Resize(_window, bounds);
            }
Esempio n. 10
0
        public int RegisterBar(AppBarWindow abWindow, double width, double height, AppBarEdge edge = AppBarEdge.Top)
        {
            lock (appBarLock)
            {
                APPBARDATA abd = new APPBARDATA();
                abd.cbSize = Marshal.SizeOf(typeof(APPBARDATA));
                abd.hWnd   = abWindow.Handle;

                if (!AppBars.Contains(abWindow))
                {
                    if (!EnvironmentHelper.IsAppRunningAsShell)
                    {
                        uCallBack            = RegisterWindowMessage("AppBarMessage");
                        abd.uCallbackMessage = uCallBack;

                        SHAppBarMessage((int)ABMsg.ABM_NEW, ref abd);
                    }

                    AppBars.Add(abWindow);

                    ShellLogger.Debug($"AppBarManager: Created AppBar for handle {abWindow.Handle}");

                    if (!EnvironmentHelper.IsAppRunningAsShell)
                    {
                        ABSetPos(abWindow, width, height, edge, true);
                    }
                    else
                    {
                        SetWorkArea(abWindow.Screen);
                    }
                }
                else
                {
                    if (!EnvironmentHelper.IsAppRunningAsShell)
                    {
                        SHAppBarMessage((int)ABMsg.ABM_REMOVE, ref abd);
                    }

                    AppBars.Remove(abWindow);
                    ShellLogger.Debug($"AppBarManager: Removed AppBar for handle {abWindow.Handle}");

                    if (EnvironmentHelper.IsAppRunningAsShell)
                    {
                        SetWorkArea(abWindow.Screen);
                    }

                    return(0);
                }
            }

            return(uCallBack);
        }
Esempio n. 11
0
        /// <summary>
        /// Called to set/unset a Form as an AppBar
        /// </summary>
        /// <param name="appBarForm">Form to set/unset as AppBar</param>
        /// <param name="edge">Edge to dock to (or None to undock)</param>
        /// <exception cref="System.Exception">Thrown when AppBarMessage is not set</exception>
        public static void SetAppBar(Form appBarForm, AppBarEdge edge)
        {
            if (string.IsNullOrEmpty(AppBarMessage))
            {
                throw new Exception("The AppBarMessage property must be set before calling SetAppBar()");
            }

            // Start of a new app bar movement
            ConfirmedInLocation = false;

            RegisterInfo info = GetRegisterInfo(appBarForm);

            APPBARDATA abd = new APPBARDATA();

            abd.cbSize = Marshal.SizeOf(abd);
            abd.hWnd   = appBarForm.Handle;

            do
            {
                // Restore to a non-app bar window state
                if (edge == AppBarEdge.None)
                {
                    if (info.IsRegistered)
                    {
                        SHAppBarMessage((int)AppBarMsg.ABM_REMOVE, ref abd);
                        info.IsRegistered = false;
                    }
                    RestoreWindow(appBarForm);
                    break;
                }

                // Register as a new app bar
                if (!info.IsRegistered)
                {
                    info.CallbackId      = RegisterWindowMessage(AppBarMessage);
                    abd.uCallbackMessage = info.CallbackId;

                    uint ret = SHAppBarMessage((int)AppBarMsg.ABM_NEW, ref abd);
                    Application.AddMessageFilter(info);

                    info.IsRegistered = true;
                }

                // Set the app bar position
                appBarForm.TopMost         = false;
                appBarForm.FormBorderStyle = FormBorderStyle.None;
                AppBarSetPosition(edge, appBarForm);
            } while (false);

            info.Edge = edge;
        }
Esempio n. 12
0
        private static StyleRenderer GetRenderer(AppBarEdge edge)
        {
            if (!StyleRenderer.IsSupported)
            {
                return(new ClassicStyleRenderer());
            }
            var renderMap = new Dictionary <AppBarEdge, VisualStyleElement>
            {
                { AppBarEdge.Bottom, VisualStyleElement.Taskbar.BackgroundBottom.Normal },
                { AppBarEdge.Top, VisualStyleElement.Taskbar.BackgroundTop.Normal },
                { AppBarEdge.Left, VisualStyleElement.Taskbar.BackgroundLeft.Normal },
                { AppBarEdge.Right, VisualStyleElement.Taskbar.BackgroundRight.Normal },
            };

            return(new ManagedStyleRenderer(renderMap[edge]));
        }
Esempio n. 13
0
        private static void AppBarPosition(Form form, AppBarEdge edge, AppBarMessage appBarMessage)
        {
            APPBARDATA appData = new APPBARDATA();

            appData.cbSize = (uint)Marshal.SizeOf(appData);
            appData.uEdge  = edge;
            appData.rc     = Win32.RECT.FromRectangle(form.Bounds);
            appData.hWnd   = form.Handle;

            SHAppBarMessage(appBarMessage, ref appData);
            //let the application handle some events first
            //if we dont do this (especially for SetPos)
            //the position will be off and the bar jumps around
            Application.DoEvents();
            form.Bounds = appData.rc.ToRectangle();
        }
Esempio n. 14
0
            /// <summary>
            /// 使一个窗口开始成为桌面停靠窗口,并开始处理窗口停靠消息。
            /// </summary>
            /// <param name="value">停靠方向。</param>
            public async void Attach(AppBarEdge value)
            {
                var hwndSource = await _hwndSourceTask.Task;

                BackupWindowProperties();

                var data = new User32.APPBARDATA();

                data.cbSize = Marshal.SizeOf(data);
                data.hWnd   = hwndSource.Handle;

                data.uCallbackMessage = _callbackId;
                User32.SHAppBarMessage((int)User32.ABMsg.ABM_NEW, ref data);
                hwndSource.AddHook(WndProc);

                Update(value);
            }
Esempio n. 15
0
            private Rect TransformToAppBar(IntPtr hWnd, Rect area, AppBarEdge edge)
            {
                var data = new User32.APPBARDATA();

                data.cbSize = Marshal.SizeOf(data);
                data.hWnd   = hWnd;
                data.uEdge  = (int)edge;

                if (data.uEdge == (int)AppBarEdge.Left || data.uEdge == (int)AppBarEdge.Right)
                {
                    data.rc.top    = 0;
                    data.rc.bottom = (int)SystemParameters.PrimaryScreenHeight;
                    if (data.uEdge == (int)AppBarEdge.Left)
                    {
                        data.rc.left  = 0;
                        data.rc.right = (int)Math.Round(area.Width);
                    }
                    else
                    {
                        data.rc.right = (int)SystemParameters.PrimaryScreenWidth;
                        data.rc.left  = data.rc.right - (int)Math.Round(area.Width);
                    }
                }
                else
                {
                    data.rc.left  = 0;
                    data.rc.right = (int)SystemParameters.PrimaryScreenWidth;
                    if (data.uEdge == (int)AppBarEdge.Top)
                    {
                        data.rc.top    = 0;
                        data.rc.bottom = (int)Math.Round(area.Height);
                    }
                    else
                    {
                        data.rc.bottom = (int)SystemParameters.PrimaryScreenHeight;
                        data.rc.top    = data.rc.bottom - (int)Math.Round(area.Height);
                    }
                }

                User32.SHAppBarMessage((int)User32.ABMsg.ABM_QUERYPOS, ref data);
                User32.SHAppBarMessage((int)User32.ABMsg.ABM_SETPOS, ref data);

                return(new Rect(data.rc.left, data.rc.top,
                                data.rc.right - data.rc.left, data.rc.bottom - data.rc.top));
            }
Esempio n. 16
0
        private static void AppBarPosition(Form form, AppBarEdge edge, AppBarMessage appBarMessage)
        {
            APPBARDATA appData = new APPBARDATA();
            appData.cbSize = (uint)Marshal.SizeOf(appData);
            appData.uEdge = edge;
            appData.rc = Win32.RECT.FromRectangle(form.Bounds);
            appData.hWnd = form.Handle;

            SHAppBarMessage(appBarMessage, ref appData);
            //let the application handle some events first
            //if we dont do this (especially for SetPos)
            //the position will be off and the bar jumps around
            Application.DoEvents();
            form.Bounds = appData.rc.ToRectangle();
        }
Esempio n. 17
0
        //private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings

        public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23)
        {
            _appGrabber = appGrabber;
            _applicationUpdateService = applicationUpdateService;
            _settingsUiService        = settingsUiService;

            object menuBarWindowAllowsTransparencyResource = CairoApplication.Current.Resources["MenuBarWindowAllowsTransparency"];

            if (menuBarWindowAllowsTransparencyResource is bool resourceValue)
            {
                AllowsTransparency = resourceValue;
            }

            InitializeComponent();

            RequiresScreenEdge = true;

            SetPosition();

            setupChildren();

            setupMenu();

            setupCairoMenu();

            setupPlacesMenu();

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;
        }
Esempio n. 18
0
        public Taskbar(ShellManager shellManager, CloakMonitor cloakMonitor, AppBarScreen screen, AppBarEdge edge)
            : base(shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, 0)
        {
            _cloakMonitor = cloakMonitor;
            _shellManager = shellManager;

            InitializeComponent();
            DataContext        = _shellManager;
            DesiredHeight      = Application.Current.FindResource("TaskbarHeight") as double? ?? 0;
            AllowsTransparency = Application.Current.FindResource("AllowsTransparency") as bool? ?? false;
            SetFontSmoothing();
            SetupQuickLaunch();

            _explorerHelper.HideExplorerTaskbar = true;

            _cloakMonitor.PropertyChanged     += CloakMonitor_PropertyChanged;
            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            // Layout rounding causes incorrect sizing on non-integer scales
            if (DpiHelper.DpiScale % 1 != 0)
            {
                UseLayoutRounding = false;
            }
        }
Esempio n. 19
0
 public static void SetAppBar(Window window, AppBarEdge value) => window.SetValue(AppBarProperty, value);
Esempio n. 20
0
        public void ABSetPos(AppBarWindow abWindow, double width, double height, AppBarEdge edge, bool isCreate = false)
        {
            lock (appBarLock)
            {
                APPBARDATA abd = new APPBARDATA
                {
                    cbSize = Marshal.SizeOf(typeof(APPBARDATA)),
                    hWnd   = abWindow.Handle,
                    uEdge  = (int)edge
                };

                int sWidth  = (int)width;
                int sHeight = (int)height;

                int top    = 0;
                int left   = 0;
                int right  = ScreenHelper.PrimaryMonitorDeviceSize.Width;
                int bottom = ScreenHelper.PrimaryMonitorDeviceSize.Height;

                int edgeOffset = 0;

                if (abWindow.Screen != null)
                {
                    top    = abWindow.Screen.Bounds.Y;
                    left   = abWindow.Screen.Bounds.X;
                    right  = abWindow.Screen.Bounds.Right;
                    bottom = abWindow.Screen.Bounds.Bottom;
                }

                if (!abWindow.RequiresScreenEdge)
                {
                    edgeOffset = Convert.ToInt32(GetAppBarEdgeWindowsHeight((AppBarEdge)abd.uEdge, abWindow.Screen));
                }

                if (abd.uEdge == (int)AppBarEdge.Left || abd.uEdge == (int)AppBarEdge.Right)
                {
                    abd.rc.Top    = top;
                    abd.rc.Bottom = bottom;
                    if (abd.uEdge == (int)AppBarEdge.Left)
                    {
                        abd.rc.Left  = left + edgeOffset;
                        abd.rc.Right = abd.rc.Left + sWidth;
                    }
                    else
                    {
                        abd.rc.Right = right - edgeOffset;
                        abd.rc.Left  = abd.rc.Right - sWidth;
                    }
                }
                else
                {
                    abd.rc.Left  = left;
                    abd.rc.Right = right;
                    if (abd.uEdge == (int)AppBarEdge.Top)
                    {
                        abd.rc.Top    = top + edgeOffset;
                        abd.rc.Bottom = abd.rc.Top + sHeight;
                    }
                    else
                    {
                        abd.rc.Bottom = bottom - edgeOffset;
                        abd.rc.Top    = abd.rc.Bottom - sHeight;
                    }
                }

                SHAppBarMessage((int)ABMsg.ABM_QUERYPOS, ref abd);

                // system doesn't adjust all edges for us, do some adjustments
                switch (abd.uEdge)
                {
                case (int)AppBarEdge.Left:
                    abd.rc.Right = abd.rc.Left + sWidth;
                    break;

                case (int)AppBarEdge.Right:
                    abd.rc.Left = abd.rc.Right - sWidth;
                    break;

                case (int)AppBarEdge.Top:
                    abd.rc.Bottom = abd.rc.Top + sHeight;
                    break;

                case (int)AppBarEdge.Bottom:
                    abd.rc.Top = abd.rc.Bottom - sHeight;
                    break;
                }

                SHAppBarMessage((int)ABMsg.ABM_SETPOS, ref abd);

                // check if new coords
                bool isSameCoords = false;
                if (!isCreate)
                {
                    bool topUnchanged    = abd.rc.Top == (abWindow.Top * abWindow.DpiScale);
                    bool leftUnchanged   = abd.rc.Left == (abWindow.Left * abWindow.DpiScale);
                    bool bottomUnchanged = abd.rc.Bottom == (abWindow.Top * abWindow.DpiScale) + sHeight;
                    bool rightUnchanged  = abd.rc.Right == (abWindow.Left * abWindow.DpiScale) + sWidth;

                    isSameCoords = topUnchanged &&
                                   leftUnchanged &&
                                   bottomUnchanged &&
                                   rightUnchanged;
                }

                if (!isSameCoords)
                {
                    ShellLogger.Debug($"AppBarManager: {abWindow.Name} changing position (TxLxBxR) to {abd.rc.Top}x{abd.rc.Left}x{abd.rc.Bottom}x{abd.rc.Right} from {abWindow.Top * abWindow.DpiScale}x{abWindow.Left * abWindow.DpiScale}x{(abWindow.Top * abWindow.DpiScale) + sHeight}x{ (abWindow.Left * abWindow.DpiScale) + sWidth}");
                    abWindow.SetAppBarPosition(abd.rc);
                }

                abWindow.AfterAppBarPos(isSameCoords, abd.rc);

                if (((abd.uEdge == (int)AppBarEdge.Top || abd.uEdge == (int)AppBarEdge.Bottom) && abd.rc.Bottom - abd.rc.Top < sHeight) ||
                    ((abd.uEdge == (int)AppBarEdge.Left || abd.uEdge == (int)AppBarEdge.Right) && abd.rc.Right - abd.rc.Left < sWidth))
                {
                    ABSetPos(abWindow, width, height, edge);
                }
            }
        }
Esempio n. 21
0
        public Taskbar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, DesktopManager desktopManager, AppGrabberService appGrabber, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 0)
        {
            InitializeComponent();
            _appGrabber     = appGrabber;
            _desktopManager = desktopManager;
            _shellManager   = shellManager;

            if (!Screen.Primary && !Settings.Instance.EnableMenuBarMultiMon)
            {
                ProcessScreenChanges = true;
            }
            else
            {
                ProcessScreenChanges = false;
            }

            setupTaskbar();
            setupTaskbarAppearance();
        }
Esempio n. 22
0
 public static void AddAppBarWindow(IntPtr target, AppBarEdge dockingPosition)
 {
     commands.Enqueue(new CreateAppBarCommand(target, dockingPosition));
 }
Esempio n. 23
0
 public static void MoveAppBarWindow(IntPtr target, AppBarEdge dockingPosition)
 {
     throw new PlatformNotSupportedException("The operation is not supported until Windows 10 Anniversary Update, Version 1607 (Build 14393).");
 }
Esempio n. 24
0
 private static StyleRenderer GetRenderer(AppBarEdge edge)
 {
     if (!StyleRenderer.IsSupported)
         return new ClassicStyleRenderer();
     var renderMap = new Dictionary<AppBarEdge, VisualStyleElement>
     {
         { AppBarEdge.Bottom, VisualStyleElement.Taskbar.BackgroundBottom.Normal },
         { AppBarEdge.Top, VisualStyleElement.Taskbar.BackgroundTop.Normal },
         { AppBarEdge.Left, VisualStyleElement.Taskbar.BackgroundLeft.Normal },
         { AppBarEdge.Right, VisualStyleElement.Taskbar.BackgroundRight.Normal },
     };
     return new ManagedStyleRenderer(renderMap[edge]);
 }
Esempio n. 25
0
        private static void AppBarSetPosition(AppBarEdge edge, Form appBarForm)
        {
            var regInfo    = GetRegisterInfo(appBarForm);
            var screenRect = GetScreenBounds(appBarForm);

            APPBARDATA barData = new APPBARDATA();

            barData.cbSize = Marshal.SizeOf(barData);
            barData.hWnd   = appBarForm.Handle;
            barData.uEdge  = (int)edge;

            DebugLog("AppBarSetPosition()", "Starting...");

            if (edge == AppBarEdge.Left || edge == AppBarEdge.Right)
            {
                // Bar should be the full available height of the screen
                barData.rc.top    = 0;
                barData.rc.bottom = screenRect.Height;

                if (edge == AppBarEdge.Left)
                {
                    // Setup proposed location
                    barData.rc.left  = 0;
                    barData.rc.right = barData.rc.left + regInfo.OrigSize.Width;
                }
                else if (edge == AppBarEdge.Right)
                {
                    // Setup proposed location
                    barData.rc.right = screenRect.Width;
                    barData.rc.left  = barData.rc.right - regInfo.OrigSize.Width;
                }
            }
            else
            {
                // Bar should be the full available width of the screen
                barData.rc.left  = 0;
                barData.rc.right = screenRect.Width;

                if (edge == AppBarEdge.Top)
                {
                    // Setup proposed location
                    barData.rc.top    = 0;
                    barData.rc.bottom = barData.rc.top + regInfo.OrigSize.Height;
                }
                else if (edge == AppBarEdge.Bottom)
                {
                    // Setup proposed location
                    barData.rc.bottom = screenRect.Height;
                    barData.rc.top    = barData.rc.bottom - regInfo.OrigSize.Height;
                }
            }

            // Send the query message to find out the other bars on the screen at that edge...
            DebugLog("AppBarSetPosition()", "barData.rc before ABM_QUERYPOS: " + barData.rc.ToString());
            SHAppBarMessage((int)AppBarMsg.ABM_QUERYPOS, ref barData);
            DebugLog("AppBarSetPosition()", "barData.rc after ABM_QUERYPOS: " + barData.rc.ToString());

            // Now we need to use that returned info and resize the barData.rc structure...
            if (edge == AppBarEdge.Top)
            {
                barData.rc.bottom = barData.rc.top + regInfo.OrigSize.Height;
            }
            else if (edge == AppBarEdge.Bottom)
            {
                barData.rc.top = barData.rc.bottom - regInfo.OrigSize.Height;
            }
            else if (edge == AppBarEdge.Left)
            {
                barData.rc.right = barData.rc.left + regInfo.OrigSize.Width;
            }
            else if (edge == AppBarEdge.Right)
            {
                barData.rc.left = barData.rc.right - regInfo.OrigSize.Width;
            }

            // Send the set position message...
            DebugLog("AppBarSetPosition()", "barData.rc before ABM_SETPOS: " + barData.rc.ToString());
            SHAppBarMessage((int)AppBarMsg.ABM_SETPOS, ref barData);
            DebugLog("AppBarSetPosition()", "barData.rc after ABM_SETPOS: " + barData.rc.ToString());

            // Sleep 0.5 seconds
            System.Threading.Thread.Sleep(500);

            // Finally move the window into mosition...
            appBarForm.BeginInvoke(new MoveAndResizeWindowDelegate(MoveAndResizeWindow), barData.hWnd, barData.rc);
        }
Esempio n. 26
0
        public Taskbar(WindowManager windowManager, ShellManager shellManager, StartMenuMonitor startMenuMonitor, Updater updater, AppBarScreen screen, AppBarEdge edge)
            : base(shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, 0)
        {
            _shellManager  = shellManager;
            _updater       = updater;
            _windowManager = windowManager;

            InitializeComponent();
            DataContext = _shellManager;
            StartButton.StartMenuMonitor = startMenuMonitor;

            DesiredHeight = Application.Current.FindResource("TaskbarHeight") as double? ?? 0;
            DesiredWidth  = Application.Current.FindResource("TaskbarWidth") as double? ?? 0;

            AllowsTransparency = Application.Current.FindResource("AllowsTransparency") as bool? ?? false;

            FlowDirection = Application.Current.FindResource("flow_direction") as FlowDirection? ?? FlowDirection.LeftToRight;

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;

            if (Settings.Instance.ShowQuickLaunch)
            {
                QuickLaunchToolbar.Visibility = Visibility.Visible;
            }

            // Hide the start button on secondary display(s)
            if (!Screen.Primary)
            {
                StartButton.Visibility = Visibility.Collapsed;
            }
        }
Esempio n. 27
0
 public CreateAppBarCommand(IntPtr target, AppBarEdge dockingPosition)
     : base(target)
 {
     DockingPosition = dockingPosition;
 }
Esempio n. 28
0
        //private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings

        public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23)
        {
            _appGrabber = appGrabber;
            _applicationUpdateService = applicationUpdateService;
            _settingsUiService        = settingsUiService;

            InitializeComponent();

            RequiresScreenEdge = true;

            SetPosition();

            setupChildren();

            setupMenu();

            setupCairoMenu();

            setupPlacesMenu();

            Settings.Instance.PropertyChanged += Settings_PropertyChanged;
        }
Esempio n. 29
0
        public CairoAppBarWindow(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppBarScreen screen, AppBarEdge edge, double height) : base(
                shellManager.AppBarManager, shellManager.ExplorerHelper, shellManager.FullScreenHelper, screen, edge, height)
        {
            _cairoApplication = cairoApplication;
            _windowManager    = windowManager;

            AllowsTransparency = true;
        }