Пример #1
0
		public void UpdateTab ()
		{
			if (Child != null) {
				Widget w = Child;
				Remove (w);
				w.Destroy ();
			}
			
			mainBox = new Alignment (0,0,1,1);
			if (bar.Orientation == Gtk.Orientation.Horizontal) {
				box = new HBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (5, 5, 11, 9);
				else
					mainBox.SetPadding (5, 5, 9, 11);
			}
			else {
				box = new VBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (11, 9, 5, 5);
				else
					mainBox.SetPadding (9, 11, 5, 5);
			}
			
			if (it.Icon != null) {
				var desat = it.Icon.WithAlpha (0.5);
				crossfade = new CrossfadeIcon (desat, it.Icon);
				box.PackStart (crossfade, false, false, 0);
				desat.Dispose ();
			}
				
			if (!string.IsNullOrEmpty (it.Label)) {
				label = new Label (it.Label);
				label.UseMarkup = true;
				label.ModifyFont (FontService.SansFont.CopyModified (Styles.FontScale11));

				if (bar.Orientation == Orientation.Vertical)
					label.Angle = 270;

				// fine-tune label alignment issues
				if (Platform.IsMac) {
					if (bar.Orientation == Orientation.Horizontal)
						label.SetAlignment (0, 0.5f);
					else
						label.SetAlignment (0.6f, 0);
				} else {
					if (bar.Orientation == Orientation.Vertical)
						label.SetAlignment (1, 0);
				}
				// TODO: VV: Test Linux

				box.PackStart (label, true, true, 0);
			} else
				label = null;

			box.Spacing = 2;
			mainBox.Add (box);
			mainBox.ShowAll ();
			Add (mainBox);
			UpdateStyle (this, null); 
			QueueDraw ();
		}
Пример #2
0
		public void UpdateTab ()
		{
			if (Child != null) {
				Widget w = Child;
				Remove (w);
				w.Destroy ();
			}
			
			mainBox = new Alignment (0,0,1,1);
			if (bar.Orientation == Gtk.Orientation.Horizontal) {
				box = new HBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (3, 3, 11, 9);
				else
					mainBox.SetPadding (3, 3, 9, 11);
			}
			else {
				box = new VBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (11, 9, 3, 3);
				else
					mainBox.SetPadding (9, 11, 3, 3);
			}
			
			Gtk.Widget customLabel = null;
			if (it.DockLabelProvider != null)
				customLabel = it.DockLabelProvider.CreateLabel (bar.Orientation);
			
			if (customLabel != null) {
				customLabel.ShowAll ();
				box.PackStart (customLabel, true, true, 0);
			}
			else {
				if (it.Icon != null) {
					Gdk.Pixbuf desat = it.Icon.Copy ();
					desat.SaturateAndPixelate (desat, 0.5f, false);
					crossfade = new CrossfadeIcon (desat, it.Icon);
					box.PackStart (crossfade, false, false, 0);
					desat.Dispose ();
				}
					
				if (!string.IsNullOrEmpty (it.Label)) {
					label = new Gtk.Label (it.Label);
					label.UseMarkup = true;
					if (bar.Orientation == Gtk.Orientation.Vertical)
						label.Angle = 270;
					box.PackStart (label, true, true, 0);
				} else
					label = null;
			}

			box.Spacing = 2;
			mainBox.Add (box);
			mainBox.ShowAll ();
			Add (mainBox);
			QueueDraw ();
		}
Пример #3
0
        public void UpdateTab()
        {
            if (Child != null)
            {
                Widget w = Child;
                Remove(w);
                w.Destroy();
            }

            mainBox = new Alignment(0, 0, 1, 1);
            if (bar.Orientation == Gtk.Orientation.Horizontal)
            {
                box = new HBox();
                if (bar.AlignToEnd)
                {
                    mainBox.SetPadding(3, 3, 11, 9);
                }
                else
                {
                    mainBox.SetPadding(3, 3, 9, 11);
                }
            }
            else
            {
                box = new VBox();
                if (bar.AlignToEnd)
                {
                    mainBox.SetPadding(11, 9, 3, 3);
                }
                else
                {
                    mainBox.SetPadding(9, 11, 3, 3);
                }
            }

            Gtk.Widget customLabel = null;
            if (it.DockLabelProvider != null)
            {
                customLabel = it.DockLabelProvider.CreateLabel(bar.Orientation);
            }

            if (customLabel != null)
            {
                customLabel.ShowAll();
                box.PackStart(customLabel, true, true, 0);
            }
            else
            {
                if (it.Icon != null)
                {
                    var desat = it.Icon.WithAlpha(0.5);
                    crossfade = new CrossfadeIcon(desat, it.Icon);
                    box.PackStart(crossfade, false, false, 0);
                    desat.Dispose();
                }

                if (!string.IsNullOrEmpty(it.Label))
                {
                    label           = new Gtk.Label(it.Label);
                    label.UseMarkup = true;
                    if (bar.Orientation == Gtk.Orientation.Vertical)
                    {
                        label.Angle = 270;
                    }
                    box.PackStart(label, true, true, 0);
                }
                else
                {
                    label = null;
                }
            }

            box.Spacing = 2;
            mainBox.Add(box);
            mainBox.ShowAll();
            Add(mainBox);
            QueueDraw();
        }
Пример #4
0
		public void UpdateTab ()
		{
			if (Child != null) {
				Widget w = Child;
				Remove (w);
				w.Destroy ();
			}
			
			mainBox = new Alignment (0,0,1,1);
			if (bar.Orientation == Gtk.Orientation.Horizontal) {
				box = new HBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (3, 3, 11, 9);
				else
					mainBox.SetPadding (3, 3, 9, 11);
			}
			else {
				box = new VBox ();
				if (bar.AlignToEnd)
					mainBox.SetPadding (11, 9, 3, 3);
				else
					mainBox.SetPadding (9, 11, 3, 3);
			}
			
			if (it.Icon != null) {
				var desat = it.Icon.WithAlpha (0.5);
				crossfade = new CrossfadeIcon (desat, it.Icon);
				box.PackStart (crossfade, false, false, 0);
				desat.Dispose ();
			}
				
			if (!string.IsNullOrEmpty (it.Label)) {
				label = new Gtk.Label (it.Label);
				label.UseMarkup = true;
				if (bar.Orientation == Gtk.Orientation.Vertical)
					label.Angle = 270;
				box.PackStart (label, true, true, 0);
			} else
				label = null;

			box.Spacing = 2;
			mainBox.Add (box);
			mainBox.ShowAll ();
			Add (mainBox);
			QueueDraw ();
		}
Пример #5
0
        public void UpdateTab()
        {
            if (Child != null)
            {
                Widget w = Child;
                Remove(w);
                w.Destroy();
            }

            mainBox = new Alignment(0, 0, 1, 1);
            if (bar.Orientation == Gtk.Orientation.Horizontal)
            {
                box = new HBox();
                if (bar.AlignToEnd)
                {
                    mainBox.SetPadding(5, 5, 11, 9);
                }
                else
                {
                    mainBox.SetPadding(5, 5, 9, 11);
                }
            }
            else
            {
                box = new VBox();
                if (bar.AlignToEnd)
                {
                    mainBox.SetPadding(11, 9, 5, 5);
                }
                else
                {
                    mainBox.SetPadding(9, 11, 5, 5);
                }
            }

            if (it.Icon != null)
            {
                var desat = it.Icon.WithAlpha(0.5);
                crossfade = new CrossfadeIcon(desat, it.Icon);
                box.PackStart(crossfade, false, false, 0);
                desat.Dispose();
            }

            if (!string.IsNullOrEmpty(it.Label))
            {
                label           = new Label(it.Label);
                label.UseMarkup = true;
                label.ModifyFont(FontService.SansFont.CopyModified(Styles.FontScale11));

                if (bar.Orientation == Orientation.Vertical)
                {
                    label.Angle = 270;
                }

                // fine-tune label alignment issues
                if (Platform.IsMac)
                {
                    if (bar.Orientation == Orientation.Horizontal)
                    {
                        label.SetAlignment(0, 0.5f);
                    }
                    else
                    {
                        label.SetAlignment(0.6f, 0);
                    }
                }
                else
                {
                    if (bar.Orientation == Orientation.Vertical)
                    {
                        label.SetAlignment(1, 0);
                    }
                }
                // TODO: VV: Test Linux

                box.PackStart(label, true, true, 0);
            }
            else
            {
                label = null;
            }

            box.Spacing = 2;
            mainBox.Add(box);
            mainBox.ShowAll();
            Add(mainBox);
            UpdateStyle(this, null);
            QueueDraw();
        }