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>
* glib/Value.cs (~Value): New destructor to release g_malloc'd space.

View file

@ -121,6 +121,42 @@ namespace GLib {
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")]
static extern void g_object_set_data_full (
@ -179,12 +215,6 @@ void g_object_set_qdata_full (GObject *object,
GDestroyNotify destroy);
gpointer g_object_steal_qdata (GObject *object,
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,
GClosure *closure);
void g_object_run_dispose (GObject *object);

View file

@ -52,6 +52,19 @@ namespace GLib {
_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>
/// Value Constructor
/// </summary>

View file

@ -61,7 +61,6 @@ namespace Gtk {
this.Title = title;
}
/*
/// <summary>
/// AllowGrow Property
/// </summary>
@ -73,11 +72,14 @@ namespace Gtk {
public bool AllowGrow {
get {
Value val = GetProp ("allow-grow");
return (val != 0);
Value val = new Value (
TypeFundamentals.TypeBoolean);
GetProperty ("allow-grow", val);
return ((bool) val);
}
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 {
get {
GValue val = GetProp ("allow-shrink");
return (val != 0);
Value val = new Value (
TypeFundamentals.TypeBoolean);
GetProperty ("allow-shrink", val);
return ((bool) val);
}
set {
SetProp ("allow-shrink", new GValue (value));
Value val = new Value (value);
SetProperty ("allow-shrink", val);
}
}
/*
/// <summary>
/// DefaultSize Property
/// </summary>
@ -117,6 +123,7 @@ namespace Gtk {
SetProp ("default-size", new GValue (value));
}
}
*/
/// <summary>
/// DestroyWithParent Property
@ -129,16 +136,19 @@ namespace Gtk {
public bool DestroyWithParent {
get {
GValue val = GetProp ("allow-grow");
return (val != 0);
Value val = new Value (
TypeFundamentals.TypeBoolean);
GetProperty ("destroy-with-parent", val);
return ((bool) val);
}
set {
SetProp ("allow-grow", new GValue (value));
Value val = new Value (value);
SetProperty ("destroy-with-parent", val);
}
}
/// <summary>
/// IsModal Property
/// Modal Property
/// </summary>
///
/// <remarks>
@ -148,16 +158,19 @@ namespace Gtk {
/// is closed.
/// </remarks>
public bool IsModal {
public bool Modal {
get {
GValue val = GetProp ("allow-grow");
return (val != 0);
Value val = new Value (
TypeFundamentals.TypeBoolean);
GetProperty ("modal", val);
return ((bool) val);
}
set {
SetProp ("allow-grow", new GValue (value));
Value val = new Value (value);
SetProperty ("modal", val);
}
}
*/
/// <summary>
/// Position Property
/// </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>
/// Title Property
/// </summary>
@ -194,6 +229,10 @@ namespace Gtk {
set {
g_object_set (RawObject, "title",
Marshal.StringToHGlobalAnsi (value), new IntPtr (0));
/* FIXME: When the String value setting problem is solved.
Value val = new Value (value);
SetProperty ("title", val);
*/
}
}
}