gtk-sharp 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Container 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 .

Sample follows.

`using System; using Gtk; // // A simple Bin class: a simple container that adds padding. // class MyPadder : Bin { int pad = 50; Widget child; public MyPadder () { // 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 (); } }`
- Constructor
  2.12.0.0
  Protected constructor.
  Chain to this constructor if you have not manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  System.Obsolete
  a
  Protected Constructor.
  Chain to this constructor if you have manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  Pointer to the C object.
  Internal constructor

  This is an internal constructor, and should not be used by user code.

- Property
  2.12.0.0
  Gtk.Widget Accesses the one and only child widget of this Bin object. a
- Property
  2.12.0.0
  GLib.GType GType Property. a Returns the native value for .