GtkSharp/gtk/Container.cs
Mike Kestner aa1077bbb1 2001-10-07 Mike Kestner <mkestner@speakeasy.net>
* glib/Object.cs : Added public Handle property.  It would be nice
	if I could make the RawObject public for get and protected for set,
	but that doesn't appear to be possible with C# properties.
	* gtk/Container.cs : New class with 2 of the 3 props and the Add/Remove
	methods only implemented.
	* gtk/Widget.cs : Added SizeRequest prop which is a combination of
	HeightRequest and SizeRequest. Embrace and extend gtk...
	* gtk/Window.cs : Derive from newly added Container subclass.
	* sample/ButtonApp.cs : Simple tire-kicking app.

svn path=/trunk/gtk-sharp/; revision=1112
2001-10-07 00:41:52 +00:00

100 lines
1.9 KiB
C#

// Gtk.Container.cs - GtkContainer class wrapper implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace Gtk {
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Container Class
/// </summary>
///
/// <remarks>
/// Abstract class which provides the capability to embed a
/// widget within its boundaries.
/// </remarks>
public abstract class Container : Widget {
/// <summary>
/// BorderWidth Property
/// </summary>
///
/// <remarks>
/// The Width, in pixels, of the border around the
/// Container.
/// </remarks>
public int BorderWidth {
get {
int val;
GetProperty ("border-width", out val);
return val;
}
set {
SetProperty ("border-width", value);
}
}
// FIXME: Implement Child property.
/// <summary>
/// ResizeMode Property
/// </summary>
///
/// <remarks>
/// Indicates the resizing policy for the Container.
/// </remarks>
public ResizeMode ResizeMode {
get {
int val;
GetProperty ("border-width", out val);
return (ResizeMode) val;
}
set {
SetProperty ("border-width", (int) value);
}
}
/// <summary>
/// Add Method
/// </summary>
///
/// <remarks>
/// Adds a child Widget to the Container.
/// </remarks>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void gtk_container_add (IntPtr obj, IntPtr child);
public void Add (Widget child)
{
gtk_container_add (Handle, child.Handle);
}
/// <summary>
/// Remove Method
/// </summary>
///
/// <remarks>
/// Remove a child Widget from the Container.
/// </remarks>
[DllImport("gtk-1.3.dll", CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.Cdecl)]
static extern void gtk_container_remove (IntPtr obj,
IntPtr child);
public void Remove (Widget child)
{
gtk_container_remove (Handle, child.Handle);
}
}
}