2002-08-10 23:40:20 +00:00
|
|
|
// Gtk.TreeView.Custom - Gtk TreeView class customizations
|
|
|
|
//
|
2003-04-16 02:26:12 +00:00
|
|
|
// Authors:
|
|
|
|
// Kristian Rietveld <kris@gtk.org>
|
|
|
|
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
|
2002-08-10 23:40:20 +00:00
|
|
|
//
|
|
|
|
// (c) 2002 Kristian Rietveld
|
2003-04-16 02:26:12 +00:00
|
|
|
// (c) 2003 Ximian, Inc. (http://www.ximian.com)
|
2002-08-10 23:40:20 +00:00
|
|
|
//
|
|
|
|
// This code is inserted after the automatically generated code.
|
|
|
|
|
|
|
|
|
2004-04-07 19:15:01 +00:00
|
|
|
public TreeView (NodeStore store) : base (IntPtr.Zero)
|
2003-11-04 23:20:15 +00:00
|
|
|
{
|
2004-05-07 20:23:58 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2003-11-04 23:20:15 +00:00
|
|
|
Raw = gtk_tree_view_new_with_model (store.Handle);
|
|
|
|
}
|
|
|
|
|
2004-02-11 21:34:32 +00:00
|
|
|
[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)
|
2004-02-11 21:58:47 +00:00
|
|
|
return new TreeViewColumn [0];
|
2004-02-11 22:23:11 +00:00
|
|
|
GLib.List list = new GLib.List (raw_ret);
|
2004-02-11 21:34:32 +00:00
|
|
|
TreeViewColumn[] result = new TreeViewColumn [list.Count];
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
result [i] = list [i] as TreeViewColumn;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-22 04:34:56 +00:00
|
|
|
[DllImport("libgtk-win32-2.0-0.dll")]
|
2002-08-10 23:40:20 +00:00
|
|
|
static extern IntPtr gtk_tree_view_get_model (IntPtr raw);
|
|
|
|
|
2003-02-22 04:34:56 +00:00
|
|
|
[DllImport("libgtk-win32-2.0-0.dll")]
|
2002-10-04 16:38:47 +00:00
|
|
|
static extern IntPtr gtk_tree_view_set_model (IntPtr raw, IntPtr raw_model);
|
2002-09-21 21:06:22 +00:00
|
|
|
|
2002-08-10 23:40:20 +00:00
|
|
|
public Gtk.TreeModel Model {
|
|
|
|
get {
|
|
|
|
IntPtr raw_ret = gtk_tree_view_get_model (Handle);
|
2003-07-23 17:19:21 +00:00
|
|
|
Gtk.TreeModel ret = (Gtk.TreeModel) GLib.Object.GetObject (raw_ret, false);
|
2002-08-10 23:40:20 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2002-09-21 21:06:22 +00:00
|
|
|
|
|
|
|
set {
|
2002-10-04 16:38:47 +00:00
|
|
|
gtk_tree_view_set_model (Handle, value.Handle);
|
2002-09-21 21:06:22 +00:00
|
|
|
}
|
2002-08-10 23:40:20 +00:00
|
|
|
}
|
2003-04-16 02:26:12 +00:00
|
|
|
|
|
|
|
[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,
|
2004-05-22 08:49:58 +00:00
|
|
|
out IntPtr column,
|
2003-04-16 02:26:12 +00:00
|
|
|
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,
|
2004-05-22 08:49:58 +00:00
|
|
|
out IntPtr column,
|
2003-04-16 02:26:12 +00:00
|
|
|
IntPtr cell_x,
|
|
|
|
IntPtr cell_y);
|
|
|
|
|
2004-05-22 08:49:58 +00:00
|
|
|
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column, out int cell_x, out int cell_y)
|
2003-04-16 02:26:12 +00:00
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 08:49:58 +00:00
|
|
|
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) {
|
2004-05-22 08:58:21 +00:00
|
|
|
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
|
2003-04-16 02:26:12 +00:00
|
|
|
path = new TreePath (pathHandle);
|
2004-05-22 08:49:58 +00:00
|
|
|
} else {
|
2003-04-16 02:26:12 +00:00
|
|
|
path = null;
|
2004-05-22 08:49:58 +00:00
|
|
|
column = null;
|
|
|
|
}
|
2003-04-16 02:26:12 +00:00
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path)
|
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 08:49:58 +00:00
|
|
|
IntPtr columnHandle;
|
|
|
|
bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
|
2003-04-16 02:26:12 +00:00
|
|
|
if (raw_ret)
|
|
|
|
path = new TreePath (pathHandle);
|
|
|
|
else
|
|
|
|
path = null;
|
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
2004-05-22 08:49:58 +00:00
|
|
|
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column)
|
2003-04-16 02:26:12 +00:00
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 08:49:58 +00:00
|
|
|
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) {
|
2003-04-16 02:26:12 +00:00
|
|
|
path = new TreePath (pathHandle);
|
2004-05-22 08:58:21 +00:00
|
|
|
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
|
2004-05-22 08:49:58 +00:00
|
|
|
} else {
|
2003-04-16 02:26:12 +00:00
|
|
|
path = null;
|
2004-05-22 08:49:58 +00:00
|
|
|
column = null;
|
|
|
|
}
|
2003-04-16 02:26:12 +00:00
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
2003-05-19 07:18:52 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|