diff --git a/ChangeLog b/ChangeLog index 13715d0cf..a1ee6dd6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-09-29 Mike Kestner + + * 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 * glib/Object.cs (GetProperty): New, gets props from the raw obj. diff --git a/glib/Value.cs b/glib/Value.cs index bc5303b58..b2e6d3a80 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -82,6 +82,23 @@ namespace GLib { g_value_set_boolean (_val, val); } + /// + /// Value Constructor + /// + /// + /// + /// Constructs a Value from a specified integer. + /// + + [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); + } + /// /// Value Constructor /// @@ -136,6 +153,26 @@ namespace GLib { return g_value_get_boolean (val._val); } + /// + /// Value to Integer Conversion + /// + /// + /// + /// Extracts an int from a Value. Note, this method + /// will produce an exception if the Value does not hold a + /// integer value. + /// + + [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); + } + /// /// Value to String Conversion /// diff --git a/gtk/Window.cs b/gtk/Window.cs index bb81e3675..f55363c5f 100755 --- a/gtk/Window.cs +++ b/gtk/Window.cs @@ -105,6 +105,27 @@ namespace Gtk { } } + /// + /// DefaultHeight Property + /// + /// + /// + /// The default Height of the Window in Pixels. + /// + + 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); + } + } + /* /// /// DefaultSize Property @@ -124,6 +145,27 @@ namespace Gtk { } } */ + /// + /// DefaultWidth Property + /// + /// + /// + /// The default Width of the Window in Pixels. + /// + + 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); + } + } + /// /// DestroyWithParent Property