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
  
/* -*- C -*- */ 
class GTK2.TreeSortable; 
mixin_for G.Object; 
 
//! The interface for sortable models used by TreeView. 
 
signal sort_column_changed; 
 
void sort_column_changed(); 
//! Emits a "sort-column-changed" signal 
 
mapping(string:int) get_sort_column_id() 
//! Returns ([ "column": int, "order": int ]) 
{ 
  pgtk2_verify_inited(); 
  { 
    int col; 
    GtkSortType order; 
    int res=gtk_tree_sortable_get_sort_column_id( 
                        GTK_TREE_SORTABLE(THIS->obj),&col,&order); 
    pgtk2_pop_n_elems(args); 
    ref_push_string(_STR("column")); PGTK_PUSH_INT(col); 
    ref_push_string(_STR("order")); PGTK_PUSH_INT(order); 
    f_aggregate_mapping(4); 
  } 
} 
 
void set_sort_column_id(int column, int order); 
//! Sets the current sort column to be column.  The widget will resort itself 
//! to reflect this change, after emitting a "sort-column-changed" signal. 
//! If column is GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the default 
//! sort function will be used, if it is set. 
 
void set_sort_func(int column, 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; 
    INT_TYPE col; 
    struct signal_data *sd; 
 
    get_all_args(NULL,args,"%i%*%*",&col,&sv1,&sv2); 
    sd=(struct signal_data *)g_malloc(sizeof(struct signal_data)); 
    if (sd==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("set_sort_func",sizeof(struct signal_data)); 
    assign_svalue_no_free(&sd->cb,sv1); 
    assign_svalue_no_free(&sd->args,sv2); 
    gtk_tree_sortable_set_sort_func( 
                        GTK_TREE_SORTABLE(THIS->obj),col, 
                        (GtkTreeIterCompareFunc)pgtk2_tree_sortable_callback,sd, 
                        (GtkDestroyNotify)pgtk2_free_signal_data); 
/* 
    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(THIS->obj),col, 
                        (GtkTreeIterCompareFunc)pgtk2_signal_func_wrapper,sd, 
                        (GtkDestroyNotify)pgtk2_free_signal_data); 
*/ 
  } 
  RETURN_THIS(); 
} 
 
void set_default_sort_func(function f, mixed user_data) 
//! Sets the default comparison function used when sorting to be f.  If the 
//! current sort column id of this sortable is  
//! GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using 
//! this function. 
//! <p> 
//! if f is 0, then there will be no default comparison function.  This means 
//! once the model has been sorted, it can't go back to the default state.  In 
//! this case, when the current sort column id of this sortable is 
//! GTK2.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. 
{ 
  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_default_sort_func",sizeof(struct signal_data)); 
    assign_svalue_no_free(&sd->cb,sv1); 
    assign_svalue_no_free(&sd->args,sv2); 
    gtk_tree_sortable_set_default_sort_func( 
                        GTK_TREE_SORTABLE(THIS->obj), 
                        (GtkTreeIterCompareFunc)pgtk2_tree_sortable_callback,sd, 
                        (GtkDestroyNotify)pgtk2_free_signal_data); 
  } 
  RETURN_THIS(); 
} 
 
int has_default_sort_func(); 
//! Returns true if the model has a default sort function.