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
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
238
  
239
  
240
  
241
  
242
  
243
  
244
  
245
  
246
  
247
  
248
  
249
  
250
  
251
  
252
  
253
  
254
  
255
  
256
  
257
  
258
  
259
  
260
  
261
  
262
  
263
  
264
  
265
  
266
  
267
  
268
  
269
  
270
  
271
  
272
  
273
  
274
  
275
  
276
  
277
  
278
  
279
  
280
  
281
  
282
  
283
  
284
  
285
  
286
  
287
  
288
  
289
  
290
  
291
  
292
  
293
  
294
  
295
  
296
  
297
  
298
  
299
  
300
  
301
  
302
  
303
  
304
  
305
  
306
  
307
  
308
  
309
  
310
  
311
  
312
  
313
  
314
  
315
  
316
  
317
  
318
  
319
  
320
  
321
  
322
  
323
  
324
  
325
  
326
  
327
  
328
  
329
  
330
  
331
  
332
  
333
  
334
  
335
  
336
  
337
  
338
  
339
  
340
  
341
  
342
  
343
  
344
  
345
  
346
  
347
  
348
  
349
  
350
  
351
  
352
  
353
  
354
  
355
  
356
  
357
  
358
  
359
  
360
  
361
  
362
  
363
  
364
  
365
  
366
  
367
  
368
  
369
  
370
  
371
  
372
  
373
  
374
  
375
  
376
  
377
  
378
  
379
  
380
  
381
  
382
  
383
  
384
  
385
  
386
  
387
  
388
  
389
  
390
  
391
  
392
  
393
  
394
  
395
  
396
  
397
  
398
  
399
  
400
  
401
  
402
  
403
  
404
  
405
  
406
  
407
  
408
  
409
  
410
  
411
  
412
  
413
  
414
  
415
  
416
  
417
  
418
  
419
  
420
  
421
  
422
  
423
  
424
  
425
  
426
  
427
  
428
  
429
  
430
  
431
  
432
  
433
  
434
  
435
  
436
  
437
  
438
  
439
  
440
  
441
  
442
  
443
  
444
  
445
  
446
  
447
  
448
  
449
  
450
  
451
  
452
  
453
  
454
  
455
  
456
  
457
  
458
  
459
  
460
  
461
  
462
  
463
  
464
  
465
  
466
  
467
  
468
  
469
  
470
  
471
  
472
  
473
  
474
  
475
  
476
  
477
  
478
  
479
  
480
  
481
  
482
  
483
  
484
  
485
  
486
  
487
  
488
  
489
  
490
  
491
  
492
  
493
  
494
  
495
  
496
  
497
  
498
  
499
  
500
  
501
  
502
  
503
  
504
  
505
  
506
  
507
  
508
  
509
  
510
  
511
  
512
  
513
  
514
  
515
  
516
  
517
  
518
  
519
  
520
  
521
  
522
  
523
  
524
  
525
  
526
  
527
  
528
  
529
  
530
  
531
  
532
  
533
  
534
  
535
  
536
  
537
  
538
  
539
  
540
  
541
  
542
  
543
  
544
  
545
  
546
  
547
  
548
  
549
  
550
  
551
  
552
  
553
  
554
  
555
  
556
  
557
  
558
  
559
  
560
  
561
  
562
  
563
  
564
  
565
  
566
  
567
  
568
  
569
  
570
  
571
  
572
  
573
  
574
  
575
  
576
  
577
  
578
  
579
  
580
  
581
  
582
  
583
  
584
  
585
  
586
  
587
  
588
  
589
  
590
  
591
  
592
  
593
  
594
  
595
  
596
  
597
  
598
  
599
  
600
  
601
  
602
  
603
  
604
  
605
  
606
  
607
  
608
  
609
  
610
  
611
  
612
  
613
  
614
  
615
  
616
  
617
  
618
  
619
  
620
  
621
  
622
  
623
  
624
  
625
  
626
  
627
  
628
  
629
  
630
  
631
  
632
  
633
  
634
  
635
  
636
  
637
  
638
  
639
  
640
  
641
  
642
  
643
  
644
  
645
  
646
  
647
  
648
  
649
  
650
  
651
  
652
  
653
  
654
  
655
  
656
  
657
  
658
  
659
  
660
  
661
  
662
  
663
  
664
  
665
  
666
  
667
  
668
  
669
  
670
  
671
  
672
  
673
  
674
  
675
  
676
  
677
  
678
  
679
  
680
  
681
  
682
  
683
  
684
  
685
  
686
  
687
  
688
  
689
  
690
  
691
  
692
  
693
  
694
  
695
  
696
  
697
  
698
  
699
  
700
  
701
  
702
  
703
  
704
  
705
  
706
  
707
  
708
  
709
  
710
  
711
  
712
  
713
  
714
  
715
  
716
  
717
  
718
  
719
  
720
  
721
  
722
  
723
  
724
  
725
  
726
  
727
  
728
  
729
  
730
  
731
  
732
  
733
  
734
  
735
  
736
  
737
  
738
  
739
  
740
  
741
  
742
  
743
  
744
  
745
  
746
  
747
  
748
  
749
  
750
  
751
  
752
  
753
  
754
  
755
  
756
  
757
  
758
  
759
  
760
  
761
  
762
  
763
  
764
  
765
  
766
  
767
  
768
  
769
  
770
  
771
  
772
  
773
  
774
  
775
  
776
  
777
  
778
  
779
  
780
  
781
  
782
  
783
  
784
  
785
  
786
  
787
  
788
  
789
  
790
  
791
  
792
  
793
  
794
  
795
  
796
  
797
  
798
  
799
  
800
  
801
  
802
  
803
  
804
  
805
  
806
  
807
  
808
  
809
  
810
  
811
  
812
  
813
  
814
  
815
  
816
  
817
  
818
  
819
  
820
  
821
  
822
  
823
  
824
  
825
  
826
  
827
  
828
  
829
  
830
  
831
  
832
  
833
  
834
  
835
  
836
  
837
  
838
  
839
  
840
  
841
  
842
  
843
  
844
  
845
  
846
  
847
  
848
  
849
  
850
  
851
  
852
  
853
  
854
  
855
  
856
  
857
  
858
  
859
  
860
  
861
  
862
  
863
  
864
  
865
  
866
  
867
  
868
  
869
  
870
  
871
  
872
  
873
  
874
  
875
  
876
  
877
  
878
  
879
  
880
  
881
  
882
  
883
  
884
  
885
  
886
  
887
  
888
  
889
  
890
  
891
  
892
  
893
  
894
  
895
  
896
  
897
  
898
  
899
  
900
  
901
  
902
  
903
  
904
  
905
  
906
  
907
  
908
  
909
  
910
  
911
  
912
  
913
  
914
  
915
  
916
  
917
  
918
  
919
  
920
  
921
  
922
  
923
  
924
  
925
  
926
  
927
  
928
  
929
  
/* -*- C -*- */ 
class GTK2.TreeView; 
inherit GTK2.Container; 
 
//! Properties: 
//! int enable-search 
//! GTK2.TreeViewColumn expander-column 
require gtk24; 
//! int fixed-height-mode 
endrequire; 
//! GTK2.Adjustment hadjustment 
//! int headers-clickable 
//! int headers-visible 
require gtk26; 
//! int hover-expand 
//! int hover-selection 
endrequire; 
require gtk212; 
//! int level-indentation 
endrequire; 
//! GTK2.TreeModel model 
//! int reorderable 
//! int rules-hint 
//! int search-column 
require gtk212; 
//! int show-expanders 
endrequire; 
//! GTK2.Adjustment vadjustment 
//! <p> 
//! Style properties: 
//! int allow-rules 
//! GDK2.Color even-row-color 
//! int expander-size 
//! int horizontal-separator 
//! int indent-expanders 
//! GDK2.Color odd-row-color 
//! int vertical-separator 
 
signal columns_changed; 
signal cursor_changed; 
signal expand_collapse_cursor_row; 
signal move_cursor; 
signal row_activated; 
signal row_collapsed; 
signal row_expanded; 
signal select_all; 
signal select_cursor_parent; 
signal select_cursor_row; 
signal set_scroll_adjustments; 
signal start_interactive_search; 
signal test_collapse_row; 
signal test_expand_row; 
signal toggle_cursor_row; 
signal unselect_all; 
 
void create(GTK2.TreeModel|mapping(string:mixed)|void model_or_props) 
//! Create a new W(TreeView), with or without a default model. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  if (args) { 
    if (TYPEOF(Pike_sp[-args]) == PIKE_T_OBJECT) { 
      struct object *o1; 
      GtkTreeModel *gtm; 
      GtkWidget *gt; 
      get_all_args(NULL,args,"%o",&o1); 
      gtm=GTK_TREE_MODEL(get_gobject(o1)); 
      if (gtm) { 
        gt=gtk_tree_view_new_with_model(gtm); 
      } else { 
        gt=gtk_tree_view_new(); 
      } 
      THIS->obj=G_OBJECT(gt); 
    } else { 
      INIT_WITH_PROPS(GTK_TYPE_TREE_VIEW); 
    } 
    pgtk2_pop_n_elems(args); 
  } else { 
    GtkWidget *gt; 
    gt=gtk_tree_view_new(); 
    THIS->obj=G_OBJECT(gt); 
  } 
  pgtk2__init_this_object(); 
} 
 
require gtk212; 
int get_level_indentation(); 
//! Returns the amount, in pixels, of extra indentation for child levels 
 
int get_show_expanders(); 
//! Returns whether or not expanders are drawn 
 
void set_show_expanders(int show); 
//! Sets whether to draw and enable expanders and indent child rows. 
endrequire; 
 
+GTK2.TreeModel get_model(); 
//! Returns the model this TreeView is based on. 
 
+GTK2.TreeView set_model(GTK2.TreeModel model) 
//! Sets the model.  If this TreeView already has a model set, it will remove 
//! it before setting the new model. 
{ 
  pgtk2_verify_inited(); 
  if (args) { 
    struct object *o1; 
    get_all_args(NULL,args,"%o",&o1); 
    gtk_tree_view_set_model(GTK_TREE_VIEW(THIS->obj), 
                GTK_TREE_MODEL(get_gobject(o1))); 
  } else { 
    gtk_tree_view_set_model(GTK_TREE_VIEW(THIS->obj),NULL); 
  } 
  RETURN_THIS(); 
} 
 
+GTK2.TreeSelection get_selection(); 
//! Gets the W(TreeSelection) associated with this TreeView. 
 
+GTK2.Adjustment get_hadjustment(); 
//! Gets the W(Adjustment) currently being used for the horizontal aspect. 
 
void set_hadjustment(GTK2.Adjustment hadj); 
//! Sets the W(Adjustment) for the current horizontal aspect. 
 
+GTK2.Adjustment get_vadjustment(); 
//! Gets the W(Adjustment) currently being used for the vertical aspect. 
 
void set_vadjustment(GTK2.Adjustment vadj); 
//! Sets the W(Adjustment) for the current vertical aspect. 
 
int get_headers_visible(); 
//! Returns true if the headers are visible. 
 
void set_headers_visible(int headers_visible); 
//! Sets the visibility state of the headers. 
 
void columns_autosize(); 
//! Resizes all columns to their optimal width.  Only works after the treeview 
//! has been realized. 
 
require gtk210; 
int get_headers_clickable(); 
//! Returns whether all header columns are clickable. 
endrequire; 
 
void set_headers_clickable(int setting); 
//! Allow the column title buttons to be clicked. 
 
void set_rules_hint(int setting); 
//! This function tells GTK2+ that the user interface for your application 
//! requires users to read across tree rows and associate cells with one 
//! another.  By default, GTK2+ will then render the tree with alternating row 
//! colors.  Do not use it just because you prefer the appearance of the 
//! ruled tree; that's a question for the theme.  Some themes will draw tree 
//! rows in alternating colors even when rules are turned off, and users who 
//! prefer that appearance all the time can choose those themes.  You should 
//! call this function only as a semantic hint to the theme engine that your 
//! tree makes alternating colors usefull from a functional standpoint 
//! (since it has lots of columns, generally). 
 
int get_rules_hint(); 
//! Gets the setting set by set_rules_hint(). 
 
void append_column(GTK2.TreeViewColumn column); 
//! Appends column to the list of columns.  If this tree view has 
//! "fixed_height" mode enabled, then column must have its "sizing" property 
//! set to be GTK2.TREE_VIEW_COLUMN_FIXED. 
 
int remove_column(GTK2.TreeViewColumn column); 
//! Removes column. 
 
int insert_column(GTK2.TreeViewColumn column, int position); 
//! This inserts the column at position.  If position is -1, then the column 
//! is inserted at the end.  If this tree view has "fixed_height" mode 
//! enabled, then column must have its "sizing property set to 
//! GTK2.TREE_VIEW_COLUMN_FIXED. 
 
GTK2.TreeViewColumn get_column(int n); 
//! Gets the W(TreeViewColumn) at the given position. 
 
array(GTK2.TreeViewColumn) get_columns() 
//! Returns an array of all the W(TreeViewColumn)'s current in the view. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GList *gl,*g2; 
    int i=0; 
    gl=g2=gtk_tree_view_get_columns(GTK_TREE_VIEW(THIS->obj)); 
    while (g2) { 
      push_gobject(GTK_TREE_VIEW_COLUMN(g2->data)); 
      g_object_ref(GTK_TREE_VIEW_COLUMN(g2->data)); 
      i++; 
      g2=g_list_next(g2); 
    } 
    f_aggregate(i); 
    g_list_free(gl); 
  } 
} 
 
void move_column_after(GTK2.TreeViewColumn column, ?GTK2.TreeViewColumn base); 
//! Moves column to be after base.  If base is omitted, then column is 
//! placed in the first position. 
 
void set_expander_column(?GTK2.TreeViewColumn column); 
//! Sets the column to draw the expander arrow at.  It must be in the view. 
//! If column is omitted, then the expander arrow is always at the first 
//! visible column. 
 
+GTK2.TreeViewColumn get_expander_column(); 
//! Returns the column that is the current expander column.  This column has 
//! the expander arrow drawn next to it. 
 
void scroll_to_point(int x, int y); 
//! Scrolls the tree view such that the top-left corner of the visible area 
//! is x,y, where x and y are specified in tree window coordinates.  The view 
//! must be realized before this function is called.  If it isn't, you  
//! probably want to be using scroll_to_cell(). 
//! <p> 
//! If either x or y are -1, then that direction isn't scrolled. 
 
void scroll_to_cell(GTK2.TreePath path, ?GTK2.TreeViewColumn column, 
                    ?float row_align, ?float col_align) 
//! Moves the alignments of the view to the position specified by column and 
//! path.  If column is 0, then no horizontal scrolling occurs.  Likewise, if 
//! path is 0, no vertical scrolling occurs.  At a minimum, one of column or  
//! path needs to be non-zero.  row_align determines where the row is placed, 
//! and col_align determines where column is placed.  Both are expected to be 
//! between 0.0 and 1.0.  0.0 means left/top alignment, 1.0 means right/bottom 
//! alignment, 0.5 means center. 
//! <p> 
//! If row_align exists, then col_align must exist, otherwise neither will be 
//! used.  If neither are used, the tree does the minimum amount of work to 
//! scroll the cell onto the screen.  This means that the cell will be scrolled 
//! to the edge closest to its current position.  If the cell is currently 
//! visible on the screen, nothing is done. 
//! <p> 
//! This function only works if the model is set, and path is a valid row on 
//! the model.  If the model changes before the view is realized, the centered 
//! path will be modifed to reflect this change. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1,*o2=0; 
    FLOAT_TYPE row_align=0,col_align=0; 
    get_all_args(NULL,args,"%o.%O%f%f",&o1,&o2, 
                        &row_align,&col_align); 
    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                        o2 ? GTK_TREE_VIEW_COLUMN(get_gobject(o2)) : 0, 
                        1,row_align,col_align); 
  } 
  RETURN_THIS(); 
} 
 
void set_cursor(GTK2.TreePath path, ?GTK2.TreeViewColumn focus_column, 
                ?int start_editing) 
//! Sets the current keyboard focus to be at path, and selects it.  This is 
//! useful when you want to focus the user's attention on a particular row. 
//! If focus_column is present, then focus is given to the column specified by 
//! it.  Additionally, if focus_column is specified, and start_editing is 
//! true, then editing should be started in the specified cell.  This function 
//! is often followed by grab_focus() in order to give keyboard focus to the 
//! widget.  Please note that editing can only happen when the widget is  
//! realized. 
{ 
  struct object *o1,*o2=NULL; 
  INT_TYPE ed=0; 
 
  pgtk2_verify_inited(); 
 
  get_all_args(NULL,args,"%o.%o%i",&o1,&o2,&ed); 
  gtk_tree_view_set_cursor(GTK_TREE_VIEW(THIS->obj), 
                           (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                           GTK_TREE_VIEW_COLUMN(get_gobject(o2)),ed); 
  RETURN_THIS(); 
} 
 
require gtk22; 
void set_cursor_on_cell(GTK2.TreePath path, ?GTK2.TreeViewColumn focus_column, 
                        ?int start_editing, ?GTK2.CellRenderer focus_cell) 
//! Sets the current keyboard focus to be at path, and selects it.  This is 
//! useful when you want to focus the user's attention on a particular row. 
//! If focus_column is present, then focus is given to the column specified by 
//! it.  If focus_column and focus_cell are present, and focus_column contains 
//! 2 or more editable or activatable cells, then focus is given to the cell 
//! specified by focus_cell.  Additionally, if focus_column is specified, and 
//! start_editing is true, then editing should be started in the specified 
//! cell.  This function is often followed by grab_focus() in order to give 
//! keyboard focus to the widget.  Please note that editing can only happen 
//! when the widget is realized. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1,*o2=NULL,*o3=NULL; 
    INT_TYPE ed=0; 
    get_all_args(NULL,args,"%o.%o%i%o",&o1,&o2,&ed,&o3); 
    gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                        GTK_TREE_VIEW_COLUMN(get_gobject(o2)), 
                        GTK_CELL_RENDERER(get_gobject(o3)),ed); 
  } 
  RETURN_THIS(); 
} 
endrequire; 
 
mapping(string:object) get_cursor() 
//! Returns the current path and focus column.  If the cursor isn't currently 
//! set, then "path" will be 0.  If no column currently has focus, then 
//! "focus_column" will be 0. 
//! Returns ([ "path": GTK2.TreePath, "column": GTK2.TreeViewColumn ]); 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreePath *path; 
    GtkTreeViewColumn *col; 
    gtk_tree_view_get_cursor(GTK_TREE_VIEW(THIS->obj),&path,&col); 
    ref_push_string(_STR("path"));push_pgdk2object((GtkTreePath *)path,pgtk2_tree_path_program,1); 
 
    ref_push_string(_STR("column")); push_gobject(col); 
    f_aggregate_mapping(4); 
  } 
} 
 
void row_activated(GTK2.TreePath path, GTK2.TreeViewColumn column) 
//! Activates the cell determined by path and column. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1,*o2; 
    get_all_args(NULL,args,"%o%o",&o1,&o2); 
    gtk_tree_view_row_activated(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                        GTK_TREE_VIEW_COLUMN(get_gobject(o2))); 
  } 
  RETURN_THIS(); 
} 
 
void expand_all(); 
//! Recursively expands all nodes. 
 
void collapse_all(); 
//! Recursively collapses all visible, expanded nodes. 
 
require gtk22; 
void expand_to_path(GTK2.TreePath path) 
//! Expands the row at path.  This will also expand all parent rows of path as 
//! necessary. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    get_all_args(NULL,args,"%o",&o1); 
    gtk_tree_view_expand_to_path(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); 
  } 
  RETURN_THIS(); 
} 
endrequire; 
 
int expand_row(GTK2.TreePath path, int open_all) 
//! Opens the row so its children are visible. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    INT_TYPE op; 
    get_all_args(NULL,args,"%o%i",&o1,&op); 
    gtk_tree_view_expand_row(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program),op); 
  } 
  RETURN_THIS(); 
} 
 
int collapse_row(GTK2.TreePath path) 
//! Collapses a row (hides its child rows, if they exist). 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    get_all_args(NULL,args,"%o",&o1); 
    gtk_tree_view_collapse_row(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); 
  } 
  RETURN_THIS(); 
} 
 
int row_expanded(GTK2.TreePath path) 
//! Returns true if the node pointed to by path is expanded. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    int res; 
    get_all_args(NULL,args,"%o",&o1); 
    res=gtk_tree_view_row_expanded(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program)); 
    pgtk2_pop_n_elems(args); 
    PGTK_PUSH_INT(res); 
  } 
} 
 
void set_reorderable(int reorderable); 
//! This function is a convenience function to allow you to reorder models. 
//! If reorderable is true, then the user can reorder the model by dragging 
//! and dropping rows.  The developer can listen to these changes by connecting 
//! to the model's "row-inserted" and "row-deleted" signals. 
//! <p> 
//! This function does not give you any degree of control over the order -- 
//! any reordering is allowed.  If more control is needed, you should probably 
//! handle drag and drop manually. 
 
int get_reorderable(); 
//! Retrieves whether the user can reorder the tree via drag-and-drop. 
 
mapping get_path_at_pos(int x, int y) 
//! Finds the path at the point (x,y) relative to widget coordinates.  That 
//! is, x and y are relative to an events coordinates.  x and y must come from 
//! an event on the view only where event->window==get_bin().  It is primarily 
//! for things like popup menus.  Returns GTK2.TreePath, GTK2.TreeViewColumn, 
//! and cell_x and cell_y, which are the coordinates relative to the cell 
//! background (i.e. the background_area passed to GTK2.CellRenderer->render()). 
//! This function is only meaningful if the widget is realized. 
{ 
  pgtk2_verify_inited(); 
  { 
    INT_TYPE x,y; 
    GtkTreePath *path; 
    GtkTreeViewColumn *col; 
    gint cell_x,cell_y; 
    int res; 
    get_all_args(NULL,args,"%i%i",&x,&y); 
    pgtk2_pop_n_elems(args); 
    res=gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(THIS->obj), 
                        x,y,&path,&col,&cell_x,&cell_y); 
    ref_push_string(_STR("path")); 
    if (res) 
      push_pgdk2object(path,pgtk2_tree_path_program,1); 
    else 
      push_int(0); 
    ref_push_string(_STR("column")); 
    if (res) 
      push_gobject(col); 
    else 
      push_int(0); 
    ref_push_string(_STR("cell_x")); 
    push_int(res?cell_x:0); 
    ref_push_string(_STR("cell_y")); 
    push_int(res?cell_y:0); 
    f_aggregate_mapping(8); 
  } 
} 
 
+GDK2.Rectangle get_cell_area(?GTK2.TreePath path, ?GTK2.TreeViewColumn column) 
//! Fills the bounding rectangle in tree window coordinates for the cell at 
//! the row specified by path and the column specified by column.  If path is 
//! omitted or 0, or points to a path not currently displayed, the y and 
//! height fields of the rectangle will be 0.  If column is omitted, the x and 
//! width fields will be o.  The sum of all cell rects does not cover the 
//! entire tree; there are extra pixels in between rows, for example.  The 
//! returned rectangle is equivalent to the cell_area passed to 
//! GTK2.CellRenderer->render().  This function is only valid if the view is 
//! realized. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1,*o2=NULL; 
    GdkRectangle *rect; 
    get_all_args(NULL,args,"%o.%o",&o1,&o2); 
    rect=(GdkRectangle *)g_malloc(sizeof(GdkRectangle)); 
    if (rect==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("get_cell_area",sizeof(GdkRectangle)); 
    gtk_tree_view_get_cell_area(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                        GTK_TREE_VIEW_COLUMN(get_gobject(o2)), 
                        rect); 
    pgtk2_pop_n_elems(args); 
    push_gdkobject(rect,rectangle,1); 
  } 
} 
 
+GDK2.Rectangle get_background_area(?GTK2.TreePath path, 
                                ?GTK2.TreeViewColumn column) 
//! Similar to get_cell_area().  The returned rectangle is equivalent to the 
//! background_area passed to GTK2.CellRenderer->render().  These background 
//! area tiles to cover the entire tree window (except for the area used for 
//! header buttons).  Contrast with get_cell_area(), which returns only the 
//! cell itself, excluding surrounding borders and the tree expander area. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1,*o2=NULL; 
    GdkRectangle *rect; 
    get_all_args(NULL,args,"%o.%o",&o1,&o2); 
    rect=(GdkRectangle *)g_malloc(sizeof(GdkRectangle)); 
    if (rect==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("get_background_area",sizeof(GdkRectangle)); 
    gtk_tree_view_get_background_area(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreePath *)get_pg2object(o1,pgtk2_tree_path_program), 
                        GTK_TREE_VIEW_COLUMN(get_gobject(o2)), 
                        rect); 
    pgtk2_pop_n_elems(args); 
    push_gdkobject(rect,rectangle,1); 
  } 
} 
 
+GDK2.Rectangle get_visible_rect() 
//! Returns a GDK2.Rectangle with the currently-visible region of the buffer, 
//! in tree coordinates.  Conver to widget coordinates with  
//! tree_to_widget_coords().  Tree coordinates start at 0,0 for row 0 of the 
//! tree, and cover the entire scrollable area of the tree. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GdkRectangle *gr; 
    pgtk2_pop_n_elems(args); 
    gr=g_malloc(sizeof(GdkRectangle)); 
    if (gr==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("get_visible_rect",sizeof(GdkRectangle)); 
    gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(THIS->obj),gr); 
    push_gdkobject(gr,rectangle,1); 
  } 
} 
 
require gtk28; 
array get_visible_range() 
//! Returns the first and last visible path.  Note that there may be invisible 
//! paths in between. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreePath *s,*e; 
    int res; 
    res=gtk_tree_view_get_visible_range(GTK_TREE_VIEW(THIS->obj),&s,&e); 
    if (res) { 
      push_pgdk2object(s,pgtk2_tree_path_program,1); 
      push_pgdk2object(e,pgtk2_tree_path_program,1); 
      f_aggregate(2); 
    } else 
      ref_push_array(&empty_array); 
  } 
} 
endrequire; 
 
+GDK2.Window get_bin_window(); 
//! Returns the window that this view renders to.  This is used primarily to 
//! compare to event->window to confirm that the event on this view is on the 
//! right window. 
 
not gtk212; 
mapping widget_to_tree_coords(int wx, int wy) 
//! converts widget coordinates to coordinates for the tree window (the full 
//! scrollable area of the tree). 
{ 
  pgtk2_verify_inited(); 
  { 
    gint tx,ty; 
    INT_TYPE wx,wy; 
    get_all_args(NULL,args,"%i%i",&wx,&wy); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_widget_to_tree_coords(GTK_TREE_VIEW(THIS->obj),wx,wy,&tx,&ty); 
    ref_push_string(_STR("x")); push_int(tx); 
    ref_push_string(_STR("y")); push_int(ty); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping tree_to_widget_coords(int tx, int ty) 
//! Converts tree coordinates (coordinates in full scrollable area of the tree) 
//! to widget coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint wx,wy; 
    INT_TYPE tx,ty; 
    get_all_args(NULL,args,"%i%i",&tx,&ty); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_tree_to_widget_coords(GTK_TREE_VIEW(THIS->obj),tx,ty,&wx,&wy); 
    ref_push_string(_STR("x")); push_int(wx); 
    ref_push_string(_STR("y")); push_int(wy); 
    f_aggregate_mapping(4); 
  } 
} 
endnot; 
 
require gtk212; 
mapping convert_bin_window_to_tree_coords(int bx, int by) 
//! Convert bin_window coordinates to tree coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint tx,ty; 
    INT_TYPE bx,by; 
    get_all_args(NULL,args,"%i%i",&bx,&by); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_bin_window_to_tree_coords(GTK_TREE_VIEW(THIS->obj), 
                        bx,by,&tx,&ty); 
    ref_push_string(_STR("x")); push_int(tx); 
    ref_push_string(_STR("y")); push_int(ty); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping convert_bin_window_to_widget_coords(int bx, int by) 
//! Convert bin_window coordinates to widget coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint wx,wy; 
    INT_TYPE bx,by; 
    get_all_args(NULL,args,"%i%i",&bx,&by); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_bin_window_to_widget_coords(GTK_TREE_VIEW(THIS->obj), 
                        bx,by,&wx,&wy); 
    ref_push_string(_STR("x")); push_int(wx); 
    ref_push_string(_STR("y")); push_int(wy); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping convert_tree_to_bin_window_coords(int tx, int ty) 
//! Converts tree coordinates (coordinates in full scrollable area of the tree) to 
//! bin_window coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint bx,by; 
    INT_TYPE tx,ty; 
    get_all_args(NULL,args,"%i%i",&tx,&ty); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_tree_to_bin_window_coords(GTK_TREE_VIEW(THIS->obj), 
                        tx,ty,&bx,&by); 
    ref_push_string(_STR("x")); push_int(bx); 
    ref_push_string(_STR("y")); push_int(by); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping convert_tree_to_widget_coords(int tx, int ty) 
//! Convert tree coordinates to widget coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint wx,wy; 
    INT_TYPE tx,ty; 
    get_all_args(NULL,args,"%i%i",&tx,&ty); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_tree_to_widget_coords(GTK_TREE_VIEW(THIS->obj), 
                        tx,ty,&wx,&wy); 
    ref_push_string(_STR("x")); push_int(wx); 
    ref_push_string(_STR("y")); push_int(wy); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping convert_widget_to_bin_window_coords(int wx, int wy) 
//! Convert widget coordinates to bin_window coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint bx,by; 
    INT_TYPE wx,wy; 
    get_all_args(NULL,args,"%i%i",&wx,&wy); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(THIS->obj), 
                        wx,wy,&bx,&by); 
    ref_push_string(_STR("x")); push_int(bx); 
    ref_push_string(_STR("y")); push_int(by); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping convert_widget_to_tree_coords(int wx, int wy) 
//! Convert widget coordinates to tree coordinates. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint tx,ty; 
    INT_TYPE wx,wy; 
    get_all_args(NULL,args,"%i%i",&wx,&wy); 
    pgtk2_pop_n_elems(args); 
    gtk_tree_view_convert_widget_to_tree_coords(GTK_TREE_VIEW(THIS->obj), 
                        wx,wy,&tx,&ty); 
    ref_push_string(_STR("x")); push_int(tx); 
    ref_push_string(_STR("y")); push_int(ty); 
    f_aggregate_mapping(4); 
  } 
} 
 
endrequire; 
 
%{ 
/* Borrow code from gtkwidget.pre */ 
int _decode_targets(struct array *targ, GtkTargetEntry *drag_targets); 
 
/* Simplify the code by allowing the same form of cast */ 
#define GTK_TREE_PATH(object) ((GtkTreePath *)object) 
%} 
 
void enable_model_drag_source(int start_button_mask,  
                array(array) targets, int actions) 
//! Turns the view into a drag source for automatic DND. 
//! See also: @[drag_source_set] 
{ 
  pgtk2_verify_inited(); 
  { 
    INT_TYPE btn, act; 
    struct array *targ; 
    GtkTargetEntry drag_targets[10]; 
 
    get_all_args(NULL, args, "%d%a%d", &btn, &targ, &act); 
    if (targ->size > 10 || _decode_targets(targ, drag_targets)) 
      SIMPLE_ARG_TYPE_ERROR("enable_model_drag_source", 2, "array(array(string|int))"); 
    gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(THIS->obj), btn, 
      drag_targets, targ->size, act); 
  } 
  RETURN_THIS(); 
} 
 
void enable_model_drag_dest(array(array) targets, int actions) 
//! Turns the view into a drop destination for automatic DND. 
//! See also: @[drag_dest_set], @[drag_source_set] 
{ 
  pgtk2_verify_inited(); 
  { 
    INT_TYPE flags, act; 
    struct array *targ; 
    GtkTargetEntry drag_targets[10]; 
 
    get_all_args(NULL, args, "%a%d", &targ, &act); 
    if (targ->size > 10 || _decode_targets(targ, drag_targets)) 
      SIMPLE_ARG_TYPE_ERROR("enable_model_drag_dest", 2, "array(array(string|int))"); 
    gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(THIS->obj), 
      drag_targets, targ->size, act); 
  } 
  RETURN_THIS(); 
} 
 
void unset_rows_drag_source(); 
//! Undoes the effect of enable_model_drag_source(). 
 
void unset_rows_drag_dest(); 
//! Undoes the effect of enable_model_drag_dest(). 
 
void set_drag_dest_row(GTK2.TreePath path, int pos); 
//! Sets the row that is highlighted for feedback. pos is one of the four 
//! constants GTK2.TREE_VIEW_DROP_[INTO_OR_]{BEFORE,AFTER}. 
 
mapping(string:mixed) get_drag_dest_row() 
//! Gets information about the row that is highlighted for feedback. 
//! Returns ([ "path": GTK2.TreePath, "pos": int ]); 
//! pos will be one of GTK2.TREE_VIEW_DROP_[INTO_OR_]{BEFORE,AFTER}. 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreePath *path; 
    GtkTreeViewDropPosition pos; 
    gtk_tree_view_get_drag_dest_row(GTK_TREE_VIEW(THIS->obj),&path,&pos); 
    ref_push_string(_STR("path"));push_pgdk2object((GtkTreePath *)path,pgtk2_tree_path_program,1); 
    ref_push_string(_STR("pos")); push_int(pos); 
    f_aggregate_mapping(4); 
  } 
} 
 
mapping(string:mixed) get_dest_row_at_pos(int drag_x, int drag_y) 
//! Determines the destination row for a given position. 
//! Returns ([ "path": GTK2.TreePath, "pos": int ]) if there is such 
//! a row, or 0 if not. 
//! pos will be one of GTK2.TREE_VIEW_DROP_[INTO_OR_]{BEFORE,AFTER}. 
{ 
  pgtk2_verify_inited(); 
  { 
    GtkTreePath *path; 
    INT_TYPE drag_x, drag_y; 
    GtkTreeViewDropPosition pos; 
    get_all_args(NULL, args, "%d%d", &drag_x, &drag_y); 
    if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(THIS->obj), 
        drag_x, drag_y, &path, &pos)) 
    { 
      ref_push_string(_STR("path"));push_pgdk2object((GtkTreePath *)path,pgtk2_tree_path_program,1); 
      ref_push_string(_STR("pos")); push_int(pos); 
      f_aggregate_mapping(4); 
    } else { 
      push_int(0); 
    } 
  } 
} 
 
+GDK2.Pixmap create_row_drag_icon(GTK2.TreePath path); 
//! Creates a GDK2.Pixmap representation of the row at path.  This image is 
//! used for a drag icon. 
 
void set_enable_search(int enable_search); 
//! If enable_search is set, then the user can type in text to search through 
//! the tree interactively (this is sometimes called "typeahead find"). 
//! <p> 
//! Note that even if this is false, the user can still initiate a search 
//! using the "start-interactive-search" key binding. 
 
int get_enable_search(); 
//! Returns whether or not the tree allows to start interactive searching by 
//! typing in text. 
 
int get_search_column(); 
//! Gets the column searched on by the interactive search code. 
 
void set_search_column(int column); 
//! Sets column as the column where the interactive search code should search 
//! in. 
//! <p> 
//! If the sort column is set, users can use the "start-interactive-search" 
//! key binding to bring up search popup.  The enable-search property controls 
//! whether simply typing text will also start an interactive search. 
//! <p> 
//! Note that column refers to a column of the model. 
 
require gtk210; 
+GTK2.Entry get_search_entry(); 
//! Returns the GTK2.Entry which is currently in use as interactive search 
//! entry.  In case the built-in entry is being used, 0 will be returned. 
 
void set_search_entry(?GTK2.Entry entry); 
//! Sets the entry which the interactive search code will use.  This is useful 
//! when you want to provide a search entry in your interface at all times 
//! at a fixed position.  Passing 0 will make the interactive search code 
//! use the built-in popup entry again. 
 
require gtk26; 
int get_fixed_height_mode(); 
//! Returns whether fixed height mode is turned on. 
 
void set_fixed_height_mode(int enable); 
//! Enables or disables the fixed height mode.  Fixed height mode speeds up 
//! W(TreeView) by assuming that all rows have the same height.  Only enable 
//! this option if all rows are the same height and all columns are of type 
//! GTK2.TREE_VIEW_COLUMN_FIXED. 
 
int get_hover_selection(); 
//! Returns whether hover selection mode is turned on. 
 
void set_hover_selection(int hover); 
//! Enables or disables the hover selection mode.  Hover selection makes the 
//! selected row follow the pointer.  Currently, this works only for the 
//! selection modes GTK2.SELECTION_SINGLE and GTK2.SELECTION_BROWSE. 
 
int get_hover_expand(); 
//! Returns whether hover expansion mode is turned on. 
 
void set_hover_expand(int expand); 
//! Enables or disables the hover expansion mode.  Hover expansion makes rows 
//! expand or collapse if the pointer moves over them. 
 
void set_row_separator_func(function(GTK2.TreeModel, GTK2.TreeIter, mixed : int) f, mixed user_data ) 
//! Sets the row separator function, which is used to determine whether a 
//! row should be drawn as a separator.  If the row separator function is 0 
//! no separators are drawn.  This is the default value. 
{ 
  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_row_separator_func",sizeof(struct signal_data) 
); 
    assign_svalue_no_free(&sd->cb,sv1); 
    assign_svalue_no_free(&sd->args,sv2); 
    gtk_tree_view_set_row_separator_func(GTK_TREE_VIEW(THIS->obj), 
                        (GtkTreeViewRowSeparatorFunc)pgtk2_tree_view_row_separator_func, 
                        sd,(GtkDestroyNotify)pgtk2_free_signal_data); 
  } 
  RETURN_THIS(); 
} 
 
array get_selected() 
//! Shortcut to GTK2.TreeView->get_selection() and  
//! GTK2.TreeSelection()->get_selected(). 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    GtkTreeSelection *sel; 
    GtkTreeIter *iter; 
    GtkTreeModel *model; 
    iter=(GtkTreeIter *)g_malloc(sizeof(GtkTreeIter)); 
    if (iter==NULL) 
      SIMPLE_OUT_OF_MEMORY_ERROR("get_selected",sizeof(GtkTreeIter)); 
    sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(THIS->obj)); 
    if (gtk_tree_selection_get_selected(sel,&model,iter)) { 
      push_pgdk2object(iter,pgtk2_tree_iter_program,1); 
      push_gobject(model); 
      f_aggregate(2); 
    } else { 
      push_int(0); 
      g_free(iter); 
    } 
  } 
} 
endrequire; 
 
require gtk210; 
int get_rubber_banding(); 
//! Returns whether rubber banding is turned on.  If the selection mode is 
//! GTK2.SELECTION_MULTIPLE, rubber banding will allow the user to select 
//! multiple rows by dragging the mouse. 
 
void set_rubber_banding(int enable); 
//! Enables or disables rubber banding. 
 
int get_enable_tree_lines(); 
//! Returns whether or not tree lines are drawn. 
 
void set_enable_tree_lines(int enabled); 
//! Sets whether to draw lines interconnecting the expanders.  This does not 
//! have any visible effects for lists. 
 
int get_grid_lines(); 
//! Returns which grid lines are enabled. 
 
void set_grid_lines(int grid_lines); 
//! Sets which grid lines to draw. 
endrequire;