Exemplo n.º 1
0
        public void SetPadding(double left, double right, double top, double bottom)
        {
            if (Widget is HeaderBox)
            {
                HeaderBox hb = (HeaderBox)Widget;
                hb.SetPadding((int)top, (int)bottom, (int)left, (int)right);
                return;
            }

            if (left == 0 && right == 0 && top == 0 && bottom == 0 && paddingAlign == null)
            {
                return;
            }

            if (paddingAlign == null)
            {
                paddingAlign = new Gtk.Alignment(0, 0, 1, 1);
                paddingAlign.Show();
                var c = Widget.Child;
                if (c != null)
                {
                    Widget.Remove(c);
                    paddingAlign.Add(c);
                }
                Widget.Add(paddingAlign);
            }
            UreatePaddingAlign(top, bottom, left, right);
        }
		public override void Initialize ()
		{
			base.Initialize ();
			toolbar = new HeaderBox ();
			toolbar.GradientBackground = true;
			toolbar.SetMargins (0, 1, 0, 0);
			MainBox.PackStart (toolbar, false, false, 0);
			((Gtk.Box.BoxChild)MainBox [toolbar]).Position = 0;
		}
Exemplo n.º 3
0
        public void SetBorderSize(double left, double right, double top, double bottom)
        {
            HeaderBox hb = Widget as HeaderBox;

            if (hb != null)
            {
                hb.SetMargins((int)top, (int)bottom, (int)left, (int)right);
            }
        }
Exemplo n.º 4
0
		public void SetFrameType (FrameType type)
		{
			Frame f = (Frame) Frontend;
			
			switch (type) {
			case FrameType.Custom:
				if (!(Widget is HeaderBox)) {
					HeaderBox box = new HeaderBox ();
					box.Show ();
					box.BackgroundColor = UsingCustomBackgroundColor ? (Color?)BackgroundColor : null;
					box.SetMargins ((int)f.BorderWidthTop, (int)f.BorderWidthBottom, (int)f.BorderWidthLeft, (int)f.BorderWidthRight);
					box.SetPadding ((int)f.Padding.Top, (int)f.Padding.Bottom, (int)f.Padding.Left, (int)f.Padding.Right);
					if (borderColor != null)
						box.SetBorderColor (borderColor.Value);
					var c = paddingAlign != null ? paddingAlign.Child : Widget.Child;
					if (c != null) {
						((Gtk.Container)c.Parent).Remove (c);
						box.Add (c);
					}
					Widget = box;
					if (paddingAlign != null) {
						paddingAlign.Destroy ();
						paddingAlign = null;
					}
				}
				break;
			case FrameType.WidgetBox:
				if (!(Widget is Gtk.Frame)) {
					var c = Widget.Child;
					if (c != null)
						Widget.Remove (c);
					Gtk.Frame gf = new Gtk.Frame ();
					if (!string.IsNullOrEmpty (label))
						gf.Label = label;
					if (f.Padding.HorizontalSpacing != 0 || f.Padding.VerticalSpacing != 0) {
						paddingAlign = new Gtk.Alignment (0, 0, 1, 1);
						paddingAlign.Show ();
						UreatePaddingAlign (f.Padding.Top, f.Padding.Bottom, f.Padding.Left, f.Padding.Right);
						if (c != null)
							paddingAlign.Add (c);
						gf.Add (paddingAlign);
					} else {
						if (c != null)
							gf.Add (c);
					}
					gf.Show ();
					Widget = gf;
				}
				break;
			}
		}
Exemplo n.º 5
0
        public void SetFrameType(FrameType type)
        {
            Frame f = (Frame)Frontend;

            switch (type)
            {
            case FrameType.Custom:
                if (!(Widget is HeaderBox))
                {
                    HeaderBox box = new HeaderBox();
                    box.Show();
                    box.BackgroundColor = UsingCustomBackgroundColor ? (Color?)BackgroundColor : null;
                                        #pragma warning disable CS0618 // Type or member is obsolete
                    box.SetMargins((int)f.BorderWidthTop, (int)f.BorderWidthBottom, (int)f.BorderWidthLeft, (int)f.BorderWidthRight);
                                        #pragma warning restore CS0618 // Type or member is obsolete
                    box.SetPadding((int)f.Padding.Top, (int)f.Padding.Bottom, (int)f.Padding.Left, (int)f.Padding.Right);
                    if (borderColor != null)
                    {
                        box.SetBorderColor(borderColor.Value);
                    }
                    var c = paddingAlign != null ? paddingAlign.Child : Widget.Child;
                    if (c != null)
                    {
                        ((Gtk.Container)c.Parent).Remove(c);
                        box.Add(c);
                    }
                    Widget = box;
                    if (paddingAlign != null)
                    {
                        paddingAlign.Destroy();
                        paddingAlign = null;
                    }
                }
                break;

            case FrameType.WidgetBox:
                if (!(Widget is Gtk.Frame))
                {
                    var c = Widget.Child;
                    if (c != null)
                    {
                        Widget.Remove(c);
                    }
                    Gtk.Frame gf = new Gtk.Frame();
                    if (!string.IsNullOrEmpty(label))
                    {
                        gf.Label = label;
                    }
                    if (f.Padding.HorizontalSpacing != 0 || f.Padding.VerticalSpacing != 0)
                    {
                        paddingAlign = new Gtk.Alignment(0, 0, 1, 1);
                        paddingAlign.Show();
                        UreatePaddingAlign(f.Padding.Top, f.Padding.Bottom, f.Padding.Left, f.Padding.Right);
                        if (c != null)
                        {
                            paddingAlign.Add(c);
                        }
                        gf.Add(paddingAlign);
                    }
                    else
                    {
                        if (c != null)
                        {
                            gf.Add(c);
                        }
                    }
                    gf.Show();
                    Widget = gf;
                }
                break;
            }
        }