diff --git a/ChangeLog b/ChangeLog index 7106c3714..41483d2f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-01-25 Mike Kestner + + * gtk/Gtk.metadata : hide all the SignalFunc using Toolbar methods. + * gtk/Makefile.am : add the new custom. + * gtk/Toolbar.custom : implement the SignalFunc methods. Deal with + null for Widget params in *Element. + 2005-01-24 Jeroen Zwartepoorte * generator/MethodBody.cs : fix out LPUGen params. diff --git a/doc/en/Gtk/Toolbar.xml b/doc/en/Gtk/Toolbar.xml index 9210ae7db..c8c6a07ca 100644 --- a/doc/en/Gtk/Toolbar.xml +++ b/doc/en/Gtk/Toolbar.xml @@ -104,7 +104,7 @@ The tooltip for the element. Used for context-sensitive help about this toolbar element. The number of widgets to insert this widget after. - Inserts a widget in the toolbar at the given position. + Inserts a widget in the toolbar at the given position. @@ -779,5 +779,29 @@ If type == , widget is used as the n You can cast the returned object to to access its child properties. + + + Method + + Gtk.Widget + + + + + + + + + + Deprecated + a + a + a + a + a + a + Replaced by ToolItem API. + + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index d5b752e2f..1e0934436 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -323,7 +323,13 @@ Toggle 1 Toggle - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 TooltipSet 1 out diff --git a/gtk/Makefile.am b/gtk/Makefile.am index fbc7398dc..080ec1727 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -90,6 +90,7 @@ customs = \ TextIter.custom \ TextTag.custom \ TextView.custom \ + Toolbar.custom \ TreeIter.custom \ TreeModel.custom \ TreeModelFilter.custom \ diff --git a/gtk/Toolbar.custom b/gtk/Toolbar.custom new file mode 100644 index 000000000..f3da000f8 --- /dev/null +++ b/gtk/Toolbar.custom @@ -0,0 +1,182 @@ +// Gtk.Toolbar.custom - Gtk Toolbar class customizations +// +// Author: Mike Kestner +// +// Copyright (C) 2005 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// 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. + + [DllImport("libgobject-2.0-0.dll")] + static extern void g_object_weak_ref (IntPtr raw, WeakNotify cb, IntPtr data); + + delegate void WeakNotify (IntPtr handle, IntPtr obj); + + static void ReleaseDelegateCB (IntPtr handle, IntPtr obj) + { + GCHandle gch = (GCHandle) handle; + gch.Free (); + } + + static WeakNotify on_weak_notify; + static WeakNotify OnWeakNotify { + get { + if (on_weak_notify == null) + on_weak_notify = new WeakNotify (ReleaseDelegateCB); + return on_weak_notify; + } + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_append_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget AppendElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_append_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject (raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_insert_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget InsertElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_insert_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, user_data, position); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject (raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_prepend_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget PrependElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_prepend_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject (raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_append_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget AppendItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_append_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject(raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_insert_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget InsertItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_insert_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, user_data, position); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject(raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_prepend_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget PrependItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_prepend_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject(raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_toolbar_insert_stock (IntPtr raw, string stock_id, string tooltip_text, string tooltip_private_text, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position); + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget InsertStock (string stock_id, string tooltip_text, string tooltip_private_text, Gtk.SignalFunc cb, int position) + { + return InsertStock (stock_id, tooltip_text, tooltip_private_text, cb, IntPtr.Zero, position); + } + + [Obsolete ("Replaced by ToolItem API")] + public Gtk.Widget InsertStock (string stock_id, string tooltip_text, string tooltip_private_text, Gtk.SignalFunc cb, IntPtr user_data, int position) + { + GtkSharp.SignalFuncWrapper cb_wrapper = null; + cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this); + IntPtr raw_ret = gtk_toolbar_insert_stock (Handle, stock_id, tooltip_text, tooltip_private_text, cb_wrapper.NativeDelegate, user_data, position); + Gtk.Widget ret; + if (raw_ret == IntPtr.Zero) + ret = null; + else { + ret = (Gtk.Widget) GLib.Object.GetObject (raw_ret); + g_object_weak_ref (raw_ret, OnWeakNotify, (IntPtr) GCHandle.Alloc (cb_wrapper)); + } + return ret; + } +