2003-10-17 22:31:46 +00:00
|
|
|
// Gtk.Object.custom - Gtk Object class customizations
|
2002-09-04 05:25:58 +00:00
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2004-06-25 18:42:19 +00:00
|
|
|
// Copyright (c) 2002-2003 Mike Kestner
|
2002-09-04 05:25:58 +00:00
|
|
|
//
|
|
|
|
// This code is inserted after the automatically generated code.
|
2004-06-25 18:42:19 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the Lesser GNU General
|
|
|
|
// Public License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
2002-09-04 05:25:58 +00:00
|
|
|
|
2004-12-07 19:03:55 +00:00
|
|
|
[DllImport("gtksharpglue-2")]
|
2002-11-10 10:03:51 +00:00
|
|
|
private static extern bool gtksharp_object_is_floating (IntPtr raw);
|
2002-09-12 05:21:16 +00:00
|
|
|
|
2004-12-07 19:03:55 +00:00
|
|
|
[DllImport("gtksharpglue-2")]
|
2004-09-29 18:45:59 +00:00
|
|
|
private static extern bool gtksharp_object_set_floating (IntPtr raw, bool val);
|
|
|
|
|
2003-07-23 17:19:21 +00:00
|
|
|
[DllImport("libgobject-2.0-0.dll")]
|
|
|
|
private static extern void g_object_ref (IntPtr raw);
|
|
|
|
|
2005-05-13 17:38:51 +00:00
|
|
|
static Hashtable managed_subclasses;
|
|
|
|
static Hashtable ManagedSubclasses {
|
|
|
|
get {
|
|
|
|
if (managed_subclasses == null)
|
|
|
|
managed_subclasses = new Hashtable ();
|
|
|
|
return managed_subclasses;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-11 13:12:09 +00:00
|
|
|
static void NativeDestroy (object o, EventArgs args)
|
|
|
|
{
|
2005-05-12 02:49:26 +00:00
|
|
|
Gtk.Object obj = o as Gtk.Object;
|
2005-05-11 13:12:09 +00:00
|
|
|
if (obj == null)
|
|
|
|
return;
|
2005-05-13 17:38:51 +00:00
|
|
|
ManagedSubclasses.Remove (obj);
|
2005-06-02 14:01:04 +00:00
|
|
|
obj.Destroyed -= NativeDestroyHandler;
|
2005-05-11 13:12:09 +00:00
|
|
|
obj.Dispose ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static EventHandler native_destroy_handler;
|
|
|
|
static EventHandler NativeDestroyHandler {
|
|
|
|
get {
|
|
|
|
if (native_destroy_handler == null)
|
|
|
|
native_destroy_handler = new EventHandler (NativeDestroy);
|
|
|
|
return native_destroy_handler;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:38:51 +00:00
|
|
|
protected override void CreateNativeObject (string[] names, GLib.Value[] vals)
|
|
|
|
{
|
|
|
|
base.CreateNativeObject (names, vals);
|
|
|
|
ManagedSubclasses [this] = this;
|
2005-06-02 14:01:04 +00:00
|
|
|
Destroyed += NativeDestroyHandler;
|
2005-05-13 17:38:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void Dispose ()
|
|
|
|
{
|
|
|
|
base.Dispose ();
|
|
|
|
}
|
|
|
|
|
2002-11-10 10:03:51 +00:00
|
|
|
protected override IntPtr Raw {
|
|
|
|
get {
|
|
|
|
return base.Raw;
|
|
|
|
}
|
|
|
|
set {
|
|
|
|
base.Raw = value;
|
2004-04-07 19:15:01 +00:00
|
|
|
if (value == IntPtr.Zero)
|
|
|
|
return;
|
|
|
|
|
2005-04-07 20:05:52 +00:00
|
|
|
g_object_ref (value);
|
|
|
|
Sink ();
|
2002-11-10 10:03:51 +00:00
|
|
|
}
|
2002-09-12 05:21:16 +00:00
|
|
|
}
|
2004-09-29 18:45:59 +00:00
|
|
|
|
2004-12-17 23:21:53 +00:00
|
|
|
[DllImport("libgtk-win32-2.0-0.dll")]
|
|
|
|
private static extern void gtk_object_destroy (IntPtr raw);
|
|
|
|
|
2005-05-12 00:42:21 +00:00
|
|
|
public virtual void Destroy ()
|
|
|
|
{
|
2004-12-17 23:21:53 +00:00
|
|
|
gtk_object_destroy (Handle);
|
|
|
|
}
|
|
|
|
|
2004-09-29 18:45:59 +00:00
|
|
|
public bool IsFloating {
|
|
|
|
get {
|
|
|
|
return gtksharp_object_is_floating (Handle);
|
|
|
|
}
|
|
|
|
set {
|
|
|
|
gtksharp_object_set_floating (Handle, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|