1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
/* -*- C -*- */ 
require gtk24; 
class GTK2.TreeModelFilter; 
inherit G.Object; 
inherit GTK2.TreeModel; 
inherit GTK2.TreeDragSource; 
 
//! Properties: 
//! GTK2.TreeModel child-model 
//! GTK2.TreePath virtual-root 
 
void create(GTK2.TreeModel model, ?GTK2.TreePath root) 
//! Create a new GTK2.TreeModel, with model as the child model. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  { 
    struct object *o1,*o2; 
    GtkTreeModel *gtm; 
 
    get_all_args(NULL, args, "%o%o", &o1, &o2); 
    gtm=gtk_tree_model_filter_new(GTK_TREE_MODEL(get_gobject(o1)), 
                                  o2?(GtkTreePath *)get_pg2object(o2,pgtk2_tree_path_program):NULL); 
     THIS->obj=G_OBJECT(gtm); 
  } 
  pgtk2_pop_n_elems(args); 
  pgtk2__init_this_object(); 
} 
 
%{ 
int pgtk2_model_filter_visible_callback(GtkTreeModel *model, 
                                        GtkTreeIter *iter, 
                                        struct signal_data *d) { 
  int res; 
  push_gobject(model); 
  push_gobjectclass(iter,pgtk2_tree_iter_program); 
  push_svalue(&d->args); 
  safe_apply_svalue(&d->cb, 3, 1); 
  res=Pike_sp[-1].u.integer; 
  pop_stack(); 
  return res; 
} 
%} 
 
void set_visible_func(function f, mixed user_data) 
//! Sets the comparison function used when sorting to be f.  If the current 
//! sort column id of this sortable is the same as column, then the model will 
//! sort using this function. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct svalue *sv1,*sv2; 
    struct signal_data *sd; 
 
    get_all_args(NULL,args,"%*%*",&sv1,&sv2); 
    sd=(struct signal_data *)g_malloc(sizeof(struct signal_data)); 
    if (sd==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("set_visible_func",sizeof(struct signal_data)); 
    assign_svalue_no_free(&sd->cb,sv1); 
    assign_svalue_no_free(&sd->args,sv2); 
    gtk_tree_model_filter_set_visible_func( 
                GTK_TREE_MODEL_FILTER(THIS->obj), 
                (GtkTreeModelFilterVisibleFunc)pgtk2_model_filter_visible_callback, 
                sd,(GtkDestroyNotify)pgtk2_free_signal_data); 
  } 
  RETURN_THIS(); 
} 
 
+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; 
 
    get_all_args(NULL,args,"%o",&o1); 
    gtp=gtk_tree_model_filter_convert_child_path_to_path( 
                        GTK_TREE_MODEL_FILTER(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); 
    pgtk2_pop_n_elems(args); 
    push_pgdk2object(gtp,pgtk2_tree_path_program,1); 
  } 
} 
 
+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; 
 
    get_all_args(NULL,args,"%o",&o1); 
    gt2=g_malloc(sizeof(GtkTreeIter)); 
    if (gt2==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("convert_child_iter_to_iter",sizeof(GtkTreeIter 
)); 
    gtk_tree_model_filter_convert_child_iter_to_iter( 
                        GTK_TREE_MODEL_FILTER(THIS->obj),gt2, 
                        (GtkTreeIter *)get_pg2object(o1,pgtk2_tree_iter_program)); 
    pgtk2_pop_n_elems(args); 
    push_pgdk2object(gt2,pgtk2_tree_iter_program,1); 
  } 
} 
 
+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; 
 
    get_all_args(NULL,args,"%o",&o1); 
    gtp=gtk_tree_model_filter_convert_path_to_child_path( 
                        GTK_TREE_MODEL_FILTER(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); 
    pgtk2_pop_n_elems(args); 
    push_pgdk2object(gtp,pgtk2_tree_path_program,1); 
  } 
} 
 
+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; 
 
    get_all_args(NULL,args,"%o",&o1); 
    gt2=g_malloc(sizeof(GtkTreeIter)); 
    if (gt2==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("convert_iter_to_child_iter",sizeof(GtkTreeIter 
)); 
    gtk_tree_model_filter_convert_iter_to_child_iter( 
                        GTK_TREE_MODEL_FILTER(THIS->obj),gt2, 
                        (GtkTreeIter *)get_pg2object(o1,pgtk2_tree_iter_program)); 
    pgtk2_pop_n_elems(args); 
    push_pgdk2object(gt2,pgtk2_tree_iter_program,1); 
  } 
} 
 
void refilter(); 
//! Emits "row-changed" for each row in the child model, which causes the 
//! filter to re-evaluate whether a row is visible or not. 
endrequire;