mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 22:05:34 +00:00
fb12bb5f61
* 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. svn path=/trunk/gtk-sharp/; revision=39509
183 lines
8.4 KiB
Plaintext
183 lines
8.4 KiB
Plaintext
// Gtk.Toolbar.custom - Gtk Toolbar class customizations
|
|
//
|
|
// Author: Mike Kestner <mkestner@novell.com>
|
|
//
|
|
// 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;
|
|
}
|
|
|