Esempio n. 1
0
        public void UpdateBehavior()
        {
            if (btnClose == null)
            {
                return;
            }

            btnClose.Visible = (item.Behavior & DockItemBehavior.CantClose) == 0;
            btnDock.Visible  = (item.Behavior & DockItemBehavior.CantAutoHide) == 0;

            if (active || mouseOver)
            {
                if (btnClose.Image == null)
                {
                    btnClose.Image = pixClose;
                }
                if (item.Status == DockItemStatus.AutoHide || item.Status == DockItemStatus.Floating)
                {
                    btnDock.Image         = pixDock;
                    btnDock.InactiveImage = pixDock.WithAlpha(.5);
                    btnDock.TooltipText   = Catalog.GetString("Dock");
                }
                else
                {
                    btnDock.Image         = pixAutoHide;
                    btnDock.InactiveImage = pixAutoHide.WithAlpha(.5);
                    btnDock.TooltipText   = Catalog.GetString("Auto Hide");
                }
            }
            else
            {
                btnDock.Image  = null;
                btnClose.Image = null;
            }
        }
Esempio n. 2
0
 void RenderIcon(Cairo.Context context, Gdk.Pixbuf surface, double opacity)
 {
     context.DrawImage(this, surface.WithAlpha(opacity),
                       Allocation.X + (Allocation.Width - surface.Width) / 2,
                       Allocation.Y + (Allocation.Height - surface.Height) / 2);
 }
Esempio n. 3
0
        public void SetLabel(Gtk.Widget page, Gdk.Pixbuf icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            Gtk.HBox box = new HBox();
            box.Spacing = 2;

            if (icon != null)
            {
                tabIcon = new ImageView(icon);
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 0);
            }
            else
            {
                tabIcon = null;
            }

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new Label(label);
                //labelWidget.DropShadowVisible = true;
                labelWidget.UseMarkup = true;
                box.PackStart(labelWidget, true, true, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock               = new ImageButton();
            btnDock.Image         = pixAutoHide;
            btnDock.InactiveImage = pixAutoHide.WithAlpha(.5);
            btnDock.TooltipText   = Catalog.GetString("Auto Hide");
            btnDock.CanFocus      = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;

            btnClose               = new ImageButton();
            btnClose.Image         = pixClose;
            btnClose.InactiveImage = pixClose.WithAlpha(.5);
            btnClose.TooltipText   = Catalog.GetString("Close");
            btnClose.CanFocus      = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

            Gtk.Alignment al     = new Alignment(0, 0, 1, 1);
            HBox          btnBox = new HBox(false, 3);

            btnBox.PackStart(btnDock, false, false, 0);
            btnBox.PackStart(btnClose, false, false, 0);
            al.Add(btnBox);
            al.LeftPadding = 3;
            al.TopPadding  = 1;
            box.PackEnd(al, false, false, 0);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }