2012-08-05 16:32:41 +02:00
|
|
|
// Gtk.TreeView.cs - Gtk TreeView class customizations
|
2002-08-11 01:40:20 +02:00
|
|
|
//
|
2003-04-16 04:26:12 +02:00
|
|
|
// Authors:
|
|
|
|
// Kristian Rietveld <kris@gtk.org>
|
|
|
|
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
|
2002-08-11 01:40:20 +02:00
|
|
|
//
|
2004-06-25 20:42:19 +02:00
|
|
|
// Copyright (c) 2002 Kristian Rietveld
|
|
|
|
// Copyright (c) 2003 Ximian, Inc. (http://www.ximian.com)
|
2002-08-11 01:40:20 +02:00
|
|
|
//
|
2004-06-25 20:42:19 +02:00
|
|
|
// 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.
|
|
|
|
|
2012-08-05 16:32:41 +02:00
|
|
|
namespace Gtk {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
public partial class TreeView {
|
2002-08-11 01:40:20 +02:00
|
|
|
|
2015-11-10 11:37:34 +01:00
|
|
|
/*
|
2007-04-17 14:16:58 +02:00
|
|
|
public Gdk.Color OddRowColor {
|
|
|
|
get {
|
|
|
|
GLib.Value value = StyleGetPropertyValue ("odd-row-color");
|
|
|
|
Gdk.Color ret = (Gdk.Color)value;
|
|
|
|
value.Dispose ();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Gdk.Color EvenRowColor {
|
|
|
|
get {
|
|
|
|
GLib.Value value = StyleGetPropertyValue ("even-row-color");
|
|
|
|
Gdk.Color ret = (Gdk.Color)value;
|
|
|
|
value.Dispose ();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2015-11-10 11:37:34 +01:00
|
|
|
*/
|
2019-10-02 17:28:33 +02:00
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
2018-01-17 21:31:39 +01:00
|
|
|
delegate bool d_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);
|
2018-01-18 22:54:45 +01:00
|
|
|
static d_gtk_tree_view_get_path_at_pos gtk_tree_view_get_path_at_pos = FuncLoader.LoadFunction<d_gtk_tree_view_get_path_at_pos>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_view_get_path_at_pos"));
|
2019-10-02 17:28:33 +02:00
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
2018-01-19 01:29:05 +01:00
|
|
|
delegate bool d_gtk_tree_view_get_path_at_pos2(IntPtr raw, int x, int y, out IntPtr path, out IntPtr column, IntPtr cell_x, IntPtr cell_y);
|
|
|
|
static d_gtk_tree_view_get_path_at_pos2 gtk_tree_view_get_path_at_pos2 = FuncLoader.LoadFunction<d_gtk_tree_view_get_path_at_pos2>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_view_get_path_at_pos"));
|
2003-04-16 04:26:12 +02:00
|
|
|
|
2004-05-22 10:49:58 +02: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 04:26:12 +02:00
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 10:49:58 +02: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 10:58:21 +02:00
|
|
|
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
|
2005-08-09 16:44:32 +02:00
|
|
|
path = (Gtk.TreePath) GLib.Opaque.GetOpaque (pathHandle, typeof (Gtk.TreePath), true);
|
2004-05-22 10:49:58 +02:00
|
|
|
} else {
|
2003-04-16 04:26:12 +02:00
|
|
|
path = null;
|
2004-05-22 10:49:58 +02:00
|
|
|
column = null;
|
|
|
|
}
|
2003-04-16 04:26:12 +02:00
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path)
|
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 10:49:58 +02:00
|
|
|
IntPtr columnHandle;
|
2018-01-19 01:29:05 +01:00
|
|
|
bool raw_ret = gtk_tree_view_get_path_at_pos2 (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
|
2005-08-09 16:44:32 +02:00
|
|
|
if (raw_ret)
|
|
|
|
path = (Gtk.TreePath) GLib.Opaque.GetOpaque (pathHandle, typeof (Gtk.TreePath), true);
|
|
|
|
else
|
2003-04-16 04:26:12 +02:00
|
|
|
path = null;
|
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
2004-05-22 10:49:58 +02:00
|
|
|
public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column)
|
2003-04-16 04:26:12 +02:00
|
|
|
{
|
|
|
|
IntPtr pathHandle;
|
2004-05-22 10:49:58 +02:00
|
|
|
IntPtr columnHandle;
|
2018-01-19 01:29:05 +01:00
|
|
|
bool raw_ret = gtk_tree_view_get_path_at_pos2 (Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);
|
2004-05-22 10:49:58 +02:00
|
|
|
if (raw_ret) {
|
2005-08-09 16:44:32 +02:00
|
|
|
path = (Gtk.TreePath) GLib.Opaque.GetOpaque (pathHandle, typeof (Gtk.TreePath), true);
|
2004-05-22 10:58:21 +02:00
|
|
|
column = (Gtk.TreeViewColumn) GLib.Object.GetObject (columnHandle, false);
|
2004-05-22 10:49:58 +02:00
|
|
|
} else {
|
2003-04-16 04:26:12 +02:00
|
|
|
path = null;
|
2004-05-22 10:49:58 +02:00
|
|
|
column = null;
|
|
|
|
}
|
2003-04-16 04:26:12 +02:00
|
|
|
|
|
|
|
return raw_ret;
|
|
|
|
}
|
|
|
|
|
2005-01-05 22:59:06 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-01-04 19:54:02 +01:00
|
|
|
public TreeViewColumn AppendColumn (string title, CellRenderer cell, CellLayoutDataFunc cell_data) {
|
2003-05-19 09:18:52 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-01-04 19:54:02 +01:00
|
|
|
public int InsertColumn (int pos, string title, CellRenderer cell, CellLayoutDataFunc cell_data)
|
2004-12-30 17:29:44 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2012-08-05 16:32:41 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-02 17:28:33 +02:00
|
|
|
|