1 // IconView.cs - customizations to Gtk.IconView 2 // 3 // Authors: Mike Kestner <mkestner@ximian.com> 4 // 5 // Copyright (c) 2005 Novell, Inc. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of version 2 of the Lesser GNU General 9 // Public License as published by the Free Software Foundation. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 // Lesser General Public License for more details. 15 // 16 // You should have received a copy of the GNU Lesser General Public 17 // License along with this program; if not, write to the 18 // Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 // Boston, MA 02111-1307, USA. 20 21 namespace Gtk { 22 23 using System; 24 using System.Runtime.InteropServices; 25 26 public partial class IconView { 27 SetAttributes(CellRenderer cell, params object[] attrs)28 public void SetAttributes (CellRenderer cell, params object[] attrs) 29 { 30 if (attrs.Length % 2 != 0) 31 throw new ArgumentException ("attrs should contain pairs of attribute/col"); 32 33 ClearAttributes (cell); 34 for (int i = 0; i < attrs.Length - 1; i += 2) { 35 AddAttribute (cell, (string) attrs [i], (int) attrs [i + 1]); 36 } 37 } 38 39 [DllImport (Global.GtkNativeDll, CallingConvention = CallingConvention.Cdecl)] gtk_icon_view_scroll_to_path(IntPtr raw, IntPtr path, bool use_align, float row_align, float col_align)40 static extern void gtk_icon_view_scroll_to_path(IntPtr raw, IntPtr path, bool use_align, float row_align, float col_align); 41 ScrollToPath(Gtk.TreePath path)42 public void ScrollToPath (Gtk.TreePath path) 43 { 44 gtk_icon_view_scroll_to_path(Handle, path == null ? IntPtr.Zero : path.Handle, false, 0.0f, 0.0f); 45 } 46 ScrollToPath(Gtk.TreePath path, float row_align, float col_align)47 public void ScrollToPath (Gtk.TreePath path, float row_align, float col_align) 48 { 49 gtk_icon_view_scroll_to_path(Handle, path == null ? IntPtr.Zero : path.Handle, true, row_align, col_align); 50 } 51 } 52 } 53