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