Ryujinx-GtkSharp/gtk/TreeView.custom
Dan Winship a7d8b64f7a * generator/Parameters.cs (Parameters.Validate): If the parameters
end with "callback, gpointer, GDestroyNotify", then mark the
	callback as having "notified" Scope.
	(Parameters.IsHidden): Hide user_data and GDestroyNotify after a
	callback.
	(Parameter.Scope): make this settable
	(Parameter.IsDestroyNotify): new test

	* generator/MethodBody.cs (Initialize): Handle "notified" callback
	scope (using a GCHandle and GLib.DestroyHelper.NotifyHandler)

	* generator/CallbackGen.cs (GenWrapper): Add a static
	"GetManagedDelegate" method to the wrapper type, to translate a
	native delegate back to its corresponding managed delegate.
	(FromNative): use GetManagedDelegate.

	* generator/ReturnValue.cs (Validate): We handle callback return
	values now

	* generator/SymbolTable.cs: marshal GDestroyNotify as
	GLib.DestroyNotify

	* glib/DestroyNotify.cs: Moved from gtk

	* gtk/Gtk.metadata: globally change GtkDestroyNotify to
	GDestroyNotify, but then change back the ones that are exposed in
	the API. Un-hide lots of methods we can correctly autogenerate
	now.

	* gtk/DestroyHelper.cs: moved to glib

	* gtk/*.custom: remove methods that are autogenerated now, add
	Obsolete wrappers where needed, replace Gtk.DestroyHelper usage
	with GLib.DestroyHelper.

	* gdk/Gdk.metadata: 
	* gnome/Gnome.metadata: Turn Gdk.Drawable.SetData and
	Gnome.IconList.SetIconDataFull's GDestroyNotify args into
	gpointers so the generated API stays the same as it used to be.

	* rsvg/Handle.custom: implement deprecated SetSizeCallback

	* sample/GtkDemo/DemoIconView.cs (CreateSort): update for API
	changes

svn path=/trunk/gtk-sharp/; revision=44020
2005-05-04 11:47:25 +00:00

182 lines
5.7 KiB
Plaintext

// Gtk.TreeView.Custom - Gtk TreeView class customizations
//
// Authors:
// Kristian Rietveld <kris@gtk.org>
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// Copyright (c) 2002 Kristian Rietveld
// Copyright (c) 2003 Ximian, Inc. (http://www.ximian.com)
//
// 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.
[Obsolete ("Use NodeView with NodeStores")]
public TreeView (NodeStore store) : base (IntPtr.Zero)
{
if (GetType() != typeof (TreeView)) {
string[] names = new string [1];
GLib.Value[] vals = new GLib.Value [1];
names [0] = "model";
vals [0] = new GLib.Value (store);
CreateNativeObject (names, vals);
vals [0].Dispose ();
return;
}
Raw = gtk_tree_view_new_with_model (store.Handle);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_get_columns (IntPtr raw);
public TreeViewColumn[] Columns {
get {
IntPtr raw_ret = gtk_tree_view_get_columns (Handle);
if (raw_ret == IntPtr.Zero)
return new TreeViewColumn [0];
GLib.List list = new GLib.List (raw_ret);
TreeViewColumn[] result = new TreeViewColumn [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as TreeViewColumn;
return result;
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_tree_view_get_path_at_pos (IntPtr raw,
int x,
int y,
out IntPtr path,
out IntPtr column,
out int cell_x,
out int cell_y);
[DllImport("libgtk-win32-2.0-0.dll", EntryPoint="gtk_tree_view_get_path_at_pos")]
static extern bool gtk_tree_view_get_path_at_pos_intptr (IntPtr raw,
int x,
int y,
out IntPtr path,
out IntPtr column,
IntPtr cell_x,
IntPtr cell_y);
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column, out int cell_x, out int cell_y)
{
IntPtr pathHandle;
IntPtr columnHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos (Handle, x, y, out pathHandle, out columnHandle, out cell_x, out cell_y);
if (raw_ret) {
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
path = new TreePath (pathHandle);
} else {
path = null;
column = null;
}
return raw_ret;
}
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path)
{
IntPtr pathHandle;
IntPtr columnHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
if (raw_ret)
path = new TreePath (pathHandle);
else
path = null;
return raw_ret;
}
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column)
{
IntPtr pathHandle;
IntPtr columnHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
if (raw_ret) {
path = new TreePath (pathHandle);
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
} else {
path = null;
column = null;
}
return raw_ret;
}
public TreeViewColumn AppendColumn (string title, CellRenderer cell, TreeCellDataFunc cell_data)
{
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
col.Title = title;
col.PackStart (cell, true);
col.SetCellDataFunc (cell, cell_data);
AppendColumn (col);
return col;
}
public TreeViewColumn AppendColumn (string title, CellRenderer cell, CellLayoutDataFunc cell_data) {
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
col.Title = title;
col.PackStart (cell, true);
col.SetCellDataFunc (cell, cell_data);
AppendColumn (col);
return col;
}
public Gtk.TreeViewColumn AppendColumn (string title, Gtk.CellRenderer cell, params object[] attrs) {
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn (title, cell, attrs);
AppendColumn (col);
return col;
}
public int InsertColumn (int pos, string title, CellRenderer cell, CellLayoutDataFunc cell_data)
{
TreeViewColumn col = new TreeViewColumn ();
col.Title = title;
col.PackStart (cell, true);
col.SetCellDataFunc (cell, cell_data);
return InsertColumn (col, pos);
}
public int InsertColumn (int pos, string title, CellRenderer cell, params object[] attrs)
{
TreeViewColumn col = new TreeViewColumn (title, cell, attrs);
return InsertColumn (col, pos);
}
[Obsolete ("Replaced by SearchEqualFunc property.")]
public void SetSearchEqualFunc (TreeViewSearchEqualFunc search_equal_func, IntPtr search_user_data, DestroyNotify search_destroy)
{
SearchEqualFunc = search_equal_func;
}
[Obsolete ("Replaced by DestroyCountFunc property.")]
public void SetDestroyCountFunc (TreeDestroyCountFunc func, IntPtr data, DestroyNotify destroy)
{
DestroyCountFunc = func;
}
[Obsolete ("Replaced by ColumnDragFunction property.")]
public void SetColumnDragFunction (TreeViewColumnDropFunc func, IntPtr user_data, DestroyNotify destroy)
{
ColumnDragFunction = func;
}