From 113a9460c428986d625b55c719597539e108db37 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Tue, 15 Mar 2005 17:30:59 +0000 Subject: [PATCH] 2005-03-15 Mike Kestner * gtk/Gtk.metadata : hide TreeSortable.SetSortFunc. * gtk/ListStore.custom : implement SetSortFunc for persistence. * gtk/Makefile.am : add custom file. * gtk/TreeModelSort.custom : implement SetSortFunc for persistence. * gtk/TreeSortable.custom : new file, add hidden method decls. * gtk/TreeStore.custom : implement SetSortFunc for persistence. svn path=/trunk/gtk-sharp/; revision=41845 --- ChangeLog | 9 +++++++++ gtk/Gtk.metadata | 1 + gtk/ListStore.custom | 21 +++++++++++++++++++++ gtk/Makefile.am | 1 + gtk/TreeModelSort.custom | 21 +++++++++++++++++++++ gtk/TreeSortable.custom | 26 ++++++++++++++++++++++++++ gtk/TreeStore.custom | 20 ++++++++++++++++++++ 7 files changed, 99 insertions(+) create mode 100644 gtk/TreeSortable.custom diff --git a/ChangeLog b/ChangeLog index e464a87fc..11d31cd31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-03-15 Mike Kestner + + * gtk/Gtk.metadata : hide TreeSortable.SetSortFunc. + * gtk/ListStore.custom : implement SetSortFunc for persistence. + * gtk/Makefile.am : add custom file. + * gtk/TreeModelSort.custom : implement SetSortFunc for persistence. + * gtk/TreeSortable.custom : new file, add hidden method decls. + * gtk/TreeStore.custom : implement SetSortFunc for persistence. + 2005-03-15 John Luke * glib/Object.cs: use IsDefined to check for ClassInitializer diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index 1a5f951d2..677612941 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -94,6 +94,7 @@ EmitRowInserted EmitRowsReordered 1 + 1 ChangeSortColumn label Activated diff --git a/gtk/ListStore.custom b/gtk/ListStore.custom index 1df78d56e..3eab3b6ec 100644 --- a/gtk/ListStore.custom +++ b/gtk/ListStore.custom @@ -150,6 +150,27 @@ return ret; } + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy); + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy); + + public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy) + { + if (sort_func == null) { + PersistentData ["column_" + sort_column_id + "_sort_func"] = null; + gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + return; + } + + GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func); + PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper; + GtkSharp.DestroyNotifyWrapper destroy_wrapper = null; + destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy); + gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate); + } + [DllImport("libgtk-win32-2.0-0.dll")] static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, IntPtr sort_func, IntPtr user_data, IntPtr destroy); diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 080ec1727..28a7e2733 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -97,6 +97,7 @@ customs = \ TreeModelSort.custom \ TreePath.custom \ TreeSelection.custom \ + TreeSortable.custom \ TreeStore.custom \ TreeViewColumn.custom \ TreeView.custom \ diff --git a/gtk/TreeModelSort.custom b/gtk/TreeModelSort.custom index ba9c182e5..e7d8ef1aa 100644 --- a/gtk/TreeModelSort.custom +++ b/gtk/TreeModelSort.custom @@ -106,3 +106,24 @@ gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate); } + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy); + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy); + + public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy) + { + if (sort_func == null) { + PersistentData ["column_" + sort_column_id + "_sort_func"] = null; + gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + return; + } + + GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func); + PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper; + GtkSharp.DestroyNotifyWrapper destroy_wrapper = null; + destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy); + gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate); + } + diff --git a/gtk/TreeSortable.custom b/gtk/TreeSortable.custom new file mode 100644 index 000000000..4cc6c4d78 --- /dev/null +++ b/gtk/TreeSortable.custom @@ -0,0 +1,26 @@ +// Gtk.TreeSortable.Custom - Gtk TreeSortable interface customizations +// +// Author: Mike Kestner +// +// Copyright (c) 2005 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// 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. + + void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy); + + void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy); + diff --git a/gtk/TreeStore.custom b/gtk/TreeStore.custom index 3671d2ec7..d26c1a50e 100644 --- a/gtk/TreeStore.custom +++ b/gtk/TreeStore.custom @@ -214,4 +214,24 @@ gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate); } + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy); + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy); + + public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy) + { + if (sort_func == null) { + PersistentData ["column_" + sort_column_id + "_sort_func"] = null; + gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + return; + } + + GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func); + PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper; + GtkSharp.DestroyNotifyWrapper destroy_wrapper = null; + destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy); + gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate); + }