gtk-sharp 0.0.0.0 neutral Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. A container with just one child. A Bin widget is a with just one child. It is used to create subclasses, since it provides common code needed for handling a single child . Many GTK+ widgets are subclasses of Bin, including , , , , and . To place a child widget inside this container, use the standard method. For the widget to be useful, it should participate in size negotiation and size allocation using the events and . Since Gtk.Bin is an abstract class in C, it is necessary to register a Type. Sample follows. using System; using Gtk; // // A simple Bin class: a simple container that adds padding. // class MyPadder : Bin { int pad = 50; static GLib.Type type; Widget child; static MyPadder () { // // Register the type on the static constructor, so it is // available on the instance constructors // type = RegisterGType (typeof (MyPadder)); } public MyPadder () : base (type) { // To track our child widget. Added += new AddedHandler (MyAdded); // Participate in size negotiation SizeRequested += new SizeRequestedHandler (OnSizeRequested); SizeAllocated += new SizeAllocatedHandler (OnSizeAllocated); } // // Invoked to query our size // void OnSizeRequested (object o, SizeRequestedArgs args) { if (child != null){ int width = args.Requisition.width; int height = args.Requisition.height; child.GetSizeRequest (out width, out height); if (width == -1 || height == -1) width = height = 80; SetSizeRequest (width + pad * 2, height + pad * 2); } } // // Invoked to propagate our size // void OnSizeAllocated (object o, SizeAllocatedArgs args) { if (child != null){ Gdk.Rectangle mine = args.Allocation; Gdk.Rectangle his = mine; his.x += pad; his.y += pad; his.width -= pad * 2; his.height -= pad * 2; child.SizeAllocate (his); } } // // Public property of the Padding widget // public int Pad { get { return pad; } set { pad = value; QueueResize (); } } void MyAdded (object o, AddedArgs args) { child = args.Widget; } } class Y { static void Main () { Application.Init (); Window w = new Window ("Hello"); MyPadder x = new MyPadder (); x.Pad = 100; Button b = new Button ("Hola"); w.Add (x); x.Add (b); w.ShowAll (); Application.Run (); } } Gtk.Container Atk.Implementor GLib.IWrapper GLib.IWrapper System.IDisposable Method System.Void Disposes the resources associated with the object. Constructor Internal constructor Pointer to the C object. An instance of Bin, wrapping the C object. This is an internal constructor, and should not be used by user code. Property Gtk.Widget To be added a To be added Property GLib.GType To be added a To be added Constructor To be added a a To be added Constructor To be added a To be added