Esempio n. 1
0
        public bool HideControls()
        {
            int x, y;

            Gdk.ModifierType type;

            if (!auto_hide)
            {
                return(false);
            }

            if (IsRealized)
            {
                GdkWindow.GetPointer(out x, out y, out type);
                if (Allocation.Contains(x, y))
                {
                    hide.Start();
                    return(true);
                }
            }

            hide.Stop();
            Visibility = VisibilityType.None;
            return(false);
        }
Esempio n. 2
0
 void ScheduleAutoHide(bool cancelAutoShow, bool force)
 {
     if (cancelAutoShow)
     {
         UnscheduleAutoShow();
     }
     if (force)
     {
         it.Widget.FocusChild = null;
     }
     if (autoHideTimeout == uint.MaxValue)
     {
         autoHideTimeout = GLib.Timeout.Add(force ? 0 : bar.Frame.AutoHideDelay, delegate {
             // Don't hide if the context menu for the item is being shown.
             if (it.ShowingContextMenu)
             {
                 return(true);
             }
             if (!force)
             {
                 // Don't hide the item if it has the focus. Try again later.
                 if (it.Widget.FocusChild != null && autoShowFrame != null && ((Gtk.Window)autoShowFrame.Toplevel).HasToplevelFocus)
                 {
                     return(true);
                 }
                 // Don't hide the item if the mouse pointer is still inside the window. Try again later.
                 int px, py;
                 it.Widget.GetPointer(out px, out py);
                 if (it.Widget.Visible && it.Widget.IsRealized && it.Widget.Allocation.Contains(px + it.Widget.Allocation.X, py + it.Widget.Allocation.Y))
                 {
                     return(true);
                 }
                 // Don't hide if the mouse pointer is still inside the DockBar item
                 GetPointer(out px, out py);
                 if (Allocation.Contains(px + Allocation.X, py + Allocation.Y))
                 {
                     return(true);
                 }
             }
             autoHideTimeout = uint.MaxValue;
             AutoHide(true);
             return(false);
         });
     }
 }
Esempio n. 3
0
        public bool HideControls()
        {
            if (!AutoHide)
            {
                return(false);
            }

            if (IsRealized)
            {
                GdkWindow.GetPointer(out var x, out var y, out var type);
                if (Allocation.Contains(x, y))
                {
                    //hide.Start ();
                    return(true);
                }
            }

            //hide.Stop ();
            Visibility = VisibilityType.None;
            return(false);
        }
        internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect)
        {
            if (!Allocation.Contains(px, py) || VisibleObjects.Count == 0)
            {
                dockDelegate = null;
                rect         = Gdk.Rectangle.Zero;
                return(false);
            }

            if (type == DockGroupType.Tabbed)
            {
                // Tabs can only contain DockGroupItems
                return(((DockGroupItem)VisibleObjects[0]).GetDockTarget(item, px, py, Allocation, out dockDelegate, out rect));
            }
            else if (type == DockGroupType.Horizontal)
            {
                if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the right of the group
                    dockDelegate = delegate(DockItem it)
                    {
                        DockTarget(it, dockObjects.Count);
                    };
                    rect = new Gdk.Rectangle(Allocation.Right - DockFrame.GroupDockSeparatorSize, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                    return(true);
                }
                else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the left of the group
                    dockDelegate = delegate(DockItem it)
                    {
                        DockTarget(it, 0);
                    };
                    rect = new Gdk.Rectangle(Allocation.Left, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                    return(true);
                }
                // Dock in a separator
                for (int n = 0; n < VisibleObjects.Count; n++)
                {
                    DockObject ob = VisibleObjects [n];
                    if (n < VisibleObjects.Count - 1 &&
                        px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2 &&
                        px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize / 2)
                    {
                        int dn = dockObjects.IndexOf(ob);
                        dockDelegate = delegate(DockItem it)
                        {
                            DockTarget(it, dn + 1);
                        };
                        rect = new Gdk.Rectangle(ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height);
                        return(true);
                    }
                    else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect))
                    {
                        return(true);
                    }
                }
            }
            else if (type == DockGroupType.Vertical)
            {
                if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the bottom of the group
                    dockDelegate = delegate(DockItem it)
                    {
                        DockTarget(it, dockObjects.Count);
                    };
                    rect = new Gdk.Rectangle(Allocation.X, Allocation.Bottom - DockFrame.GroupDockSeparatorSize, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                    return(true);
                }
                else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize)
                {
                    // Dock to the top of the group
                    dockDelegate = delegate(DockItem it)
                    {
                        DockTarget(it, 0);
                    };
                    rect = new Gdk.Rectangle(Allocation.X, Allocation.Top, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                    return(true);
                }
                // Dock in a separator
                for (int n = 0; n < VisibleObjects.Count; n++)
                {
                    DockObject ob = VisibleObjects [n];
                    if (n < VisibleObjects.Count - 1 &&
                        py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2 &&
                        py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize / 2)
                    {
                        int dn = dockObjects.IndexOf(ob);
                        dockDelegate = delegate(DockItem it)
                        {
                            DockTarget(it, dn + 1);
                        };
                        rect = new Gdk.Rectangle(Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2, Allocation.Width, DockFrame.GroupDockSeparatorSize);
                        return(true);
                    }
                    else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect))
                    {
                        return(true);
                    }
                }
            }
            dockDelegate = null;
            rect         = Gdk.Rectangle.Zero;
            return(false);
        }