2001-09-29 Mike Kestner <mkestner@speakeasy.net>

* glib/Value.cs (int ctor): New constructor for int-based values.
	(int exp cast): New explicit cast operator for Val to int conversion.
	* gtk/Window.cs (DefaultHeight): New prop.
	(DefaultWidth): New prop.

svn path=/trunk/gtk-sharp/; revision=1034
This commit is contained in:
Mike Kestner 2001-09-29 20:08:30 +00:00
parent e6979f31de
commit 14cf53f336
3 changed files with 86 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2001-09-29 Mike Kestner <mkestner@speakeasy.net>
* glib/Value.cs (int ctor): New constructor for int-based values.
(int exp cast): New explicit cast operator for Val to int conversion.
* gtk/Window.cs (DefaultHeight): New prop.
(DefaultWidth): New prop.
2001-09-28 Mike Kestner <mkestner@speakeasy.net>
* glib/Object.cs (GetProperty): New, gets props from the raw obj.

View File

@ -82,6 +82,23 @@ namespace GLib {
g_value_set_boolean (_val, val);
}
/// <summary>
/// Value Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Value from a specified integer.
/// </remarks>
[DllImport("gobject-1.3.dll")]
static extern void g_value_set_int (IntPtr val, int data);
public Value (int val) : this ()
{
g_value_init (_val, TypeFundamentals.TypeInt);
g_value_set_int (_val, val);
}
/// <summary>
/// Value Constructor
/// </summary>
@ -136,6 +153,26 @@ namespace GLib {
return g_value_get_boolean (val._val);
}
/// <summary>
/// Value to Integer Conversion
/// </summary>
///
/// <remarks>
/// Extracts an int from a Value. Note, this method
/// will produce an exception if the Value does not hold a
/// integer value.
/// </remarks>
[DllImport("gobject-1.3.dll")]
static extern int g_value_get_int (IntPtr val);
public static explicit operator int (Value val)
{
// FIXME: Insert an appropriate exception here if
// _val.type indicates an error.
return g_value_get_int (val._val);
}
/// <summary>
/// Value to String Conversion
/// </summary>

View File

@ -105,6 +105,27 @@ namespace Gtk {
}
}
/// <summary>
/// DefaultHeight Property
/// </summary>
///
/// <remarks>
/// The default Height of the Window in Pixels.
/// </remarks>
public int DefaultHeight {
get {
Value val = new Value (
TypeFundamentals.TypeInt);
GetProperty ("default-height", val);
return ((int) val);
}
set {
Value val = new Value (value);
SetProperty ("default-height", val);
}
}
/*
/// <summary>
/// DefaultSize Property
@ -124,6 +145,27 @@ namespace Gtk {
}
}
*/
/// <summary>
/// DefaultWidth Property
/// </summary>
///
/// <remarks>
/// The default Width of the Window in Pixels.
/// </remarks>
public int DefaultWidth {
get {
Value val = new Value (
TypeFundamentals.TypeInt);
GetProperty ("default-width", val);
return ((int) val);
}
set {
Value val = new Value (value);
SetProperty ("default-width", val);
}
}
/// <summary>
/// DestroyWithParent Property