gtk4/auto/column_view.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9 AccessibleRole, Adjustment, Align, Buildable, ColumnViewColumn, ConstraintTarget,
10 LayoutManager, Overflow, Scrollable, ScrollablePolicy, SelectionModel, SortType, Sorter,
11 Widget, ffi,
12};
13#[cfg(feature = "v4_12")]
14#[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
15use crate::{ListItemFactory, ListScrollFlags, ListTabBehavior, ScrollInfo};
16use glib::{
17 object::ObjectType as _,
18 prelude::*,
19 signal::{SignalHandlerId, connect_raw},
20 translate::*,
21};
22use std::boxed::Box as Box_;
23
24#[cfg(feature = "v4_10")]
25#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
26glib::wrapper! {
27 ///
28 /// │
29 /// ├── listview
30 /// │
31 /// ┊
32 /// ╰── [rubberband]
33 /// ```text
34 ///
35 /// [`ColumnView`][crate::ColumnView] uses a single CSS node named columnview. It may carry the
36 /// .column-separators style class, when [`show-column-separators`][struct@crate::ColumnView#show-column-separators]
37 /// property is set. Header widgets appear below a node with name header.
38 /// The rows are contained in a [`ListView`][crate::ListView] widget, so there is a listview
39 /// node with the same structure as for a standalone [`ListView`][crate::ListView] widget.
40 /// If [`show-row-separators`][struct@crate::ColumnView#show-row-separators] is set, it will be passed
41 /// on to the list view, causing its CSS node to carry the .separators style class.
42 /// For rubberband selection, a node with name rubberband is used.
43 ///
44 /// The main columnview node may also carry style classes to select
45 /// the style of [list presentation](section-list-widget.html#list-styles):
46 /// .rich-list, .navigation-sidebar or .data-table.
47 ///
48 /// # Accessibility
49 ///
50 /// [`ColumnView`][crate::ColumnView] uses the [enum@Gtk.AccessibleRole.tree_grid] role, header title
51 /// widgets are using the [enum@Gtk.AccessibleRole.column_header] role. The row widgets
52 /// are using the [enum@Gtk.AccessibleRole.row] role, and individual cells are using
53 /// the [enum@Gtk.AccessibleRole.grid_cell] role
54 ///
55 /// ## Properties
56 ///
57 ///
58 /// #### `columns`
59 /// The list of columns.
60 ///
61 /// Readable
62 ///
63 ///
64 /// #### `enable-rubberband`
65 /// Allow rubberband selection.
66 ///
67 /// Readable | Writable
68 ///
69 ///
70 /// #### `header-factory`
71 /// Factory for creating header widgets.
72 ///
73 /// The factory must be for configuring [`ListHeader`][crate::ListHeader] objects.
74 ///
75 /// Readable | Writable
76 ///
77 ///
78 /// #### `model`
79 /// Model for the items displayed.
80 ///
81 /// Readable | Writable
82 ///
83 ///
84 /// #### `reorderable`
85 /// Whether columns are reorderable.
86 ///
87 /// Readable | Writable
88 ///
89 ///
90 /// #### `row-factory`
91 /// The factory used for configuring rows.
92 ///
93 /// The factory must be for configuring [`ColumnViewRow`][crate::ColumnViewRow] objects.
94 ///
95 /// Readable | Writable
96 ///
97 ///
98 /// #### `show-column-separators`
99 /// Show separators between columns.
100 ///
101 /// Readable | Writable
102 ///
103 ///
104 /// #### `show-row-separators`
105 /// Show separators between rows.
106 ///
107 /// Readable | Writable
108 ///
109 ///
110 /// #### `single-click-activate`
111 /// Activate rows on single click and select them on hover.
112 ///
113 /// Readable | Writable
114 ///
115 ///
116 /// #### `sorter`
117 /// Sorter with the sorting choices of the user.
118 ///
119 /// Readable
120 ///
121 ///
122 /// #### `tab-behavior`
123 /// key
124 ///
125 /// Readable | Writable
126 /// <details><summary><h4>Widget</h4></summary>
127 ///
128 ///
129 /// #### `can-focus`
130 /// Whether the widget or any of its descendents can accept
131 /// the input focus.
132 ///
133 /// This property is meant to be set by widget implementations,
134 /// typically in their instance init function.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `can-target`
140 /// Whether the widget can receive pointer events.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `css-classes`
146 /// A list of css classes applied to this widget.
147 ///
148 /// Readable | Writable
149 ///
150 ///
151 /// #### `css-name`
152 /// The name of this widget in the CSS tree.
153 ///
154 /// This property is meant to be set by widget implementations,
155 /// typically in their instance init function.
156 ///
157 /// Readable | Writable | Construct Only
158 ///
159 ///
160 /// #### `cursor`
161 /// The cursor used by @widget.
162 ///
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `focus-on-click`
167 /// Whether the widget should grab focus when it is clicked with the mouse.
168 ///
169 /// This property is only relevant for widgets that can take focus.
170 ///
171 /// Readable | Writable
172 ///
173 ///
174 /// #### `focusable`
175 /// Whether this widget itself will accept the input focus.
176 ///
177 /// Readable | Writable
178 ///
179 ///
180 /// #### `halign`
181 /// How to distribute horizontal space if widget gets extra space.
182 ///
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `has-default`
187 /// Whether the widget is the default widget.
188 ///
189 /// Readable
190 ///
191 ///
192 /// #### `has-focus`
193 /// Whether the widget has the input focus.
194 ///
195 /// Readable
196 ///
197 ///
198 /// #### `has-tooltip`
199 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
200 /// signal on @widget.
201 ///
202 /// A true value indicates that @widget can have a tooltip, in this case
203 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
204 /// determine whether it will provide a tooltip or not.
205 ///
206 /// Readable | Writable
207 ///
208 ///
209 /// #### `height-request`
210 /// Overrides for height request of the widget.
211 ///
212 /// If this is -1, the natural request will be used.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `hexpand`
218 /// Whether to expand horizontally.
219 ///
220 /// Readable | Writable
221 ///
222 ///
223 /// #### `hexpand-set`
224 /// Whether to use the `hexpand` property.
225 ///
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `layout-manager`
230 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
231 /// the preferred size of the widget, and allocate its children.
232 ///
233 /// This property is meant to be set by widget implementations,
234 /// typically in their instance init function.
235 ///
236 /// Readable | Writable
237 ///
238 ///
239 /// #### `limit-events`
240 /// Makes this widget act like a modal dialog, with respect to
241 /// event delivery.
242 ///
243 /// Global event controllers will not handle events with targets
244 /// inside the widget, unless they are set up to ignore propagation
245 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
246 ///
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `margin-bottom`
251 /// Margin on bottom side of widget.
252 ///
253 /// This property adds margin outside of the widget's normal size
254 /// request, the margin will be added in addition to the size from
255 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
256 ///
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `margin-end`
261 /// Margin on end of widget, horizontally.
262 ///
263 /// This property supports left-to-right and right-to-left text
264 /// directions.
265 ///
266 /// This property adds margin outside of the widget's normal size
267 /// request, the margin will be added in addition to the size from
268 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
269 ///
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `margin-start`
274 /// Margin on start of widget, horizontally.
275 ///
276 /// This property supports left-to-right and right-to-left text
277 /// directions.
278 ///
279 /// This property adds margin outside of the widget's normal size
280 /// request, the margin will be added in addition to the size from
281 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
282 ///
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `margin-top`
287 /// Margin on top side of widget.
288 ///
289 /// This property adds margin outside of the widget's normal size
290 /// request, the margin will be added in addition to the size from
291 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
292 ///
293 /// Readable | Writable
294 ///
295 ///
296 /// #### `name`
297 /// The name of the widget.
298 ///
299 /// Readable | Writable
300 ///
301 ///
302 /// #### `opacity`
303 /// The requested opacity of the widget.
304 ///
305 /// Readable | Writable
306 ///
307 ///
308 /// #### `overflow`
309 /// How content outside the widget's content area is treated.
310 ///
311 /// This property is meant to be set by widget implementations,
312 /// typically in their instance init function.
313 ///
314 /// Readable | Writable
315 ///
316 ///
317 /// #### `parent`
318 /// The parent widget of this widget.
319 ///
320 /// Readable
321 ///
322 ///
323 /// #### `receives-default`
324 /// Whether the widget will receive the default action when it is focused.
325 ///
326 /// Readable | Writable
327 ///
328 ///
329 /// #### `root`
330 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
331 ///
332 /// This will be `NULL` if the widget is not contained in a root widget.
333 ///
334 /// Readable
335 ///
336 ///
337 /// #### `scale-factor`
338 /// The scale factor of the widget.
339 ///
340 /// Readable
341 ///
342 ///
343 /// #### `sensitive`
344 /// Whether the widget responds to input.
345 ///
346 /// Readable | Writable
347 ///
348 ///
349 /// #### `tooltip-markup`
350 /// Sets the text of tooltip to be the given string, which is marked up
351 /// with Pango markup.
352 ///
353 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
354 ///
355 /// This is a convenience property which will take care of getting the
356 /// tooltip shown if the given string is not `NULL`:
357 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
358 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
359 /// the default signal handler.
360 ///
361 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
362 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
363 ///
364 /// Readable | Writable
365 ///
366 ///
367 /// #### `tooltip-text`
368 /// Sets the text of tooltip to be the given string.
369 ///
370 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
371 ///
372 /// This is a convenience property which will take care of getting the
373 /// tooltip shown if the given string is not `NULL`:
374 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
375 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
376 /// the default signal handler.
377 ///
378 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
379 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
380 ///
381 /// Readable | Writable
382 ///
383 ///
384 /// #### `valign`
385 /// How to distribute vertical space if widget gets extra space.
386 ///
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `vexpand`
391 /// Whether to expand vertically.
392 ///
393 /// Readable | Writable
394 ///
395 ///
396 /// #### `vexpand-set`
397 /// Whether to use the `vexpand` property.
398 ///
399 /// Readable | Writable
400 ///
401 ///
402 /// #### `visible`
403 /// Whether the widget is visible.
404 ///
405 /// Readable | Writable
406 ///
407 ///
408 /// #### `width-request`
409 /// Overrides for width request of the widget.
410 ///
411 /// If this is -1, the natural request will be used.
412 ///
413 /// Readable | Writable
414 /// </details>
415 /// <details><summary><h4>Accessible</h4></summary>
416 ///
417 ///
418 /// #### `accessible-role`
419 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
420 ///
421 /// The accessible role cannot be changed once set.
422 ///
423 /// Readable | Writable
424 /// </details>
425 /// <details><summary><h4>Scrollable</h4></summary>
426 ///
427 ///
428 /// #### `hadjustment`
429 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
430 ///
431 /// This adjustment is shared between the scrollable widget and its parent.
432 ///
433 /// Readable | Writable | Construct
434 ///
435 ///
436 /// #### `hscroll-policy`
437 /// Determines when horizontal scrolling should start.
438 ///
439 /// Readable | Writable
440 ///
441 ///
442 /// #### `vadjustment`
443 /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
444 ///
445 /// This adjustment is shared between the scrollable widget and its parent.
446 ///
447 /// Readable | Writable | Construct
448 ///
449 ///
450 /// #### `vscroll-policy`
451 /// Determines when vertical scrolling should start.
452 ///
453 /// Readable | Writable
454 /// </details>
455 ///
456 /// ## Signals
457 ///
458 ///
459 /// #### `activate`
460 /// Emitted when a row has been activated by the user, usually via activating
461 /// the GtkListBase|list.activate-item action.
462 ///
463 /// This allows for a convenient way to handle activation in a columnview.
464 /// See [`ListItemExt::set_activatable()`][crate::prelude::ListItemExt::set_activatable()] for details on how to use this
465 /// signal.
466 ///
467 ///
468 /// <details><summary><h4>Widget</h4></summary>
469 ///
470 ///
471 /// #### `destroy`
472 /// Signals that all holders of a reference to the widget should release
473 /// the reference that they hold.
474 ///
475 /// May result in finalization of the widget if all references are released.
476 ///
477 /// This signal is not suitable for saving widget state.
478 ///
479 ///
480 ///
481 ///
482 /// #### `direction-changed`
483 /// Emitted when the text direction of a widget changes.
484 ///
485 ///
486 ///
487 ///
488 /// #### `hide`
489 /// Emitted when @widget is hidden.
490 ///
491 ///
492 ///
493 ///
494 /// #### `keynav-failed`
495 /// Emitted if keyboard navigation fails.
496 ///
497 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
498 ///
499 ///
500 ///
501 ///
502 /// #### `map`
503 /// Emitted when @widget is going to be mapped.
504 ///
505 /// A widget is mapped when the widget is visible (which is controlled with
506 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
507 /// are also visible.
508 ///
509 /// The `::map` signal can be used to determine whether a widget will be drawn,
510 /// for instance it can resume an animation that was stopped during the
511 /// emission of [`unmap`][struct@crate::Widget#unmap].
512 ///
513 ///
514 ///
515 ///
516 /// #### `mnemonic-activate`
517 /// Emitted when a widget is activated via a mnemonic.
518 ///
519 /// The default handler for this signal activates @widget if @group_cycling
520 /// is false, or just makes @widget grab focus if @group_cycling is true.
521 ///
522 ///
523 ///
524 ///
525 /// #### `move-focus`
526 /// to move backward.
527 ///
528 /// Action
529 ///
530 ///
531 /// #### `query-tooltip`
532 /// Emitted when the widget’s tooltip is about to be shown.
533 ///
534 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
535 /// is true and the hover timeout has expired with the cursor hovering
536 /// above @widget; or emitted when @widget got focus in keyboard mode.
537 ///
538 /// Using the given coordinates, the signal handler should determine
539 /// whether a tooltip should be shown for @widget. If this is the case
540 /// true should be returned, false otherwise. Note that if @keyboard_mode
541 /// is true, the values of @x and @y are undefined and should not be used.
542 ///
543 /// The signal handler is free to manipulate @tooltip with the therefore
544 /// destined function calls.
545 ///
546 ///
547 ///
548 ///
549 /// #### `realize`
550 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
551 ///
552 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
553 /// or the widget has been mapped (that is, it is going to be drawn).
554 ///
555 ///
556 ///
557 ///
558 /// #### `show`
559 /// Emitted when @widget is shown.
560 ///
561 ///
562 ///
563 ///
564 /// #### `state-flags-changed`
565 /// Emitted when the widget state changes.
566 ///
567 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
568 ///
569 ///
570 ///
571 ///
572 /// #### `unmap`
573 /// Emitted when @widget is going to be unmapped.
574 ///
575 /// A widget is unmapped when either it or any of its parents up to the
576 /// toplevel widget have been set as hidden.
577 ///
578 /// As `::unmap` indicates that a widget will not be shown any longer,
579 /// it can be used to, for example, stop an animation on the widget.
580 ///
581 ///
582 ///
583 ///
584 /// #### `unrealize`
585 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
586 ///
587 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
588 /// or the widget has been unmapped (that is, it is going to be hidden).
589 ///
590 ///
591 /// </details>
592 ///
593 /// # Implements
594 ///
595 /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
596 #[doc(alias = "GtkColumnView")]
597 pub struct ColumnView(Object<ffi::GtkColumnView, ffi::GtkColumnViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Scrollable;
598
599 match fn {
600 type_ => || ffi::gtk_column_view_get_type(),
601 }
602}
603
604#[cfg(not(feature = "v4_10"))]
605glib::wrapper! {
606 #[doc(alias = "GtkColumnView")]
607 pub struct ColumnView(Object<ffi::GtkColumnView, ffi::GtkColumnViewClass>) @extends Widget, @implements Buildable, ConstraintTarget, Scrollable;
608
609 match fn {
610 type_ => || ffi::gtk_column_view_get_type(),
611 }
612}
613
614impl ColumnView {
615 /// Creates a new [`ColumnView`][crate::ColumnView].
616 ///
617 /// You most likely want to call [`append_column()`][Self::append_column()]
618 /// to add columns next.
619 /// ## `model`
620 /// the list model to use
621 ///
622 /// # Returns
623 ///
624 /// a new [`ColumnView`][crate::ColumnView]
625 #[doc(alias = "gtk_column_view_new")]
626 pub fn new(model: Option<impl IsA<SelectionModel>>) -> ColumnView {
627 assert_initialized_main_thread!();
628 unsafe {
629 Widget::from_glib_none(ffi::gtk_column_view_new(
630 model.map(|p| p.upcast()).into_glib_ptr(),
631 ))
632 .unsafe_cast()
633 }
634 }
635
636 // rustdoc-stripper-ignore-next
637 /// Creates a new builder-pattern struct instance to construct [`ColumnView`] objects.
638 ///
639 /// This method returns an instance of [`ColumnViewBuilder`](crate::builders::ColumnViewBuilder) which can be used to create [`ColumnView`] objects.
640 pub fn builder() -> ColumnViewBuilder {
641 ColumnViewBuilder::new()
642 }
643
644 /// Appends the @column to the end of the columns in @self.
645 /// ## `column`
646 /// a column that hasn't been added to a [`ColumnView`][crate::ColumnView] yet
647 #[doc(alias = "gtk_column_view_append_column")]
648 pub fn append_column(&self, column: &ColumnViewColumn) {
649 unsafe {
650 ffi::gtk_column_view_append_column(self.to_glib_none().0, column.to_glib_none().0);
651 }
652 }
653
654 /// Gets the list of columns in this column view.
655 ///
656 /// This list is constant over the lifetime of @self and can be used to
657 /// monitor changes to the columns of @self by connecting to the
658 /// [`items-changed`][struct@crate::gio::ListModel#items-changed] signal.
659 ///
660 /// # Returns
661 ///
662 /// The list managing the columns
663 #[doc(alias = "gtk_column_view_get_columns")]
664 #[doc(alias = "get_columns")]
665 pub fn columns(&self) -> gio::ListModel {
666 unsafe { from_glib_none(ffi::gtk_column_view_get_columns(self.to_glib_none().0)) }
667 }
668
669 /// Returns whether rows can be selected by dragging with the mouse.
670 ///
671 /// # Returns
672 ///
673 /// true if rubberband selection is enabled
674 #[doc(alias = "gtk_column_view_get_enable_rubberband")]
675 #[doc(alias = "get_enable_rubberband")]
676 #[doc(alias = "enable-rubberband")]
677 pub fn enables_rubberband(&self) -> bool {
678 unsafe {
679 from_glib(ffi::gtk_column_view_get_enable_rubberband(
680 self.to_glib_none().0,
681 ))
682 }
683 }
684
685 /// Gets the factory that's currently used to populate section headers.
686 ///
687 /// # Returns
688 ///
689 /// The factory in use
690 #[cfg(feature = "v4_12")]
691 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
692 #[doc(alias = "gtk_column_view_get_header_factory")]
693 #[doc(alias = "get_header_factory")]
694 #[doc(alias = "header-factory")]
695 pub fn header_factory(&self) -> Option<ListItemFactory> {
696 unsafe {
697 from_glib_none(ffi::gtk_column_view_get_header_factory(
698 self.to_glib_none().0,
699 ))
700 }
701 }
702
703 /// Gets the model that's currently used to read the items displayed.
704 ///
705 /// # Returns
706 ///
707 /// The model in use
708 #[doc(alias = "gtk_column_view_get_model")]
709 #[doc(alias = "get_model")]
710 pub fn model(&self) -> Option<SelectionModel> {
711 unsafe { from_glib_none(ffi::gtk_column_view_get_model(self.to_glib_none().0)) }
712 }
713
714 /// Returns whether columns are reorderable.
715 ///
716 /// # Returns
717 ///
718 /// true if columns are reorderable
719 #[doc(alias = "gtk_column_view_get_reorderable")]
720 #[doc(alias = "get_reorderable")]
721 #[doc(alias = "reorderable")]
722 pub fn is_reorderable(&self) -> bool {
723 unsafe { from_glib(ffi::gtk_column_view_get_reorderable(self.to_glib_none().0)) }
724 }
725
726 /// Gets the factory set via [`set_row_factory()`][Self::set_row_factory()].
727 ///
728 /// # Returns
729 ///
730 /// The factory
731 #[cfg(feature = "v4_12")]
732 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
733 #[doc(alias = "gtk_column_view_get_row_factory")]
734 #[doc(alias = "get_row_factory")]
735 #[doc(alias = "row-factory")]
736 pub fn row_factory(&self) -> Option<ListItemFactory> {
737 unsafe { from_glib_none(ffi::gtk_column_view_get_row_factory(self.to_glib_none().0)) }
738 }
739
740 /// Returns whether the list should show separators between columns.
741 ///
742 /// # Returns
743 ///
744 /// true if the list shows column separators
745 #[doc(alias = "gtk_column_view_get_show_column_separators")]
746 #[doc(alias = "get_show_column_separators")]
747 #[doc(alias = "show-column-separators")]
748 pub fn shows_column_separators(&self) -> bool {
749 unsafe {
750 from_glib(ffi::gtk_column_view_get_show_column_separators(
751 self.to_glib_none().0,
752 ))
753 }
754 }
755
756 /// Returns whether the list should show separators between rows.
757 ///
758 /// # Returns
759 ///
760 /// true if the list shows separators
761 #[doc(alias = "gtk_column_view_get_show_row_separators")]
762 #[doc(alias = "get_show_row_separators")]
763 #[doc(alias = "show-row-separators")]
764 pub fn shows_row_separators(&self) -> bool {
765 unsafe {
766 from_glib(ffi::gtk_column_view_get_show_row_separators(
767 self.to_glib_none().0,
768 ))
769 }
770 }
771
772 /// Returns whether rows will be activated on single click and
773 /// selected on hover.
774 ///
775 /// # Returns
776 ///
777 /// true if rows are activated on single click
778 #[doc(alias = "gtk_column_view_get_single_click_activate")]
779 #[doc(alias = "get_single_click_activate")]
780 #[doc(alias = "single-click-activate")]
781 pub fn is_single_click_activate(&self) -> bool {
782 unsafe {
783 from_glib(ffi::gtk_column_view_get_single_click_activate(
784 self.to_glib_none().0,
785 ))
786 }
787 }
788
789 /// Returns a special sorter that reflects the users sorting
790 /// choices in the column view.
791 ///
792 /// To allow users to customizable sorting by clicking on column
793 /// headers, this sorter needs to be set on the sort model underneath
794 /// the model that is displayed by the view.
795 ///
796 /// See [`ColumnViewColumn::set_sorter()`][crate::ColumnViewColumn::set_sorter()] for setting up
797 /// per-column sorting.
798 ///
799 /// Here is an example:
800 /// **⚠️ The following code is in c ⚠️**
801 ///
802 /// ```c
803 /// gtk_column_view_column_set_sorter (column, sorter);
804 /// gtk_column_view_append_column (view, column);
805 /// sorter = g_object_ref (gtk_column_view_get_sorter (view)));
806 /// model = gtk_sort_list_model_new (store, sorter);
807 /// selection = gtk_no_selection_new (model);
808 /// gtk_column_view_set_model (view, selection);
809 /// ```
810 ///
811 /// # Returns
812 ///
813 /// the [`Sorter`][crate::Sorter] of @self
814 #[doc(alias = "gtk_column_view_get_sorter")]
815 #[doc(alias = "get_sorter")]
816 pub fn sorter(&self) -> Option<Sorter> {
817 unsafe { from_glib_none(ffi::gtk_column_view_get_sorter(self.to_glib_none().0)) }
818 }
819
820 /// key.
821 ///
822 /// # Returns
823 ///
824 /// key
825 #[cfg(feature = "v4_12")]
826 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
827 #[doc(alias = "gtk_column_view_get_tab_behavior")]
828 #[doc(alias = "get_tab_behavior")]
829 #[doc(alias = "tab-behavior")]
830 pub fn tab_behavior(&self) -> ListTabBehavior {
831 unsafe { from_glib(ffi::gtk_column_view_get_tab_behavior(self.to_glib_none().0)) }
832 }
833
834 /// Inserts a column at the given position in the columns of @self.
835 ///
836 /// If @column is already a column of @self, it will be repositioned.
837 /// ## `position`
838 /// the position to insert @column at
839 /// ## `column`
840 /// the column to insert
841 #[doc(alias = "gtk_column_view_insert_column")]
842 pub fn insert_column(&self, position: u32, column: &ColumnViewColumn) {
843 unsafe {
844 ffi::gtk_column_view_insert_column(
845 self.to_glib_none().0,
846 position,
847 column.to_glib_none().0,
848 );
849 }
850 }
851
852 /// Removes the @column from the list of columns of @self.
853 /// ## `column`
854 /// a column that's part of @self
855 #[doc(alias = "gtk_column_view_remove_column")]
856 pub fn remove_column(&self, column: &ColumnViewColumn) {
857 unsafe {
858 ffi::gtk_column_view_remove_column(self.to_glib_none().0, column.to_glib_none().0);
859 }
860 }
861
862 /// Scroll to the row at the given position - or cell if a column is
863 /// given - and performs the actions specified in @flags.
864 ///
865 /// This function works no matter if the columnview is shown or focused.
866 /// If it isn't, then the changes will take effect once that happens.
867 /// ## `pos`
868 /// position of the item. Must be less than the number of
869 /// items in the view.
870 /// ## `column`
871 /// The column to scroll to
872 /// or `NULL` to not scroll columns
873 /// ## `flags`
874 /// actions to perform
875 /// ## `scroll`
876 /// details of how to perform
877 /// the scroll operation or [`None`] to scroll into view
878 #[cfg(feature = "v4_12")]
879 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
880 #[doc(alias = "gtk_column_view_scroll_to")]
881 pub fn scroll_to(
882 &self,
883 pos: u32,
884 column: Option<&ColumnViewColumn>,
885 flags: ListScrollFlags,
886 scroll: Option<ScrollInfo>,
887 ) {
888 unsafe {
889 ffi::gtk_column_view_scroll_to(
890 self.to_glib_none().0,
891 pos,
892 column.to_glib_none().0,
893 flags.into_glib(),
894 scroll.into_glib_ptr(),
895 );
896 }
897 }
898
899 /// Sets whether selections can be changed by dragging with the mouse.
900 /// ## `enable_rubberband`
901 /// whether to enable rubberband selection
902 #[doc(alias = "gtk_column_view_set_enable_rubberband")]
903 #[doc(alias = "enable-rubberband")]
904 pub fn set_enable_rubberband(&self, enable_rubberband: bool) {
905 unsafe {
906 ffi::gtk_column_view_set_enable_rubberband(
907 self.to_glib_none().0,
908 enable_rubberband.into_glib(),
909 );
910 }
911 }
912
913 /// Sets the factory to use for populating the
914 /// [`ListHeader`][crate::ListHeader] objects used in section headers.
915 ///
916 /// If this factory is set to `NULL`, the list will not show
917 /// section headers.
918 /// ## `factory`
919 /// the factory to use
920 #[cfg(feature = "v4_12")]
921 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
922 #[doc(alias = "gtk_column_view_set_header_factory")]
923 #[doc(alias = "header-factory")]
924 pub fn set_header_factory(&self, factory: Option<&impl IsA<ListItemFactory>>) {
925 unsafe {
926 ffi::gtk_column_view_set_header_factory(
927 self.to_glib_none().0,
928 factory.map(|p| p.as_ref()).to_glib_none().0,
929 );
930 }
931 }
932
933 /// Sets the model to use.
934 ///
935 /// This must be a [`SelectionModel`][crate::SelectionModel].
936 /// ## `model`
937 /// the model to use
938 #[doc(alias = "gtk_column_view_set_model")]
939 #[doc(alias = "model")]
940 pub fn set_model(&self, model: Option<&impl IsA<SelectionModel>>) {
941 unsafe {
942 ffi::gtk_column_view_set_model(
943 self.to_glib_none().0,
944 model.map(|p| p.as_ref()).to_glib_none().0,
945 );
946 }
947 }
948
949 /// Sets whether columns should be reorderable by dragging.
950 /// ## `reorderable`
951 /// whether columns should be reorderable
952 #[doc(alias = "gtk_column_view_set_reorderable")]
953 #[doc(alias = "reorderable")]
954 pub fn set_reorderable(&self, reorderable: bool) {
955 unsafe {
956 ffi::gtk_column_view_set_reorderable(self.to_glib_none().0, reorderable.into_glib());
957 }
958 }
959
960 /// Sets the factory used for configuring rows.
961 ///
962 /// The factory must be for configuring [`ColumnViewRow`][crate::ColumnViewRow] objects.
963 ///
964 /// If this factory is not set - which is the default - then the defaults
965 /// will be used.
966 ///
967 /// This factory is not used to set the widgets displayed in the individual
968 /// cells. For that see `GtkColumnViewColumn::set_factory()` and
969 /// [`ColumnViewCell`][crate::ColumnViewCell].
970 /// ## `factory`
971 /// The row factory
972 #[cfg(feature = "v4_12")]
973 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
974 #[doc(alias = "gtk_column_view_set_row_factory")]
975 #[doc(alias = "row-factory")]
976 pub fn set_row_factory(&self, factory: Option<&impl IsA<ListItemFactory>>) {
977 unsafe {
978 ffi::gtk_column_view_set_row_factory(
979 self.to_glib_none().0,
980 factory.map(|p| p.as_ref()).to_glib_none().0,
981 );
982 }
983 }
984
985 /// Sets whether the list should show separators between columns.
986 /// ## `show_column_separators`
987 /// whether to show column separators
988 #[doc(alias = "gtk_column_view_set_show_column_separators")]
989 #[doc(alias = "show-column-separators")]
990 pub fn set_show_column_separators(&self, show_column_separators: bool) {
991 unsafe {
992 ffi::gtk_column_view_set_show_column_separators(
993 self.to_glib_none().0,
994 show_column_separators.into_glib(),
995 );
996 }
997 }
998
999 /// Sets whether the list should show separators between rows.
1000 /// ## `show_row_separators`
1001 /// whether to show row separators
1002 #[doc(alias = "gtk_column_view_set_show_row_separators")]
1003 #[doc(alias = "show-row-separators")]
1004 pub fn set_show_row_separators(&self, show_row_separators: bool) {
1005 unsafe {
1006 ffi::gtk_column_view_set_show_row_separators(
1007 self.to_glib_none().0,
1008 show_row_separators.into_glib(),
1009 );
1010 }
1011 }
1012
1013 /// Sets whether rows should be activated on single click and
1014 /// selected on hover.
1015 /// ## `single_click_activate`
1016 /// whether to activate items on single click
1017 #[doc(alias = "gtk_column_view_set_single_click_activate")]
1018 #[doc(alias = "single-click-activate")]
1019 pub fn set_single_click_activate(&self, single_click_activate: bool) {
1020 unsafe {
1021 ffi::gtk_column_view_set_single_click_activate(
1022 self.to_glib_none().0,
1023 single_click_activate.into_glib(),
1024 );
1025 }
1026 }
1027
1028 /// keys move the
1029 /// focus in the columnview.
1030 /// ## `tab_behavior`
1031 /// The desired tab behavior
1032 #[cfg(feature = "v4_12")]
1033 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1034 #[doc(alias = "gtk_column_view_set_tab_behavior")]
1035 #[doc(alias = "tab-behavior")]
1036 pub fn set_tab_behavior(&self, tab_behavior: ListTabBehavior) {
1037 unsafe {
1038 ffi::gtk_column_view_set_tab_behavior(self.to_glib_none().0, tab_behavior.into_glib());
1039 }
1040 }
1041
1042 /// Sets the sorting of the view.
1043 ///
1044 /// This function should be used to set up the initial sorting.
1045 /// At runtime, users can change the sorting of a column view
1046 /// by clicking on the list headers.
1047 ///
1048 /// This call only has an effect if the sorter returned by
1049 /// [`sorter()`][Self::sorter()] is set on a sort model,
1050 /// and [`ColumnViewColumn::set_sorter()`][crate::ColumnViewColumn::set_sorter()] has been called
1051 /// on @column to associate a sorter with the column.
1052 ///
1053 /// If @column is unset, the view will be unsorted.
1054 /// ## `column`
1055 /// the column to sort by
1056 /// ## `direction`
1057 /// the direction to sort in
1058 #[doc(alias = "gtk_column_view_sort_by_column")]
1059 pub fn sort_by_column(&self, column: Option<&ColumnViewColumn>, direction: SortType) {
1060 unsafe {
1061 ffi::gtk_column_view_sort_by_column(
1062 self.to_glib_none().0,
1063 column.to_glib_none().0,
1064 direction.into_glib(),
1065 );
1066 }
1067 }
1068
1069 /// Emitted when a row has been activated by the user, usually via activating
1070 /// the GtkListBase|list.activate-item action.
1071 ///
1072 /// This allows for a convenient way to handle activation in a columnview.
1073 /// See [`ListItemExt::set_activatable()`][crate::prelude::ListItemExt::set_activatable()] for details on how to use this
1074 /// signal.
1075 /// ## `position`
1076 /// position of item to activate
1077 #[doc(alias = "activate")]
1078 pub fn connect_activate<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1079 unsafe extern "C" fn activate_trampoline<F: Fn(&ColumnView, u32) + 'static>(
1080 this: *mut ffi::GtkColumnView,
1081 position: std::ffi::c_uint,
1082 f: glib::ffi::gpointer,
1083 ) {
1084 unsafe {
1085 let f: &F = &*(f as *const F);
1086 f(&from_glib_borrow(this), position)
1087 }
1088 }
1089 unsafe {
1090 let f: Box_<F> = Box_::new(f);
1091 connect_raw(
1092 self.as_ptr() as *mut _,
1093 c"activate".as_ptr(),
1094 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1095 activate_trampoline::<F> as *const (),
1096 )),
1097 Box_::into_raw(f),
1098 )
1099 }
1100 }
1101
1102 #[doc(alias = "columns")]
1103 pub fn connect_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1104 unsafe extern "C" fn notify_columns_trampoline<F: Fn(&ColumnView) + 'static>(
1105 this: *mut ffi::GtkColumnView,
1106 _param_spec: glib::ffi::gpointer,
1107 f: glib::ffi::gpointer,
1108 ) {
1109 unsafe {
1110 let f: &F = &*(f as *const F);
1111 f(&from_glib_borrow(this))
1112 }
1113 }
1114 unsafe {
1115 let f: Box_<F> = Box_::new(f);
1116 connect_raw(
1117 self.as_ptr() as *mut _,
1118 c"notify::columns".as_ptr(),
1119 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1120 notify_columns_trampoline::<F> as *const (),
1121 )),
1122 Box_::into_raw(f),
1123 )
1124 }
1125 }
1126
1127 #[doc(alias = "enable-rubberband")]
1128 pub fn connect_enable_rubberband_notify<F: Fn(&Self) + 'static>(
1129 &self,
1130 f: F,
1131 ) -> SignalHandlerId {
1132 unsafe extern "C" fn notify_enable_rubberband_trampoline<F: Fn(&ColumnView) + 'static>(
1133 this: *mut ffi::GtkColumnView,
1134 _param_spec: glib::ffi::gpointer,
1135 f: glib::ffi::gpointer,
1136 ) {
1137 unsafe {
1138 let f: &F = &*(f as *const F);
1139 f(&from_glib_borrow(this))
1140 }
1141 }
1142 unsafe {
1143 let f: Box_<F> = Box_::new(f);
1144 connect_raw(
1145 self.as_ptr() as *mut _,
1146 c"notify::enable-rubberband".as_ptr(),
1147 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1148 notify_enable_rubberband_trampoline::<F> as *const (),
1149 )),
1150 Box_::into_raw(f),
1151 )
1152 }
1153 }
1154
1155 #[cfg(feature = "v4_12")]
1156 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1157 #[doc(alias = "header-factory")]
1158 pub fn connect_header_factory_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1159 unsafe extern "C" fn notify_header_factory_trampoline<F: Fn(&ColumnView) + 'static>(
1160 this: *mut ffi::GtkColumnView,
1161 _param_spec: glib::ffi::gpointer,
1162 f: glib::ffi::gpointer,
1163 ) {
1164 unsafe {
1165 let f: &F = &*(f as *const F);
1166 f(&from_glib_borrow(this))
1167 }
1168 }
1169 unsafe {
1170 let f: Box_<F> = Box_::new(f);
1171 connect_raw(
1172 self.as_ptr() as *mut _,
1173 c"notify::header-factory".as_ptr(),
1174 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1175 notify_header_factory_trampoline::<F> as *const (),
1176 )),
1177 Box_::into_raw(f),
1178 )
1179 }
1180 }
1181
1182 #[doc(alias = "model")]
1183 pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1184 unsafe extern "C" fn notify_model_trampoline<F: Fn(&ColumnView) + 'static>(
1185 this: *mut ffi::GtkColumnView,
1186 _param_spec: glib::ffi::gpointer,
1187 f: glib::ffi::gpointer,
1188 ) {
1189 unsafe {
1190 let f: &F = &*(f as *const F);
1191 f(&from_glib_borrow(this))
1192 }
1193 }
1194 unsafe {
1195 let f: Box_<F> = Box_::new(f);
1196 connect_raw(
1197 self.as_ptr() as *mut _,
1198 c"notify::model".as_ptr(),
1199 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1200 notify_model_trampoline::<F> as *const (),
1201 )),
1202 Box_::into_raw(f),
1203 )
1204 }
1205 }
1206
1207 #[doc(alias = "reorderable")]
1208 pub fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1209 unsafe extern "C" fn notify_reorderable_trampoline<F: Fn(&ColumnView) + 'static>(
1210 this: *mut ffi::GtkColumnView,
1211 _param_spec: glib::ffi::gpointer,
1212 f: glib::ffi::gpointer,
1213 ) {
1214 unsafe {
1215 let f: &F = &*(f as *const F);
1216 f(&from_glib_borrow(this))
1217 }
1218 }
1219 unsafe {
1220 let f: Box_<F> = Box_::new(f);
1221 connect_raw(
1222 self.as_ptr() as *mut _,
1223 c"notify::reorderable".as_ptr(),
1224 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1225 notify_reorderable_trampoline::<F> as *const (),
1226 )),
1227 Box_::into_raw(f),
1228 )
1229 }
1230 }
1231
1232 #[cfg(feature = "v4_12")]
1233 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1234 #[doc(alias = "row-factory")]
1235 pub fn connect_row_factory_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1236 unsafe extern "C" fn notify_row_factory_trampoline<F: Fn(&ColumnView) + 'static>(
1237 this: *mut ffi::GtkColumnView,
1238 _param_spec: glib::ffi::gpointer,
1239 f: glib::ffi::gpointer,
1240 ) {
1241 unsafe {
1242 let f: &F = &*(f as *const F);
1243 f(&from_glib_borrow(this))
1244 }
1245 }
1246 unsafe {
1247 let f: Box_<F> = Box_::new(f);
1248 connect_raw(
1249 self.as_ptr() as *mut _,
1250 c"notify::row-factory".as_ptr(),
1251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1252 notify_row_factory_trampoline::<F> as *const (),
1253 )),
1254 Box_::into_raw(f),
1255 )
1256 }
1257 }
1258
1259 #[doc(alias = "show-column-separators")]
1260 pub fn connect_show_column_separators_notify<F: Fn(&Self) + 'static>(
1261 &self,
1262 f: F,
1263 ) -> SignalHandlerId {
1264 unsafe extern "C" fn notify_show_column_separators_trampoline<
1265 F: Fn(&ColumnView) + 'static,
1266 >(
1267 this: *mut ffi::GtkColumnView,
1268 _param_spec: glib::ffi::gpointer,
1269 f: glib::ffi::gpointer,
1270 ) {
1271 unsafe {
1272 let f: &F = &*(f as *const F);
1273 f(&from_glib_borrow(this))
1274 }
1275 }
1276 unsafe {
1277 let f: Box_<F> = Box_::new(f);
1278 connect_raw(
1279 self.as_ptr() as *mut _,
1280 c"notify::show-column-separators".as_ptr(),
1281 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1282 notify_show_column_separators_trampoline::<F> as *const (),
1283 )),
1284 Box_::into_raw(f),
1285 )
1286 }
1287 }
1288
1289 #[doc(alias = "show-row-separators")]
1290 pub fn connect_show_row_separators_notify<F: Fn(&Self) + 'static>(
1291 &self,
1292 f: F,
1293 ) -> SignalHandlerId {
1294 unsafe extern "C" fn notify_show_row_separators_trampoline<F: Fn(&ColumnView) + 'static>(
1295 this: *mut ffi::GtkColumnView,
1296 _param_spec: glib::ffi::gpointer,
1297 f: glib::ffi::gpointer,
1298 ) {
1299 unsafe {
1300 let f: &F = &*(f as *const F);
1301 f(&from_glib_borrow(this))
1302 }
1303 }
1304 unsafe {
1305 let f: Box_<F> = Box_::new(f);
1306 connect_raw(
1307 self.as_ptr() as *mut _,
1308 c"notify::show-row-separators".as_ptr(),
1309 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1310 notify_show_row_separators_trampoline::<F> as *const (),
1311 )),
1312 Box_::into_raw(f),
1313 )
1314 }
1315 }
1316
1317 #[doc(alias = "single-click-activate")]
1318 pub fn connect_single_click_activate_notify<F: Fn(&Self) + 'static>(
1319 &self,
1320 f: F,
1321 ) -> SignalHandlerId {
1322 unsafe extern "C" fn notify_single_click_activate_trampoline<
1323 F: Fn(&ColumnView) + 'static,
1324 >(
1325 this: *mut ffi::GtkColumnView,
1326 _param_spec: glib::ffi::gpointer,
1327 f: glib::ffi::gpointer,
1328 ) {
1329 unsafe {
1330 let f: &F = &*(f as *const F);
1331 f(&from_glib_borrow(this))
1332 }
1333 }
1334 unsafe {
1335 let f: Box_<F> = Box_::new(f);
1336 connect_raw(
1337 self.as_ptr() as *mut _,
1338 c"notify::single-click-activate".as_ptr(),
1339 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1340 notify_single_click_activate_trampoline::<F> as *const (),
1341 )),
1342 Box_::into_raw(f),
1343 )
1344 }
1345 }
1346
1347 #[doc(alias = "sorter")]
1348 pub fn connect_sorter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1349 unsafe extern "C" fn notify_sorter_trampoline<F: Fn(&ColumnView) + 'static>(
1350 this: *mut ffi::GtkColumnView,
1351 _param_spec: glib::ffi::gpointer,
1352 f: glib::ffi::gpointer,
1353 ) {
1354 unsafe {
1355 let f: &F = &*(f as *const F);
1356 f(&from_glib_borrow(this))
1357 }
1358 }
1359 unsafe {
1360 let f: Box_<F> = Box_::new(f);
1361 connect_raw(
1362 self.as_ptr() as *mut _,
1363 c"notify::sorter".as_ptr(),
1364 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1365 notify_sorter_trampoline::<F> as *const (),
1366 )),
1367 Box_::into_raw(f),
1368 )
1369 }
1370 }
1371
1372 #[cfg(feature = "v4_12")]
1373 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1374 #[doc(alias = "tab-behavior")]
1375 pub fn connect_tab_behavior_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1376 unsafe extern "C" fn notify_tab_behavior_trampoline<F: Fn(&ColumnView) + 'static>(
1377 this: *mut ffi::GtkColumnView,
1378 _param_spec: glib::ffi::gpointer,
1379 f: glib::ffi::gpointer,
1380 ) {
1381 unsafe {
1382 let f: &F = &*(f as *const F);
1383 f(&from_glib_borrow(this))
1384 }
1385 }
1386 unsafe {
1387 let f: Box_<F> = Box_::new(f);
1388 connect_raw(
1389 self.as_ptr() as *mut _,
1390 c"notify::tab-behavior".as_ptr(),
1391 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1392 notify_tab_behavior_trampoline::<F> as *const (),
1393 )),
1394 Box_::into_raw(f),
1395 )
1396 }
1397 }
1398}
1399
1400impl Default for ColumnView {
1401 fn default() -> Self {
1402 glib::object::Object::new::<Self>()
1403 }
1404}
1405
1406// rustdoc-stripper-ignore-next
1407/// A [builder-pattern] type to construct [`ColumnView`] objects.
1408///
1409/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1410#[must_use = "The builder must be built to be used"]
1411pub struct ColumnViewBuilder {
1412 builder: glib::object::ObjectBuilder<'static, ColumnView>,
1413}
1414
1415impl ColumnViewBuilder {
1416 fn new() -> Self {
1417 Self {
1418 builder: glib::object::Object::builder(),
1419 }
1420 }
1421
1422 /// Allow rubberband selection.
1423 pub fn enable_rubberband(self, enable_rubberband: bool) -> Self {
1424 Self {
1425 builder: self
1426 .builder
1427 .property("enable-rubberband", enable_rubberband),
1428 }
1429 }
1430
1431 /// Factory for creating header widgets.
1432 ///
1433 /// The factory must be for configuring [`ListHeader`][crate::ListHeader] objects.
1434 #[cfg(feature = "v4_12")]
1435 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1436 pub fn header_factory(self, header_factory: &impl IsA<ListItemFactory>) -> Self {
1437 Self {
1438 builder: self
1439 .builder
1440 .property("header-factory", header_factory.clone().upcast()),
1441 }
1442 }
1443
1444 /// Model for the items displayed.
1445 pub fn model(self, model: &impl IsA<SelectionModel>) -> Self {
1446 Self {
1447 builder: self.builder.property("model", model.clone().upcast()),
1448 }
1449 }
1450
1451 /// Whether columns are reorderable.
1452 pub fn reorderable(self, reorderable: bool) -> Self {
1453 Self {
1454 builder: self.builder.property("reorderable", reorderable),
1455 }
1456 }
1457
1458 /// The factory used for configuring rows.
1459 ///
1460 /// The factory must be for configuring [`ColumnViewRow`][crate::ColumnViewRow] objects.
1461 #[cfg(feature = "v4_12")]
1462 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1463 pub fn row_factory(self, row_factory: &impl IsA<ListItemFactory>) -> Self {
1464 Self {
1465 builder: self
1466 .builder
1467 .property("row-factory", row_factory.clone().upcast()),
1468 }
1469 }
1470
1471 /// Show separators between columns.
1472 pub fn show_column_separators(self, show_column_separators: bool) -> Self {
1473 Self {
1474 builder: self
1475 .builder
1476 .property("show-column-separators", show_column_separators),
1477 }
1478 }
1479
1480 /// Show separators between rows.
1481 pub fn show_row_separators(self, show_row_separators: bool) -> Self {
1482 Self {
1483 builder: self
1484 .builder
1485 .property("show-row-separators", show_row_separators),
1486 }
1487 }
1488
1489 /// Activate rows on single click and select them on hover.
1490 pub fn single_click_activate(self, single_click_activate: bool) -> Self {
1491 Self {
1492 builder: self
1493 .builder
1494 .property("single-click-activate", single_click_activate),
1495 }
1496 }
1497
1498 /// key
1499 #[cfg(feature = "v4_12")]
1500 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1501 pub fn tab_behavior(self, tab_behavior: ListTabBehavior) -> Self {
1502 Self {
1503 builder: self.builder.property("tab-behavior", tab_behavior),
1504 }
1505 }
1506
1507 /// Whether the widget or any of its descendents can accept
1508 /// the input focus.
1509 ///
1510 /// This property is meant to be set by widget implementations,
1511 /// typically in their instance init function.
1512 pub fn can_focus(self, can_focus: bool) -> Self {
1513 Self {
1514 builder: self.builder.property("can-focus", can_focus),
1515 }
1516 }
1517
1518 /// Whether the widget can receive pointer events.
1519 pub fn can_target(self, can_target: bool) -> Self {
1520 Self {
1521 builder: self.builder.property("can-target", can_target),
1522 }
1523 }
1524
1525 /// A list of css classes applied to this widget.
1526 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1527 Self {
1528 builder: self.builder.property("css-classes", css_classes.into()),
1529 }
1530 }
1531
1532 /// The name of this widget in the CSS tree.
1533 ///
1534 /// This property is meant to be set by widget implementations,
1535 /// typically in their instance init function.
1536 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1537 Self {
1538 builder: self.builder.property("css-name", css_name.into()),
1539 }
1540 }
1541
1542 /// The cursor used by @widget.
1543 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1544 Self {
1545 builder: self.builder.property("cursor", cursor.clone()),
1546 }
1547 }
1548
1549 /// Whether the widget should grab focus when it is clicked with the mouse.
1550 ///
1551 /// This property is only relevant for widgets that can take focus.
1552 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1553 Self {
1554 builder: self.builder.property("focus-on-click", focus_on_click),
1555 }
1556 }
1557
1558 /// Whether this widget itself will accept the input focus.
1559 pub fn focusable(self, focusable: bool) -> Self {
1560 Self {
1561 builder: self.builder.property("focusable", focusable),
1562 }
1563 }
1564
1565 /// How to distribute horizontal space if widget gets extra space.
1566 pub fn halign(self, halign: Align) -> Self {
1567 Self {
1568 builder: self.builder.property("halign", halign),
1569 }
1570 }
1571
1572 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1573 /// signal on @widget.
1574 ///
1575 /// A true value indicates that @widget can have a tooltip, in this case
1576 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1577 /// determine whether it will provide a tooltip or not.
1578 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1579 Self {
1580 builder: self.builder.property("has-tooltip", has_tooltip),
1581 }
1582 }
1583
1584 /// Overrides for height request of the widget.
1585 ///
1586 /// If this is -1, the natural request will be used.
1587 pub fn height_request(self, height_request: i32) -> Self {
1588 Self {
1589 builder: self.builder.property("height-request", height_request),
1590 }
1591 }
1592
1593 /// Whether to expand horizontally.
1594 pub fn hexpand(self, hexpand: bool) -> Self {
1595 Self {
1596 builder: self.builder.property("hexpand", hexpand),
1597 }
1598 }
1599
1600 /// Whether to use the `hexpand` property.
1601 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1602 Self {
1603 builder: self.builder.property("hexpand-set", hexpand_set),
1604 }
1605 }
1606
1607 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1608 /// the preferred size of the widget, and allocate its children.
1609 ///
1610 /// This property is meant to be set by widget implementations,
1611 /// typically in their instance init function.
1612 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1613 Self {
1614 builder: self
1615 .builder
1616 .property("layout-manager", layout_manager.clone().upcast()),
1617 }
1618 }
1619
1620 /// Makes this widget act like a modal dialog, with respect to
1621 /// event delivery.
1622 ///
1623 /// Global event controllers will not handle events with targets
1624 /// inside the widget, unless they are set up to ignore propagation
1625 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1626 #[cfg(feature = "v4_18")]
1627 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1628 pub fn limit_events(self, limit_events: bool) -> Self {
1629 Self {
1630 builder: self.builder.property("limit-events", limit_events),
1631 }
1632 }
1633
1634 /// Margin on bottom side of widget.
1635 ///
1636 /// This property adds margin outside of the widget's normal size
1637 /// request, the margin will be added in addition to the size from
1638 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1639 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1640 Self {
1641 builder: self.builder.property("margin-bottom", margin_bottom),
1642 }
1643 }
1644
1645 /// Margin on end of widget, horizontally.
1646 ///
1647 /// This property supports left-to-right and right-to-left text
1648 /// directions.
1649 ///
1650 /// This property adds margin outside of the widget's normal size
1651 /// request, the margin will be added in addition to the size from
1652 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1653 pub fn margin_end(self, margin_end: i32) -> Self {
1654 Self {
1655 builder: self.builder.property("margin-end", margin_end),
1656 }
1657 }
1658
1659 /// Margin on start of widget, horizontally.
1660 ///
1661 /// This property supports left-to-right and right-to-left text
1662 /// directions.
1663 ///
1664 /// This property adds margin outside of the widget's normal size
1665 /// request, the margin will be added in addition to the size from
1666 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1667 pub fn margin_start(self, margin_start: i32) -> Self {
1668 Self {
1669 builder: self.builder.property("margin-start", margin_start),
1670 }
1671 }
1672
1673 /// Margin on top side of widget.
1674 ///
1675 /// This property adds margin outside of the widget's normal size
1676 /// request, the margin will be added in addition to the size from
1677 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1678 pub fn margin_top(self, margin_top: i32) -> Self {
1679 Self {
1680 builder: self.builder.property("margin-top", margin_top),
1681 }
1682 }
1683
1684 /// The name of the widget.
1685 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1686 Self {
1687 builder: self.builder.property("name", name.into()),
1688 }
1689 }
1690
1691 /// The requested opacity of the widget.
1692 pub fn opacity(self, opacity: f64) -> Self {
1693 Self {
1694 builder: self.builder.property("opacity", opacity),
1695 }
1696 }
1697
1698 /// How content outside the widget's content area is treated.
1699 ///
1700 /// This property is meant to be set by widget implementations,
1701 /// typically in their instance init function.
1702 pub fn overflow(self, overflow: Overflow) -> Self {
1703 Self {
1704 builder: self.builder.property("overflow", overflow),
1705 }
1706 }
1707
1708 /// Whether the widget will receive the default action when it is focused.
1709 pub fn receives_default(self, receives_default: bool) -> Self {
1710 Self {
1711 builder: self.builder.property("receives-default", receives_default),
1712 }
1713 }
1714
1715 /// Whether the widget responds to input.
1716 pub fn sensitive(self, sensitive: bool) -> Self {
1717 Self {
1718 builder: self.builder.property("sensitive", sensitive),
1719 }
1720 }
1721
1722 /// Sets the text of tooltip to be the given string, which is marked up
1723 /// with Pango markup.
1724 ///
1725 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1726 ///
1727 /// This is a convenience property which will take care of getting the
1728 /// tooltip shown if the given string is not `NULL`:
1729 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1730 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1731 /// the default signal handler.
1732 ///
1733 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1734 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1735 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1736 Self {
1737 builder: self
1738 .builder
1739 .property("tooltip-markup", tooltip_markup.into()),
1740 }
1741 }
1742
1743 /// Sets the text of tooltip to be the given string.
1744 ///
1745 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1746 ///
1747 /// This is a convenience property which will take care of getting the
1748 /// tooltip shown if the given string is not `NULL`:
1749 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1750 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1751 /// the default signal handler.
1752 ///
1753 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1754 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1755 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1756 Self {
1757 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1758 }
1759 }
1760
1761 /// How to distribute vertical space if widget gets extra space.
1762 pub fn valign(self, valign: Align) -> Self {
1763 Self {
1764 builder: self.builder.property("valign", valign),
1765 }
1766 }
1767
1768 /// Whether to expand vertically.
1769 pub fn vexpand(self, vexpand: bool) -> Self {
1770 Self {
1771 builder: self.builder.property("vexpand", vexpand),
1772 }
1773 }
1774
1775 /// Whether to use the `vexpand` property.
1776 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1777 Self {
1778 builder: self.builder.property("vexpand-set", vexpand_set),
1779 }
1780 }
1781
1782 /// Whether the widget is visible.
1783 pub fn visible(self, visible: bool) -> Self {
1784 Self {
1785 builder: self.builder.property("visible", visible),
1786 }
1787 }
1788
1789 /// Overrides for width request of the widget.
1790 ///
1791 /// If this is -1, the natural request will be used.
1792 pub fn width_request(self, width_request: i32) -> Self {
1793 Self {
1794 builder: self.builder.property("width-request", width_request),
1795 }
1796 }
1797
1798 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1799 ///
1800 /// The accessible role cannot be changed once set.
1801 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1802 Self {
1803 builder: self.builder.property("accessible-role", accessible_role),
1804 }
1805 }
1806
1807 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
1808 ///
1809 /// This adjustment is shared between the scrollable widget and its parent.
1810 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1811 Self {
1812 builder: self
1813 .builder
1814 .property("hadjustment", hadjustment.clone().upcast()),
1815 }
1816 }
1817
1818 /// Determines when horizontal scrolling should start.
1819 pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1820 Self {
1821 builder: self.builder.property("hscroll-policy", hscroll_policy),
1822 }
1823 }
1824
1825 /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
1826 ///
1827 /// This adjustment is shared between the scrollable widget and its parent.
1828 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1829 Self {
1830 builder: self
1831 .builder
1832 .property("vadjustment", vadjustment.clone().upcast()),
1833 }
1834 }
1835
1836 /// Determines when vertical scrolling should start.
1837 pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1838 Self {
1839 builder: self.builder.property("vscroll-policy", vscroll_policy),
1840 }
1841 }
1842
1843 // rustdoc-stripper-ignore-next
1844 /// Build the [`ColumnView`].
1845 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1846 pub fn build(self) -> ColumnView {
1847 assert_initialized_main_thread!();
1848 self.builder.build()
1849 }
1850}