GtkSharp/gtk/TreeView.custom
Mike Kestner 912980c396 2003-11-04 Mike Kestner <mkestner@ximian.com>
* glib/Value.cs : add set to Val prop
	* glue/Makefile.am : build nodestore.c
	* glue/makefile.win32 : link nodestore.o
	* glue/nodestore.c : new, glue for TreeModel implementation
	* gtk/NodeStore.cs : new tree store implementation
	* gtk/ITreeNode.cs : new interface for nodestore node types
	* gtk/TreeNode.cs : abstract class for deriving nodestore nodes
	* gtk/TreeNodeAttribute.cs : tree node marking attr
	* gtk/TreeNodeValueAttribute.cs : node column marking attr
	* gtk/TreeView.custom : add ctor(NodeStore)

svn path=/trunk/gtk-sharp/; revision=19630
2003-11-04 23:20:15 +00:00

119 lines
3.2 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.
public TreeView (NodeStore store)
{
Raw = gtk_tree_view_new_with_model (store.Handle);
}
[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;
}