예제 #1
0
        public ApplicationButton()
        {
            this.SetFlag (WidgetFlags.NoWindow);

            this.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            menuOpened = false;

            appMenu = new ApplicationMenu (this);
            appMenu.Hidden += appMenu_Hidden;

            HeightRequest = 36;
            WidthRequest = 36;

            this.enable = true;
        }
예제 #2
0
        internal void DrawApplicationMenu(Context cr, Rectangle r, Gdk.Rectangle itemsAlloc, double lineWidth, ApplicationMenu w)
        {
            double lineWidth05 = lineWidth / 2;
            double lineWidth15 = lineWidth * 1.5;
            Gdk.Rectangle alloc = w.Allocation;

            cr.Color = new Color (0.4, 0.4, 0.4);
            cr.Paint ();

            cr.Rectangle (itemsAlloc.X, itemsAlloc.Y, itemsAlloc.Width, itemsAlloc.Height);
            cr.Color = new Color (0.9216, 0.9216, 0.9216);
            cr.Fill ();

            cr.LineWidth = lineWidth;

            cr.MoveTo (itemsAlloc.Right - lineWidth05, itemsAlloc.Top);
            cr.LineTo (itemsAlloc.Right - lineWidth05, itemsAlloc.Bottom);
            cr.Color = new Color (1, 1, 1, 0.2);
            cr.Stroke ();

            cr.MoveTo (itemsAlloc.Right - lineWidth15, itemsAlloc.Top);
            cr.LineTo (itemsAlloc.Right - lineWidth15, itemsAlloc.Bottom);
            cr.Color = new Color (0, 0, 0, 0.2);
            cr.Stroke ();

            cr.Rectangle (alloc.X, alloc.Y, alloc.Width, itemsAlloc.Y - alloc.Y);
            LinearGradient linGrad = new LinearGradient (0, alloc.Y, 0, itemsAlloc.Y - alloc.Y);
            linGrad.AddColorStop (0.0, new Color (0.4, 0.4, 0.4));
            linGrad.AddColorStop (0.3, new Color (0.2, 0.2, 0.2));
            linGrad.AddColorStop (0.3, new Color (0, 0, 0));
            linGrad.AddColorStop (1.0, new Color (0.4, 0.4, 0.4));
            cr.Pattern = linGrad;
            cr.Fill ();
            linGrad.Destroy ();

            cr.Rectangle (alloc.X, itemsAlloc.Bottom, alloc.Width, alloc.Bottom - itemsAlloc.Bottom);
            linGrad = new LinearGradient (0, itemsAlloc.Bottom, 0, alloc.Bottom);
            linGrad.AddColorStop (0.0, new Color (0.4, 0.4, 0.4));
            linGrad.AddColorStop (0.3, new Color (0.2, 0.2, 0.2));
            linGrad.AddColorStop (0.3, new Color (0, 0, 0));
            linGrad.AddColorStop (1.0, new Color (0.4, 0.4, 0.4));
            cr.Pattern = linGrad;
            cr.Fill ();
            linGrad.Destroy ();

            Gdk.Rectangle appBtnAlloc = w.ApplicationButton.Allocation;
            appBtnAlloc.X = alloc.X;
            appBtnAlloc.Y = itemsAlloc.Y - 2 - appBtnAlloc.Height;
            DrawApplicationButton (cr, appBtnAlloc, ButtonState.Pressed, 1.0, w.ApplicationButton);
        }