Skip to main content

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