f284492006-08-03Lance Dillon /* -*- C -*- */ class GTK2.TreeModelSort; inherit G.Object; inherit GTK2.TreeModel; inherit GTK2.TreeDragSource; inherit GTK2.TreeSortable; //! Properties: //! GTK2.TreeModel model void create(GTK2.TreeModel model) //! Create a new GTK2.TreeModel, with model as the child model. { pgtk2_verify_not_inited(); pgtk2_verify_setup(); { struct object *o1; GtkTreeModel *gtm;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  gtm=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(get_gobject(o1))); THIS->obj=G_OBJECT(gtm); } pgtk2_pop_n_elems(args); pgtk2__init_this_object(); } +GTK2.TreeModel get_model(); //! Return the model this ModelSort is sorting. +GTK2.TreePath convert_child_path_to_path(GTK2.TreePath child_path) //! Converts child_path to a path relative to this model. That is, //! child_path points to a path in the child mode. The returned path will //! point to the same row in the sorted model. { pgtk2_verify_inited(); { struct object *o1; GtkTreePath *gtp;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  gtp=gtk_tree_model_sort_convert_child_path_to_path( GTK_TREE_MODEL_SORT(THIS->obj), (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); pgtk2_pop_n_elems(args);
f439a12008-04-11Per Hedbor  push_pgdk2object(gtp,pgtk2_tree_path_program,1);
f284492006-08-03Lance Dillon  } } +GTK2.TreeIter convert_child_iter_to_iter(GTK2.TreeIter child_iter) //! Returns an iter pointing to the row in this model that corresponds //! to the row pointed at by child_iter. { pgtk2_verify_inited(); { struct object *o1; GtkTreeIter *gti,*gt2;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  gt2=g_malloc(sizeof(GtkTreeIter)); if (gt2==NULL) SIMPLE_OUT_OF_MEMORY_ERROR("convert_child_iter_to_iter",sizeof(GtkTreeIter)); gtk_tree_model_sort_convert_child_iter_to_iter( GTK_TREE_MODEL_SORT(THIS->obj),gt2, (GtkTreeIter *)get_pg2object(o1,pgtk2_tree_iter_program)); pgtk2_pop_n_elems(args);
2fa8a62008-04-11Per Hedbor  push_pgdk2object(gt2,pgtk2_tree_iter_program,1);
f284492006-08-03Lance Dillon  } } +GTK2.TreePath convert_path_to_child_path(GTK2.TreePath sorted_path) //! Converts sorted_path to a path on the child model. { pgtk2_verify_inited(); { struct object *o1; GtkTreePath *gtp;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  gtp=gtk_tree_model_sort_convert_path_to_child_path( GTK_TREE_MODEL_SORT(THIS->obj), (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); pgtk2_pop_n_elems(args);
f439a12008-04-11Per Hedbor  push_pgdk2object(gtp,pgtk2_tree_path_program,1);
f284492006-08-03Lance Dillon  } } +GTK2.TreeIter convert_iter_to_child_iter(GTK2.TreeIter sorted_iter) //! Returns an iter pointing to the row in this model that corresponds //! to the row pointed at by sorted_iter. { pgtk2_verify_inited(); { struct object *o1; GtkTreeIter *gti,*gt2;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  gt2=g_malloc(sizeof(GtkTreeIter)); if (gt2==NULL) SIMPLE_OUT_OF_MEMORY_ERROR("convert_iter_to_child_iter",sizeof(GtkTreeIter)); gtk_tree_model_sort_convert_iter_to_child_iter( GTK_TREE_MODEL_SORT(THIS->obj),gt2, (GtkTreeIter *)get_pg2object(o1,pgtk2_tree_iter_program)); pgtk2_pop_n_elems(args);
2fa8a62008-04-11Per Hedbor  push_pgdk2object(gt2,pgtk2_tree_iter_program,1);
f284492006-08-03Lance Dillon  } } void reset_default_sort_func(); //! This resets the default sort function to be in the 'unsorted' state. //! That is, it is in the same order as the child model. It will re-sort the //! model to be in the same order as the child model only if this model //! is in 'unsorted' state.