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

* glib/Object.cs (GetProperty): New, gets props from the raw obj.
	(SetProperty): New, for setting props on the raw obj.
	* glib/Value.cs (type ctor): New needed for get accessors.
	*gtk/Window.cs (AllowGrow): Uncommented and filled out.
	(AllowShrink): Uncommented and filled out.
	(DestroyWithParent): Uncommented and filled out.
	(Modal): Uncommented and filled out.
	(Resizable): Added. All the bool Props work now.

svn path=/trunk/gtk-sharp/; revision=1030
This commit is contained in:
Mike Kestner 2001-09-28 18:23:14 +00:00
parent f193cf3efe
commit e6979f31de
4 changed files with 115 additions and 22 deletions

View File

@ -1,3 +1,14 @@
2001-09-28 Mike Kestner <mkestner@speakeasy.net>
* glib/Object.cs (GetProperty): New, gets props from the raw obj.
(SetProperty): New, for setting props on the raw obj.
* glib/Value.cs (type ctor): New needed for get accessors.
*gtk/Window.cs (AllowGrow): Uncommented and filled out.
(AllowShrink): Uncommented and filled out.
(DestroyWithParent): Uncommented and filled out.
(Modal): Uncommented and filled out.
(Resizable): Added. All the bool Props work now.
2001-09-28 Mike Kestner <mkestner@speakeasy.net> 2001-09-28 Mike Kestner <mkestner@speakeasy.net>
* glib/Value.cs (~Value): New destructor to release g_malloc'd space. * glib/Value.cs (~Value): New destructor to release g_malloc'd space.

View File

@ -121,6 +121,42 @@ namespace GLib {
Data [key] = val; Data [key] = val;
} }
/// <summary>
/// GetProperty Method
/// </summary>
///
/// <remarks>
/// Accesses a raw Object Property.
/// </remarks>
[DllImport("gobject-1.3.dll")]
static extern void g_object_get_property (IntPtr obj,
String name,
IntPtr val);
public void GetProperty (String name, Value val)
{
g_object_get_property (RawObject, name, val.MarshalAs);
}
/// <summary>
/// SetProperty Method
/// </summary>
///
/// <remarks>
/// Changes the value of a raw Object Property.
/// </remarks>
[DllImport("gobject-1.3.dll")]
static extern void g_object_set_property (IntPtr obj,
String name,
IntPtr val);
public void SetProperty (String name, Value val)
{
g_object_set_property (RawObject, name, val.MarshalAs);
}
/* /*
[DllImport("gtk-1.3.dll")] [DllImport("gtk-1.3.dll")]
static extern void g_object_set_data_full ( static extern void g_object_set_data_full (
@ -179,12 +215,6 @@ void g_object_set_qdata_full (GObject *object,
GDestroyNotify destroy); GDestroyNotify destroy);
gpointer g_object_steal_qdata (GObject *object, gpointer g_object_steal_qdata (GObject *object,
GQuark quark); GQuark quark);
void g_object_set_property (GObject *object,
const gchar *property_name,
const GValue *value);
void g_object_get_property (GObject *object,
const gchar *property_name,
GValue *value);
void g_object_watch_closure (GObject *object, void g_object_watch_closure (GObject *object,
GClosure *closure); GClosure *closure);
void g_object_run_dispose (GObject *object); void g_object_run_dispose (GObject *object);

View File

@ -52,6 +52,19 @@ namespace GLib {
_val = g_malloc0 (5 * IntPtr.Size); _val = g_malloc0 (5 * IntPtr.Size);
} }
/// <summary>
/// Value Constructor
/// </summary>
///
/// <remarks>
/// Creates an initialized Value of the specified type.
/// </remarks>
public Value (TypeFundamentals type) : this ()
{
Init (type);
}
/// <summary> /// <summary>
/// Value Constructor /// Value Constructor
/// </summary> /// </summary>

View File

@ -61,7 +61,6 @@ namespace Gtk {
this.Title = title; this.Title = title;
} }
/*
/// <summary> /// <summary>
/// AllowGrow Property /// AllowGrow Property
/// </summary> /// </summary>
@ -73,11 +72,14 @@ namespace Gtk {
public bool AllowGrow { public bool AllowGrow {
get { get {
Value val = GetProp ("allow-grow"); Value val = new Value (
return (val != 0); TypeFundamentals.TypeBoolean);
GetProperty ("allow-grow", val);
return ((bool) val);
} }
set { set {
SetProp ("allow-grow", new GValue (value)); Value val = new Value (value);
SetProperty ("allow-grow", val);
} }
} }
@ -92,14 +94,18 @@ namespace Gtk {
public bool AllowShrink { public bool AllowShrink {
get { get {
GValue val = GetProp ("allow-shrink"); Value val = new Value (
return (val != 0); TypeFundamentals.TypeBoolean);
GetProperty ("allow-shrink", val);
return ((bool) val);
} }
set { set {
SetProp ("allow-shrink", new GValue (value)); Value val = new Value (value);
SetProperty ("allow-shrink", val);
} }
} }
/*
/// <summary> /// <summary>
/// DefaultSize Property /// DefaultSize Property
/// </summary> /// </summary>
@ -117,6 +123,7 @@ namespace Gtk {
SetProp ("default-size", new GValue (value)); SetProp ("default-size", new GValue (value));
} }
} }
*/
/// <summary> /// <summary>
/// DestroyWithParent Property /// DestroyWithParent Property
@ -129,16 +136,19 @@ namespace Gtk {
public bool DestroyWithParent { public bool DestroyWithParent {
get { get {
GValue val = GetProp ("allow-grow"); Value val = new Value (
return (val != 0); TypeFundamentals.TypeBoolean);
GetProperty ("destroy-with-parent", val);
return ((bool) val);
} }
set { set {
SetProp ("allow-grow", new GValue (value)); Value val = new Value (value);
SetProperty ("destroy-with-parent", val);
} }
} }
/// <summary> /// <summary>
/// IsModal Property /// Modal Property
/// </summary> /// </summary>
/// ///
/// <remarks> /// <remarks>
@ -148,16 +158,19 @@ namespace Gtk {
/// is closed. /// is closed.
/// </remarks> /// </remarks>
public bool IsModal { public bool Modal {
get { get {
GValue val = GetProp ("allow-grow"); Value val = new Value (
return (val != 0); TypeFundamentals.TypeBoolean);
GetProperty ("modal", val);
return ((bool) val);
} }
set { set {
SetProp ("allow-grow", new GValue (value)); Value val = new Value (value);
SetProperty ("modal", val);
} }
} }
*/
/// <summary> /// <summary>
/// Position Property /// Position Property
/// </summary> /// </summary>
@ -178,6 +191,28 @@ namespace Gtk {
} }
} }
/// <summary>
/// Resizable Property
/// </summary>
///
/// <remarks>
/// Indicates if the Height and Width of the Window can be
/// altered by the user.
/// </remarks>
public bool Resizable {
get {
Value val = new Value (
TypeFundamentals.TypeBoolean);
GetProperty ("resizable", val);
return ((bool) val);
}
set {
Value val = new Value (value);
SetProperty ("resizable", val);
}
}
/// <summary> /// <summary>
/// Title Property /// Title Property
/// </summary> /// </summary>
@ -194,6 +229,10 @@ namespace Gtk {
set { set {
g_object_set (RawObject, "title", g_object_set (RawObject, "title",
Marshal.StringToHGlobalAnsi (value), new IntPtr (0)); Marshal.StringToHGlobalAnsi (value), new IntPtr (0));
/* FIXME: When the String value setting problem is solved.
Value val = new Value (value);
SetProperty ("title", val);
*/
} }
} }
} }