Add GtkSortableIface stubs

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2007-07-09 13:23:22 +00:00
parent 033bf67c3c
commit 773cca4887

View File

@ -33,6 +33,7 @@
#include <gobject/gvaluecollector.h> #include <gobject/gvaluecollector.h>
#include <gtk/gtktreemodel.h> #include <gtk/gtktreemodel.h>
#include <gtk/gtktreesortable.h>
#include <gtk/gtktreednd.h> #include <gtk/gtktreednd.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
@ -74,6 +75,10 @@ struct _GtkWxTreeModel
/*< private >*/ /*< private >*/
gint stamp; gint stamp;
wxDataViewModel *model; wxDataViewModel *model;
gint sort_column_id;
GtkSortType order;
GtkTreeIterCompareFunc default_sort_func;
}; };
struct _GtkWxTreeModelClass struct _GtkWxTreeModelClass
@ -82,9 +87,10 @@ struct _GtkWxTreeModelClass
}; };
static GtkWxTreeModel *wxgtk_tree_model_new (void); static GtkWxTreeModel *wxgtk_tree_model_new (void);
static void wxgtk_tree_model_init (GtkWxTreeModel *tree_model); static void wxgtk_tree_model_init (GtkWxTreeModel *tree_model);
static void wxgtk_tree_model_class_init (GtkWxTreeModelClass *klass); static void wxgtk_tree_model_class_init (GtkWxTreeModelClass *klass);
static void wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface); static void wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface);
static void wxgtk_tree_model_sortable_init (GtkTreeSortableIface *iface);
static void wxgtk_tree_model_finalize (GObject *object); static void wxgtk_tree_model_finalize (GObject *object);
static GtkTreeModelFlags wxgtk_tree_model_get_flags (GtkTreeModel *tree_model); static GtkTreeModelFlags wxgtk_tree_model_get_flags (GtkTreeModel *tree_model);
static gint wxgtk_tree_model_get_n_columns (GtkTreeModel *tree_model); static gint wxgtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
@ -116,6 +122,26 @@ static gboolean wxgtk_tree_model_iter_parent (GtkTreeModel *tree_mo
GtkTreeIter *iter, GtkTreeIter *iter,
GtkTreeIter *child); GtkTreeIter *child);
/* sortable */
static gboolean wxgtk_tree_model_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id,
GtkSortType *order);
static void wxgtk_tree_model_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id,
GtkSortType order);
static void wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id,
GtkTreeIterCompareFunc func,
gpointer data,
GtkDestroyNotify destroy);
static void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
GtkTreeIterCompareFunc func,
gpointer data,
GtkDestroyNotify destroy);
static gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable);
static GObjectClass *list_parent_class = NULL; static GObjectClass *list_parent_class = NULL;
GType GType
@ -138,22 +164,32 @@ gtk_wx_tree_model_get_type (void)
(GInstanceInitFunc) wxgtk_tree_model_init, (GInstanceInitFunc) wxgtk_tree_model_init,
}; };
static const GInterfaceInfo tree_model_iface_info = static const GInterfaceInfo tree_model_iface_info =
{ {
(GInterfaceInitFunc) wxgtk_tree_model_tree_model_init, (GInterfaceInitFunc) wxgtk_tree_model_tree_model_init,
NULL, NULL,
NULL NULL
}; };
tree_model_type = g_type_register_static (G_TYPE_OBJECT, "GtkWxTreeModel", static const GInterfaceInfo sortable_iface_info =
{
(GInterfaceInitFunc) wxgtk_tree_model_sortable_init,
NULL,
NULL
};
tree_model_type = g_type_register_static (G_TYPE_OBJECT, "GtkWxTreeModel",
&tree_model_info, (GTypeFlags)0 ); &tree_model_info, (GTypeFlags)0 );
g_type_add_interface_static (tree_model_type, g_type_add_interface_static (tree_model_type,
GTK_TYPE_TREE_MODEL, GTK_TYPE_TREE_MODEL,
&tree_model_iface_info); &tree_model_iface_info);
g_type_add_interface_static (tree_model_type,
GTK_TYPE_TREE_SORTABLE,
&sortable_iface_info);
} }
return tree_model_type; return tree_model_type;
} }
static GtkWxTreeModel * static GtkWxTreeModel *
@ -188,11 +224,24 @@ wxgtk_tree_model_tree_model_init (GtkTreeModelIface *iface)
iface->iter_parent = wxgtk_tree_model_iter_parent; iface->iter_parent = wxgtk_tree_model_iter_parent;
} }
static void
wxgtk_tree_model_sortable_init (GtkTreeSortableIface *iface)
{
iface->get_sort_column_id = wxgtk_tree_model_get_sort_column_id;
iface->set_sort_column_id = wxgtk_tree_model_set_sort_column_id;
iface->set_sort_func = wxgtk_tree_model_set_sort_func;
iface->set_default_sort_func = wxgtk_tree_model_set_default_sort_func;
iface->has_default_sort_func = wxgtk_tree_model_has_default_sort_func;
}
static void static void
wxgtk_tree_model_init (GtkWxTreeModel *tree_model) wxgtk_tree_model_init (GtkWxTreeModel *tree_model)
{ {
tree_model->model = NULL; tree_model->model = NULL;
tree_model->stamp = g_random_int(); tree_model->stamp = g_random_int();
tree_model->sort_column_id = -2;
tree_model->order = GTK_SORT_ASCENDING;
tree_model->default_sort_func = NULL;
} }
static void static void
@ -489,6 +538,40 @@ wxgtk_tree_model_iter_parent (GtkTreeModel *tree_model,
return TRUE; return TRUE;
} }
/* sortable */
gboolean wxgtk_tree_model_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id,
GtkSortType *order)
{
return FALSE;
}
void wxgtk_tree_model_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id,
GtkSortType order)
{
}
void wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id,
GtkTreeIterCompareFunc func,
gpointer data,
GtkDestroyNotify destroy)
{
}
void wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable,
GtkTreeIterCompareFunc func,
gpointer data,
GtkDestroyNotify destroy)
{
}
gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable *sortable)
{
return FALSE;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// define new GTK+ class wxGtkRendererRenderer // define new GTK+ class wxGtkRendererRenderer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------