private static void RestoreWindowState(Gtk.Window window)
        {
            var position      = Properties.Settings.Default.WindowPosition;
            var positionValid = false;

            foreach (var desktopWorkArea in Gdk.Global.DesktopWorkareas)
            {
                positionValid = desktopWorkArea.Contains(position);
                if (positionValid)
                {
                    break;
                }
            }
            if (!positionValid)
            {
                var desktop = Gdk.Global.CurrentDesktop;
                var currentDesktopWorkArea = Gdk.Global.DesktopWorkareas[desktop];
                position.X = currentDesktopWorkArea.Left + 40;
                position.Y = currentDesktopWorkArea.Top + 40;
            }
            var size  = Properties.Settings.Default.WindowSize;
            var state = Properties.Settings.Default.WindowState;

            window.Move(position.X, position.Y);
            window.Resize(size.Width, size.Height);
            if (state.HasFlag(Gdk.WindowState.Maximized))
            {
                window.Maximize();
            }
            if (state.HasFlag(Gdk.WindowState.Fullscreen))
            {
                window.Fullscreen();
            }
        }
 void HandleSizeAllocated(object o, Gtk.SizeAllocatedArgs args)
 {
     Gtk.Window wndMax = (Gtk.Window)o;
     if (args.Allocation.Width == 200)
     {
         if (RestrictionLibrary.CurrentOS.IsMac)
         {
             wndMax.Maximize();
         }
     }
 }
        /// <summary>
        /// Displays the popup for a certain amount of time.
        /// </summary>
        /// <param name="strTitle">The string which will be shown as the title of the popup.</param>
        /// <param name="strContent">The string which will be shown as the content of the popup.</param>
        /// <param name="nTimeToShow">Duration of the showing animation (in milliseconds).</param>
        /// <param name="nTimeToStay">Duration of the visible state before collapsing (in milliseconds). Use 0 to stay visible.</param>
        /// <param name="nTimeToHide">Duration of the hiding animation (in milliseconds).</param>
        /// <returns>Nothing</returns>
        public void Show(string strTitle, string strContent, uint nTimeToShow, uint nTimeToStay, uint nTimeToHide)
        {
            ScreenTransBitmap = null;
            Gtk.Window wndMax = new Gtk.Window(Gtk.WindowType.Toplevel);
            wndMax.SizeAllocated    += HandleSizeAllocated;
            wndMax.WindowStateEvent += HandleWindowStateEvent;
            wndMax.Opacity           = 0;
            wndMax.SkipPagerHint     = true;
            wndMax.SkipTaskbarHint   = true;
            wndMax.FocusOnMap        = false;
            wndMax.Decorated         = RestrictionLibrary.CurrentOS.IsMac;
            wndMax.Show();
            if (!RestrictionLibrary.CurrentOS.IsMac)
            {
                wndMax.Maximize();
            }
            titleText      = strTitle;
            contentText    = strContent;
            nVisibleEvents = nTimeToStay;
            CalculateMouseRectangles();

            uint nEvents;

            if (nTimeToShow > 10)
            {
                nEvents        = Math.Min((nTimeToShow / 10), 100);
                nShowEvents    = nTimeToShow / nEvents;
                nIncrementShow = 100 / nEvents;
            }
            else
            {
                nShowEvents    = 10;
                nIncrementShow = 100;
            }

            if (nTimeToHide > 10)
            {
                nEvents        = Math.Min((nTimeToHide / 10), 100);
                nHideEvents    = nTimeToHide / nEvents;
                nIncrementHide = 100 / nEvents;
            }
            else
            {
                nHideEvents    = 10;
                nIncrementHide = 100;
            }
        }
Esempio n. 4
0
        public void Restore()
        {
            if ((options & WindowPersistOptions.Size) != 0)
            {
                int width  = WidthSchema.Get();
                int height = HeightSchema.Get();

                if (width != 0 && height != 0)
                {
                    window.Resize(width, height);
                }
            }

            if ((options & WindowPersistOptions.Position) != 0)
            {
                int x = XPosSchema.Get();
                int y = YPosSchema.Get();

                if (x == 0 && y == 0)
                {
                    window.SetPosition(Gtk.WindowPosition.Center);
                }
                else
                {
                    window.Move(x, y);
                }
            }

            if ((options & WindowPersistOptions.Size) != 0)
            {
                if (MaximizedSchema.Get())
                {
                    window.Maximize();
                }
                else
                {
                    window.Unmaximize();
                }
            }
        }
Esempio n. 5
0
 public override void Maximize()
 {
     window.Maximize();
 }