Ryujinx-GtkSharp/gtk/TreeView.custom
Mike Kestner 23464e6514 2003-07-23 Mike Kestner <mkestner@ximian.com>
[Equal credit to Ettore Perazzoli <ettore@ximian.com> for fixing
	all the bugs in the initial patch]
	* */*.custom : fix incorrect usage of new Object (IntPtr) where
	Glib.Object.GetObject should've been used.  add ref_owned param
	to GetObject calls.
	* generator/CallbackGen.cs : setup ref_owned in bodies
	* generator/ClassBase.cs : add ref_owned to GetObject FromNative call
	* generator/Method.cs : setup ref_owned in bodies
	* generator/Property.cs : setup ref_owned in bodies
	* generator/SignalHandler.cs : pass ref_owned to GetObject
	* generator/StructBase.cs : setup ref_owned in bodies
	* glib/Object.cs : kill Ref/Unref methods.  Don't want it to be
	easy for users to screw with ref counts, or make it look like they
	should need to.
	(GetObject): add ref_owned param and ref/unref to remain at 1
	* glib/Value.cs : pass ref_owned to GetObject

svn path=/trunk/gtk-sharp/; revision=16581
2003-07-23 17:19:21 +00:00

114 lines
3.1 KiB
Plaintext

// Gtk.TreeView.Custom - Gtk TreeView class customizations
//
// Authors:
// Kristian Rietveld <kris@gtk.org>
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (c) 2002 Kristian Rietveld
// (c) 2003 Ximian, Inc. (http://www.ximian.com)
//
// This code is inserted after the automatically generated code.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_get_model (IntPtr raw);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_set_model (IntPtr raw, IntPtr raw_model);
/// <summary>Model Property</summary>
/// <remarks>Gets the model being displayed by the TreeView
/// </remarks>
public Gtk.TreeModel Model {
get {
IntPtr raw_ret = gtk_tree_view_get_model (Handle);
Gtk.TreeModel ret = (Gtk.TreeModel) GLib.Object.GetObject (raw_ret, false);
return ret;
}
set {
gtk_tree_view_set_model (Handle, value.Handle);
}
}
[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,
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,
IntPtr column,
IntPtr cell_x,
IntPtr cell_y);
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, Gtk.TreeViewColumn column, out int cell_x, out int cell_y)
{
IntPtr col;
if (column == null)
col = IntPtr.Zero;
else
col = column.Handle;
IntPtr pathHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos (Handle, x, y, out pathHandle, col, out cell_x, out cell_y);
if (raw_ret)
path = new TreePath (pathHandle);
else
path = null;
return raw_ret;
}
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path)
{
IntPtr pathHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, IntPtr.Zero, 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, Gtk.TreeViewColumn column)
{
if (column == null)
return GetPathAtPos (x, y, out path);
IntPtr pathHandle;
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, column.Handle, IntPtr.Zero, IntPtr.Zero);
if (raw_ret)
path = new TreePath (pathHandle);
else
path = null;
return raw_ret;
}
public Gtk.TreeViewColumn AppendColumn (string title, Gtk.CellRenderer cell, Gtk.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 Gtk.TreeViewColumn AppendColumn (string title, Gtk.CellRenderer cell, params object[] attrs) {
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn (title, cell, attrs);
AppendColumn (col);
return col;
}