1Gtk2::TreeView(3) User Contributed Perl Documentation Gtk2::TreeView(3)
2
3
4
6 Gtk2::TreeView - wrapper for GtkTreeView
7
9 Glib::Object
10 +----Glib::InitiallyUnowned
11 +----Gtk2::Object
12 +----Gtk2::Widget
13 +----Gtk2::Container
14 +----Gtk2::TreeView
15
17 Glib::Object::_Unregistered::AtkImplementorIface
18 Gtk2::Buildable
19
21 widget = Gtk2::TreeView->new ($model=undef)
22 • $model (Gtk2::TreeModel)
23
24 widget = Gtk2::TreeView->new_with_model ($model)
25 • $model (Gtk2::TreeModel)
26
27 integer = $tree_view->append_column ($column)
28 • $column (Gtk2::TreeViewColumn)
29
30 rectangle = $tree_view->get_background_area ($path, $column)
31 • $path (Gtk2::TreePath or undef)
32
33 • $column (Gtk2::TreeViewColumn or undef)
34
35 window = $tree_view->get_bin_window
36 rectangle = $tree_view->get_cell_area ($path, $column)
37 • $path (Gtk2::TreePath or undef)
38
39 • $column (Gtk2::TreeViewColumn or undef)
40
41 $tree_view->collapse_all
42 boolean = $tree_view->collapse_row ($path)
43 • $path (Gtk2::TreePath)
44
45 $tree_view->set_column_drag_function ($func, $data=undef)
46 • $func (scalar)
47
48 • $data (scalar)
49
50 treeviewcolumn = $tree_view->get_column ($n)
51 • $n (integer)
52
53 $tree_view->columns_autosize
54 list = $tree_view->get_columns
55 Returns an array of columns.
56
57 (tx, ty) = $tree_view->convert_bin_window_to_tree_coords ($bx, $by)
58 • $bx (integer)
59
60 • $by (integer)
61
62 Since: gtk+ 2.12
63
64 (wx, wy) = $tree_view->convert_bin_window_to_widget_coords ($bx, $by)
65 • $bx (integer)
66
67 • $by (integer)
68
69 Since: gtk+ 2.12
70
71 (bx, by) = $tree_view->convert_tree_to_bin_window_coords ($tx, $ty)
72 • $tx (integer)
73
74 • $ty (integer)
75
76 Since: gtk+ 2.12
77
78 (wx, wy) = $tree_view->convert_tree_to_widget_coords ($tx, $ty)
79 • $tx (integer)
80
81 • $ty (integer)
82
83 Since: gtk+ 2.12
84
85 (bx, by) = $tree_view->convert_widget_to_bin_window_coords ($wx, $wy)
86 • $wx (integer)
87
88 • $wy (integer)
89
90 Since: gtk+ 2.12
91
92 (tx, ty) = $tree_view->convert_widget_to_tree_coords ($wx, $wy)
93 • $wx (integer)
94
95 • $wy (integer)
96
97 Since: gtk+ 2.12
98
99 pixmap = $tree_view->create_row_drag_icon ($path)
100 • $path (Gtk2::TreePath)
101
102 (path, focus_column) = $tree_view->get_cursor
103 Returns the Gtk2::TreePath and Gtk2::TreeViewColumn of the cell with
104 the keyboard focus cursor. Either may be undef.
105
106 $tree_view->set_cursor_on_cell ($path, $focus_column, $focus_cell,
107 $start_editing)
108 • $path (Gtk2::TreePath)
109
110 • $focus_column (Gtk2::TreeViewColumn or undef)
111
112 • $focus_cell (Gtk2::CellRenderer or undef)
113
114 • $start_editing (boolean)
115
116 Since: gtk+ 2.2
117
118 $tree_view->set_cursor ($path, $focus_column=undef, $start_editing=FALSE)
119 • $path (Gtk2::TreePath)
120
121 • $focus_column (Gtk2::TreeViewColumn or undef)
122
123 • $start_editing (boolean)
124
125 (path, dropposition) = $tree_view->get_dest_row_at_pos ($drag_x, $drag_y)
126 • $drag_x (integer)
127
128 • $drag_y (integer)
129
130 (path, dropposition) = $tree_view->get_drag_dest_row
131 $tree_view->set_drag_dest_row ($path, $pos)
132 • $path (Gtk2::TreePath or undef)
133
134 • $pos (Gtk2::TreeViewDropPosition)
135
136 $tree_view->enable_model_drag_dest ($actions, ...)
137 • $actions (Gtk2::Gdk::DragAction)
138
139 • ... (list) of Gtk2::TargetEntry's
140
141 $tree_view->enable_model_drag_source ($start_button_mask, $actions, ...)
142 • $start_button_mask (Gtk2::Gdk::ModifierType)
143
144 • $actions (Gtk2::Gdk::DragAction)
145
146 • ... (list) of Gtk2::TargetEntry's
147
148 boolean = $tree_view->get_enable_search
149 $tree_view->set_enable_search ($enable_search)
150 • $enable_search (boolean)
151
152 boolean = $tree_view->get_enable_tree_lines
153 Since: gtk+ 2.10
154
155 $tree_view->set_enable_tree_lines ($enabled)
156 • $enabled (boolean)
157
158 Since: gtk+ 2.10
159
160 $tree_view->expand_all
161 boolean = $tree_view->expand_row ($path, $open_all)
162 • $path (Gtk2::TreePath)
163
164 • $open_all (boolean)
165
166 $tree_view->expand_to_path ($path)
167 • $path (Gtk2::TreePath)
168
169 Since: gtk+ 2.2
170
171 treeviewcolumn or undef = $tree_view->get_expander_column
172 $tree_view->set_expander_column ($column)
173 • $column (Gtk2::TreeViewColumn or undef)
174
175 boolean = $treeview->get_fixed_height_mode
176 Since: gtk+ 2.6
177
178 $treeview->set_fixed_height_mode ($enable)
179 • $enable (boolean)
180
181 Since: gtk+ 2.6
182
183 treeviewgridlines = $tree_view->get_grid_lines
184 Since: gtk+ 2.10
185
186 $tree_view->set_grid_lines ($grid_lines)
187 • $grid_lines (Gtk2::TreeViewGridLines)
188
189 Since: gtk+ 2.10
190
191 adjustment or undef = $tree_view->get_hadjustment
192 $tree_view->set_hadjustment ($adjustment)
193 • $adjustment (Gtk2::Adjustment or undef)
194
195 boolean = $tree_view->get_headers_clickable
196 Since: gtk+ 2.10
197
198 $tree_view->set_headers_clickable ($setting)
199 • $setting (boolean)
200
201 boolean = $tree_view->get_headers_visible
202 $tree_view->set_headers_visible ($headers_visible)
203 • $headers_visible (boolean)
204
205 boolean = $treeview->get_hover_expand
206 Since: gtk+ 2.6
207
208 $treeview->set_hover_expand ($expand)
209 • $expand (boolean)
210
211 Since: gtk+ 2.6
212
213 boolean = $treeview->get_hover_selection
214 Since: gtk+ 2.6
215
216 $treeview->set_hover_selection ($hover)
217 • $hover (boolean)
218
219 Since: gtk+ 2.6
220
221 integer = $tree_view->insert_column ($column, $position)
222 • $column (Gtk2::TreeViewColumn)
223
224 • $position (integer)
225
226 $tree_view->insert_column_with_attributes ($position, $title,
227 $cellrenderer, $attr1, $col1, $attr2, $col2, ...)
228 • $position (integer)
229
230 • $title (string)
231
232 • $cell (Gtk2::CellRenderer)
233
234 • ... (list)
235
236 integer = $tree_view->insert_column_with_data_func ($position, $title,
237 $cell, $func, $data=undef)
238 • $position (integer)
239
240 • $title (string)
241
242 • $cell (Gtk2::CellRenderer)
243
244 • $func (subroutine)
245
246 • $data (scalar)
247
248 Insert a column that calls $func every time it needs to fetch the data
249 for a cell. $func will get a cell renderer, the tree model, and the
250 iter of the row in question, and should set the proper value into the
251 cell renderer.
252
253 boolean = $tree_view->is_rubber_banding_active
254 Since: gtk+ 2.12
255
256 integer = $tree_view->get_level_indentation
257 Since: gtk+ 2.12
258
259 $tree_view->set_level_indentation ($indentation)
260 • $indentation (integer)
261
262 Since: gtk+ 2.12
263
264 $tree_view->map_expanded_rows ($func, $data=undef)
265 • $func (scalar)
266
267 • $data (scalar)
268
269 treemodel or undef = $tree_view->get_model
270 $tree_view->set_model ($model)
271 • $model (Gtk2::TreeModel or undef)
272
273 $tree_view->move_column_after ($column, $base_column)
274 • $column (Gtk2::TreeViewColumn)
275
276 • $base_column (Gtk2::TreeViewColumn or undef)
277
278 path = $tree_view->get_path_at_pos ($x, $y)
279 (path, column, cell_x, cell_y) = $tree_view->get_path_at_pos ($x, $y)
280 • $x (integer)
281
282 • $y (integer)
283
284 Finds the path at the point ($x, $y), relative to widget coordinates.
285 That is, $x and $y are relative to an event's coordinates. $x and $y
286 must come from an event on the $tree_view only where "$event->window ==
287 $tree_view->get_bin_window". It is primarily for things like popup
288 menus. In scalar context, returns the Gtk2::TreePath, in array
289 context, adds the Gtk2::TreeViewColumn, and $x and $y translated to be
290 relative to the cell. This function is only meaningful if $tree_view
291 is realized.
292
293 integer = $tree_view->remove_column ($column)
294 • $column (Gtk2::TreeViewColumn)
295
296 boolean = $tree_view->get_reorderable
297 $tree_view->set_reorderable ($reorderable)
298 • $reorderable (boolean)
299
300 $tree_view->row_activated ($path, $column)
301 • $path (Gtk2::TreePath)
302
303 • $column (Gtk2::TreeViewColumn)
304
305 boolean = $tree_view->row_expanded ($path)
306 • $path (Gtk2::TreePath)
307
308 $tree_view->set_row_separator_func ($func, $data=undef)
309 • $func (scalar)
310
311 • $data (scalar)
312
313 Since: gtk+ 2.6
314
315 boolean = $tree_view->get_rubber_banding
316 Since: gtk+ 2.10
317
318 $tree_view->set_rubber_banding ($enable)
319 • $enable (boolean)
320
321 Since: gtk+ 2.10
322
323 boolean = $tree_view->get_rules_hint
324 $tree_view->set_rules_hint ($setting)
325 • $setting (boolean)
326
327 $tree_view->scroll_to_cell ($path, $column=undef, $use_align=FALSE,
328 $row_align=0.0, $col_align=0.0)
329 • $path (Gtk2::TreePath or undef)
330
331 • $column (Gtk2::TreeViewColumn or undef)
332
333 • $use_align (boolean)
334
335 • $row_align (double)
336
337 • $col_align (double)
338
339 $tree_view->scroll_to_point ($tree_x, $tree_y)
340 • $tree_x (scalar)
341
342 • $tree_y (scalar)
343
344 integer = $tree_view->get_search_column
345 $tree_view->set_search_column ($column)
346 • $column (integer)
347
348 entry or undef = $tree_view->get_search_entry
349 Since: gtk+ 2.10
350
351 $tree_view->set_search_entry ($entry)
352 • $entry (Gtk2::Entry or undef)
353
354 Since: gtk+ 2.10
355
356 $tree_view->set_search_equal_func ($func, $data=undef)
357 • $func (subroutine)
358
359 • $data (scalar)
360
361 $tree_view->set_search_position_func ($func, $user_data=undef)
362 • $func (scalar)
363
364 • $user_data (scalar)
365
366 Pass undef for the func to restore the default search position
367 function.
368
369 Since: gtk+ 2.10
370
371 treeselection = $tree_view->get_selection
372 boolean = $tree_view->get_show_expanders
373 Since: gtk+ 2.12
374
375 $tree_view->set_show_expanders ($enabled)
376 • $enabled (boolean)
377
378 Since: gtk+ 2.12
379
380 $tree_view->set_tooltip_cell ($tooltip, $path, $column, $cell)
381 • $tooltip (Gtk2::Tooltip)
382
383 • $path (Gtk2::TreePath)
384
385 • $column (Gtk2::TreeViewColumn)
386
387 • $cell (Gtk2::CellRenderer)
388
389 Since: gtk+ 2.12
390
391 integer = $tree_view->get_tooltip_column
392 Since: gtk+ 2.12
393
394 $tree_view->set_tooltip_column ($column)
395 • $column (integer)
396
397 Since: gtk+ 2.12
398
399 (x, y, model, path, iter) = $treeview->get_tooltip_context ($x, $y,
400 $keyboard_tip)
401 • $x (integer)
402
403 • $y (integer)
404
405 • $keyboard_tip (boolean)
406
407 Since: gtk+ 2.12
408
409 $tree_view->set_tooltip_row ($tooltip, $path)
410 • $tooltip (Gtk2::Tooltip)
411
412 • $path (Gtk2::TreePath)
413
414 Since: gtk+ 2.12
415
416 (wx, wy) = $tree_view->tree_to_widget_coords ($tx, $ty)
417 • $tx (integer)
418
419 • $ty (integer)
420
421 $tree_view->unset_rows_drag_dest
422 $tree_view->unset_rows_drag_source
423 adjustment or undef = $tree_view->get_vadjustment
424 $tree_view->set_vadjustment ($adjustment)
425 • $adjustment (Gtk2::Adjustment or undef)
426
427 (start_path, end_path) = $tree_view->get_visible_range
428 Since: gtk+ 2.8
429
430 rectangle = $tree_view->get_visible_rect
431 (tx, ty) = $tree_view->widget_to_tree_coords ($wx, $wy)
432 • $wx (integer)
433
434 • $wy (integer)
435
437 'enable-grid-lines' (Gtk2::TreeViewGridLines : default "none" :
438 readable / writable / private / static-nick / static-blurb)
439 Whether grid lines should be drawn in the tree view
440
441 'enable-search' (boolean : default true : readable / writable / private
442 / static-nick / static-blurb)
443 View allows user to search through columns interactively
444
445 'enable-tree-lines' (boolean : default false : readable / writable /
446 private / static-nick / static-blurb)
447 Whether tree lines should be drawn in the tree view
448
449 'expander-column' (Gtk2::TreeViewColumn : default undef : readable /
450 writable / private / static-nick / static-blurb)
451 Set the column for the expander column
452
453 'fixed-height-mode' (boolean : default false : readable / writable /
454 private / static-nick / static-blurb)
455 Speeds up GtkTreeView by assuming that all rows have the same
456 height
457
458 'hadjustment' (Gtk2::Adjustment : default undef : readable / writable /
459 private / static-nick / static-blurb)
460 Horizontal Adjustment for the widget
461
462 'headers-clickable' (boolean : default true : readable / writable /
463 private / static-nick / static-blurb)
464 Column headers respond to click events
465
466 'headers-visible' (boolean : default true : readable / writable /
467 private / static-nick / static-blurb)
468 Show the column header buttons
469
470 'hover-expand' (boolean : default false : readable / writable / private
471 / static-nick / static-blurb)
472 Whether rows should be expanded/collapsed when the pointer moves
473 over them
474
475 'hover-selection' (boolean : default false : readable / writable /
476 private / static-nick / static-blurb)
477 Whether the selection should follow the pointer
478
479 'level-indentation' (integer : default 0 : readable / writable /
480 private / static-nick / static-blurb)
481 Extra indentation for each level
482
483 'model' (Gtk2::TreeModel : default undef : readable / writable /
484 private / static-nick / static-blurb)
485 The model for the tree view
486
487 'reorderable' (boolean : default false : readable / writable / private
488 / static-nick / static-blurb)
489 View is reorderable
490
491 'rubber-banding' (boolean : default false : readable / writable /
492 private / static-nick / static-blurb)
493 Whether to enable selection of multiple items by dragging the mouse
494 pointer
495
496 'rules-hint' (boolean : default false : readable / writable / private /
497 static-nick / static-blurb)
498 Set a hint to the theme engine to draw rows in alternating colors
499
500 'search-column' (integer : default -1 : readable / writable / private /
501 static-nick / static-blurb)
502 Model column to search through during interactive search
503
504 'show-expanders' (boolean : default true : readable / writable /
505 private / static-nick / static-blurb)
506 View has expanders
507
508 'tooltip-column' (integer : default -1 : readable / writable / private
509 / static-nick / static-blurb)
510 The column in the model containing the tooltip texts for the rows
511
512 'vadjustment' (Gtk2::Adjustment : default undef : readable / writable /
513 private / static-nick / static-blurb)
514 Vertical Adjustment for the widget
515
517 'allow-rules' (boolean : default true : readable / private / static-
518 nick / static-blurb)
519 Allow drawing of alternating color rows
520
521 'even-row-color' (Gtk2::Gdk::Color : default undef : readable / private
522 / static-nick / static-blurb)
523 Color to use for even rows
524
525 'expander-size' (integer : default 12 : readable / private / static-
526 nick / static-blurb)
527 Size of the expander arrow
528
529 'grid-line-pattern' (string : default "\1\1" : readable / private /
530 static-nick / static-blurb)
531 Dash pattern used to draw the tree view grid lines
532
533 'grid-line-width' (integer : default 1 : readable / private / static-
534 nick / static-blurb)
535 Width, in pixels, of the tree view grid lines
536
537 'horizontal-separator' (integer : default 2 : readable / private /
538 static-nick / static-blurb)
539 Horizontal space between cells. Must be an even number
540
541 'indent-expanders' (boolean : default true : readable / private /
542 static-nick / static-blurb)
543 Make the expanders indented
544
545 'odd-row-color' (Gtk2::Gdk::Color : default undef : readable / private
546 / static-nick / static-blurb)
547 Color to use for odd rows
548
549 'row-ending-details' (boolean : default false : readable / private /
550 static-nick / static-blurb)
551 Enable extended row background theming
552
553 'tree-line-pattern' (string : default "\1\1" : readable / private /
554 static-nick / static-blurb)
555 Dash pattern used to draw the tree view lines
556
557 'tree-line-width' (integer : default 1 : readable / private / static-
558 nick / static-blurb)
559 Width, in pixels, of the tree view lines
560
561 'vertical-separator' (integer : default 2 : readable / private /
562 static-nick / static-blurb)
563 Vertical space between cells. Must be an even number
564
566 columns-changed (Gtk2::TreeView)
567 cursor-changed (Gtk2::TreeView)
568 boolean = expand-collapse-cursor-row (Gtk2::TreeView, boolean, boolean,
569 boolean)
570 boolean = move-cursor (Gtk2::TreeView, Gtk2::MovementStep, integer)
571 row-activated (Gtk2::TreeView, Gtk2::TreePath, Gtk2::TreeViewColumn)
572 row-collapsed (Gtk2::TreeView, Gtk2::TreeIter, Gtk2::TreePath)
573 row-expanded (Gtk2::TreeView, Gtk2::TreeIter, Gtk2::TreePath)
574 boolean = select-all (Gtk2::TreeView)
575 boolean = select-cursor-parent (Gtk2::TreeView)
576 boolean = select-cursor-row (Gtk2::TreeView, boolean)
577 set-scroll-adjustments (Gtk2::TreeView, Gtk2::Adjustment,
578 Gtk2::Adjustment)
579 boolean = start-interactive-search (Gtk2::TreeView)
580 boolean = test-collapse-row (Gtk2::TreeView, Gtk2::TreeIter,
581 Gtk2::TreePath)
582 boolean = test-expand-row (Gtk2::TreeView, Gtk2::TreeIter,
583 Gtk2::TreePath)
584 boolean = toggle-cursor-row (Gtk2::TreeView)
585 boolean = unselect-all (Gtk2::TreeView)
586
588 flags Gtk2::Gdk::DragAction
589 • 'default' / 'GDK_ACTION_DEFAULT'
590
591 • 'copy' / 'GDK_ACTION_COPY'
592
593 • 'move' / 'GDK_ACTION_MOVE'
594
595 • 'link' / 'GDK_ACTION_LINK'
596
597 • 'private' / 'GDK_ACTION_PRIVATE'
598
599 • 'ask' / 'GDK_ACTION_ASK'
600
601 flags Gtk2::Gdk::ModifierType
602 • 'shift-mask' / 'GDK_SHIFT_MASK'
603
604 • 'lock-mask' / 'GDK_LOCK_MASK'
605
606 • 'control-mask' / 'GDK_CONTROL_MASK'
607
608 • 'mod1-mask' / 'GDK_MOD1_MASK'
609
610 • 'mod2-mask' / 'GDK_MOD2_MASK'
611
612 • 'mod3-mask' / 'GDK_MOD3_MASK'
613
614 • 'mod4-mask' / 'GDK_MOD4_MASK'
615
616 • 'mod5-mask' / 'GDK_MOD5_MASK'
617
618 • 'button1-mask' / 'GDK_BUTTON1_MASK'
619
620 • 'button2-mask' / 'GDK_BUTTON2_MASK'
621
622 • 'button3-mask' / 'GDK_BUTTON3_MASK'
623
624 • 'button4-mask' / 'GDK_BUTTON4_MASK'
625
626 • 'button5-mask' / 'GDK_BUTTON5_MASK'
627
628 • 'super-mask' / 'GDK_SUPER_MASK'
629
630 • 'hyper-mask' / 'GDK_HYPER_MASK'
631
632 • 'meta-mask' / 'GDK_META_MASK'
633
634 • 'release-mask' / 'GDK_RELEASE_MASK'
635
636 • 'modifier-mask' / 'GDK_MODIFIER_MASK'
637
638 enum Gtk2::MovementStep
639 • 'logical-positions' / 'GTK_MOVEMENT_LOGICAL_POSITIONS'
640
641 • 'visual-positions' / 'GTK_MOVEMENT_VISUAL_POSITIONS'
642
643 • 'words' / 'GTK_MOVEMENT_WORDS'
644
645 • 'display-lines' / 'GTK_MOVEMENT_DISPLAY_LINES'
646
647 • 'display-line-ends' / 'GTK_MOVEMENT_DISPLAY_LINE_ENDS'
648
649 • 'paragraphs' / 'GTK_MOVEMENT_PARAGRAPHS'
650
651 • 'paragraph-ends' / 'GTK_MOVEMENT_PARAGRAPH_ENDS'
652
653 • 'pages' / 'GTK_MOVEMENT_PAGES'
654
655 • 'buffer-ends' / 'GTK_MOVEMENT_BUFFER_ENDS'
656
657 • 'horizontal-pages' / 'GTK_MOVEMENT_HORIZONTAL_PAGES'
658
659 enum Gtk2::TreeViewDropPosition
660 • 'before' / 'GTK_TREE_VIEW_DROP_BEFORE'
661
662 • 'after' / 'GTK_TREE_VIEW_DROP_AFTER'
663
664 • 'into-or-before' / 'GTK_TREE_VIEW_DROP_INTO_OR_BEFORE'
665
666 • 'into-or-after' / 'GTK_TREE_VIEW_DROP_INTO_OR_AFTER'
667
668 enum Gtk2::TreeViewGridLines
669 • 'none' / 'GTK_TREE_VIEW_GRID_LINES_NONE'
670
671 • 'horizontal' / 'GTK_TREE_VIEW_GRID_LINES_HORIZONTAL'
672
673 • 'vertical' / 'GTK_TREE_VIEW_GRID_LINES_VERTICAL'
674
675 • 'both' / 'GTK_TREE_VIEW_GRID_LINES_BOTH'
676
678 Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
679 Gtk2::Container
680
682 Copyright (C) 2003-2011 by the gtk2-perl team.
683
684 This software is licensed under the LGPL. See Gtk2 for a full notice.
685
686
687
688perl v5.36.0 2023-01-20 Gtk2::TreeView(3)