public static BinContainer Attach(Gtk.Bin bin) { BinContainer bc = new BinContainer(); bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested); bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated); bin.Added += new Gtk.AddedHandler(bc.OnAdded); return(bc); }
public void SetChild(IWidgetBackend child) { RemoveChildPlacement(currentChild); if (Widget.Child != null) { if (Widget.Child is Gtk.Bin) { Gtk.Bin vp = (Gtk.Bin)Widget.Child; vp.Remove(vp.Child); } Widget.Remove(Widget.Child); } if (child != null) { var w = currentChild = GetWidgetWithPlacement(child); WidgetBackend wb = (WidgetBackend)child; if (wb.EventSink.SupportsCustomScrolling()) { CustomViewPort vp = new CustomViewPort(wb.EventSink); vp.Show(); vp.Add(w); Widget.Child = vp; } #if XWT_GTK3 else if (w is Gtk.IScrollable) { Widget.Child = w; } #else // Gtk2 has no interface for natively scrollable widgets, therefore we manually check // for types that should not be packed into a Viewport. // see: https://developer.gnome.org/gtk2/stable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport else if (w is Gtk.Viewport || w is Gtk.TreeView || w is Gtk.TextView || w is Gtk.Layout || w is WebKit.WebView) { Widget.Child = w; } #endif else { Gtk.Viewport vp = new Gtk.Viewport(); vp.Show(); vp.Add(w); Widget.Child = vp; } } UpdateBorder(); }
void SetupConfigurationWidget() { if (theme_configuration_container.Child != null) { theme_configuration_container.Remove(theme_configuration_container.Child); } if (Do.Controller.Window is IConfigurable) { IConfigurable window = Do.Controller.Window as IConfigurable; Gtk.Bin bin = window.GetConfiguration(); theme_configuration_container.Add(bin); } theme_configuration_container.ShowAll(); }
public void SetContent(IWidgetBackend child) { Gtk.Bin parent = paddingAlign != null ? paddingAlign : Widget; if (child != null) { var w = GetWidget(child); if (parent.Child != null) { parent.Remove(parent.Child); } parent.Child = w; } else { parent.Child = null; } }
private bool GetContainerFocusState(Gtk.Bin aContainer) { foreach (Widget wdg in aContainer.Children) { if (System.Data.Bindings.TypeValidator.IsCompatible(wdg.GetType(), typeof(Gtk.Bin))) { if (GetContainerFocusState(wdg) == true) { return(true); } } else if (wdg.HasFocus == true) { return(true); } } return(false); }
public void SetChild(IWidgetBackend child) { RemoveChildPlacement(currentChild); if (Widget.Child != null) { if (Widget.Child is Gtk.Bin) { Gtk.Bin vp = (Gtk.Bin)Widget.Child; vp.Remove(vp.Child); } Widget.Remove(Widget.Child); } if (child != null) { var w = currentChild = GetWidgetWithPlacement(child); WidgetBackend wb = (WidgetBackend)child; if (wb.EventSink.SupportsCustomScrolling()) { CustomViewPort vp = new CustomViewPort(wb.EventSink); vp.Show(); vp.Add(w); Widget.Child = vp; } else if (w is Gtk.Viewport) { Widget.Child = w; } else { Gtk.Viewport vp = new Gtk.Viewport(); vp.Show(); vp.Add(w); Widget.Child = vp; } } UpdateBorder(); }
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 618 box.SetMargins ((int)f.BorderWidthTop, (int)f.BorderWidthBottom, (int)f.BorderWidthLeft, (int)f.BorderWidthRight); #pragma warning restore 618 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; } }
public DataBinder(Gtk.Bin container, IBindableWrapper bindable) { _container = container; _bindable = bindable; }
public static void SetContent(this Gtk.Bin bin, object content) { bin.Child = ToWidget(content); }
public static Gtk.Widget GetContent(this Gtk.Bin bin) { return(bin.Child); }
// special case: no fmt string arguments public static string FormatLocalizedWithPrefix(this string key, Gtk.Bin o) { return((o.GetType().Namespace + "." + key).FormatLocalized()); }
public static string FormatLocalizedWithPrefix(this string key, Gtk.Bin o, params object[] args) { return((o.GetType().Namespace + "." + key).FormatLocalized(args)); }
// special case: no fmt string arguments public static string Format(Gtk.Bin o, string fmt) { return(fmt.FormatLocalizedWithPrefix(o)); }
public static string Format(Gtk.Bin o, string fmt, params object[] args) { return(fmt.FormatLocalizedWithPrefix(o, args)); }