Skip to main content

libshumate/auto/
marker_layer.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{Layer, Marker, Viewport, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15#[cfg(feature = "gtk_v4_10")]
16#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_10")))]
17glib::wrapper! {
18    /// Displays markers on the map. It is responsible for positioning markers
19    /// correctly, marker selections and group marker operations.
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `selection-mode`
25    ///  Determines the type of selection that will be performed.
26    ///
27    /// Readable | Writable
28    /// <details><summary><h4>Layer</h4></summary>
29    ///
30    ///
31    /// #### `viewport`
32    ///  Readable | Writable | Construct Only
33    /// </details>
34    /// <details><summary><h4>Widget</h4></summary>
35    ///
36    ///
37    /// #### `can-focus`
38    ///  Whether the widget or any of its descendents can accept
39    /// the input focus.
40    ///
41    /// This property is meant to be set by widget implementations,
42    /// typically in their instance init function.
43    ///
44    /// Readable | Writable
45    ///
46    ///
47    /// #### `can-target`
48    ///  Whether the widget can receive pointer events.
49    ///
50    /// Readable | Writable
51    ///
52    ///
53    /// #### `css-classes`
54    ///  A list of css classes applied to this widget.
55    ///
56    /// Readable | Writable
57    ///
58    ///
59    /// #### `css-name`
60    ///  The name of this widget in the CSS tree.
61    ///
62    /// This property is meant to be set by widget implementations,
63    /// typically in their instance init function.
64    ///
65    /// Readable | Writable | Construct Only
66    ///
67    ///
68    /// #### `cursor`
69    ///  The cursor used by @widget.
70    ///
71    /// Readable | Writable
72    ///
73    ///
74    /// #### `focus-on-click`
75    ///  Whether the widget should grab focus when it is clicked with the mouse.
76    ///
77    /// This property is only relevant for widgets that can take focus.
78    ///
79    /// Readable | Writable
80    ///
81    ///
82    /// #### `focusable`
83    ///  Whether this widget itself will accept the input focus.
84    ///
85    /// Readable | Writable
86    ///
87    ///
88    /// #### `halign`
89    ///  How to distribute horizontal space if widget gets extra space.
90    ///
91    /// Readable | Writable
92    ///
93    ///
94    /// #### `has-default`
95    ///  Whether the widget is the default widget.
96    ///
97    /// Readable
98    ///
99    ///
100    /// #### `has-focus`
101    ///  Whether the widget has the input focus.
102    ///
103    /// Readable
104    ///
105    ///
106    /// #### `has-tooltip`
107    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
108    /// signal on @widget.
109    ///
110    /// A true value indicates that @widget can have a tooltip, in this case
111    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
112    /// determine whether it will provide a tooltip or not.
113    ///
114    /// Readable | Writable
115    ///
116    ///
117    /// #### `height-request`
118    ///  Overrides for height request of the widget.
119    ///
120    /// If this is -1, the natural request will be used.
121    ///
122    /// Readable | Writable
123    ///
124    ///
125    /// #### `hexpand`
126    ///  Whether to expand horizontally.
127    ///
128    /// Readable | Writable
129    ///
130    ///
131    /// #### `hexpand-set`
132    ///  Whether to use the `hexpand` property.
133    ///
134    /// Readable | Writable
135    ///
136    ///
137    /// #### `layout-manager`
138    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
139    /// the preferred size of the widget, and allocate its children.
140    ///
141    /// This property is meant to be set by widget implementations,
142    /// typically in their instance init function.
143    ///
144    /// Readable | Writable
145    ///
146    ///
147    /// #### `limit-events`
148    ///  Makes this widget act like a modal dialog, with respect to
149    /// event delivery.
150    ///
151    /// Global event controllers will not handle events with targets
152    /// inside the widget, unless they are set up to ignore propagation
153    /// limits. See `Gtk::EventController::set_propagation_limit()`.
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `margin-bottom`
159    ///  Margin on bottom side of widget.
160    ///
161    /// This property adds margin outside of the widget's normal size
162    /// request, the margin will be added in addition to the size from
163    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `margin-end`
169    ///  Margin on end of widget, horizontally.
170    ///
171    /// This property supports left-to-right and right-to-left text
172    /// directions.
173    ///
174    /// This property adds margin outside of the widget's normal size
175    /// request, the margin will be added in addition to the size from
176    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
177    ///
178    /// Readable | Writable
179    ///
180    ///
181    /// #### `margin-start`
182    ///  Margin on start of widget, horizontally.
183    ///
184    /// This property supports left-to-right and right-to-left text
185    /// directions.
186    ///
187    /// This property adds margin outside of the widget's normal size
188    /// request, the margin will be added in addition to the size from
189    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
190    ///
191    /// Readable | Writable
192    ///
193    ///
194    /// #### `margin-top`
195    ///  Margin on top side of widget.
196    ///
197    /// This property adds margin outside of the widget's normal size
198    /// request, the margin will be added in addition to the size from
199    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `name`
205    ///  The name of the widget.
206    ///
207    /// Readable | Writable
208    ///
209    ///
210    /// #### `opacity`
211    ///  The requested opacity of the widget.
212    ///
213    /// Readable | Writable
214    ///
215    ///
216    /// #### `overflow`
217    ///  How content outside the widget's content area is treated.
218    ///
219    /// This property is meant to be set by widget implementations,
220    /// typically in their instance init function.
221    ///
222    /// Readable | Writable
223    ///
224    ///
225    /// #### `parent`
226    ///  The parent widget of this widget.
227    ///
228    /// Readable
229    ///
230    ///
231    /// #### `receives-default`
232    ///  Whether the widget will receive the default action when it is focused.
233    ///
234    /// Readable | Writable
235    ///
236    ///
237    /// #### `root`
238    ///  The `GtkRoot` widget of the widget tree containing this widget.
239    ///
240    /// This will be `NULL` if the widget is not contained in a root widget.
241    ///
242    /// Readable
243    ///
244    ///
245    /// #### `scale-factor`
246    ///  The scale factor of the widget.
247    ///
248    /// Readable
249    ///
250    ///
251    /// #### `sensitive`
252    ///  Whether the widget responds to input.
253    ///
254    /// Readable | Writable
255    ///
256    ///
257    /// #### `tooltip-markup`
258    ///  Sets the text of tooltip to be the given string, which is marked up
259    /// with Pango markup.
260    ///
261    /// Also see `Gtk::Tooltip::set_markup()`.
262    ///
263    /// This is a convenience property which will take care of getting the
264    /// tooltip shown if the given string is not `NULL`:
265    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
266    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
267    /// the default signal handler.
268    ///
269    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
270    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
271    ///
272    /// Readable | Writable
273    ///
274    ///
275    /// #### `tooltip-text`
276    ///  Sets the text of tooltip to be the given string.
277    ///
278    /// Also see `Gtk::Tooltip::set_text()`.
279    ///
280    /// This is a convenience property which will take care of getting the
281    /// tooltip shown if the given string is not `NULL`:
282    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
283    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
284    /// the default signal handler.
285    ///
286    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
287    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
288    ///
289    /// Readable | Writable
290    ///
291    ///
292    /// #### `valign`
293    ///  How to distribute vertical space if widget gets extra space.
294    ///
295    /// Readable | Writable
296    ///
297    ///
298    /// #### `vexpand`
299    ///  Whether to expand vertically.
300    ///
301    /// Readable | Writable
302    ///
303    ///
304    /// #### `vexpand-set`
305    ///  Whether to use the `vexpand` property.
306    ///
307    /// Readable | Writable
308    ///
309    ///
310    /// #### `visible`
311    ///  Whether the widget is visible.
312    ///
313    /// Readable | Writable
314    ///
315    ///
316    /// #### `width-request`
317    ///  Overrides for width request of the widget.
318    ///
319    /// If this is -1, the natural request will be used.
320    ///
321    /// Readable | Writable
322    /// </details>
323    /// <details><summary><h4>Accessible</h4></summary>
324    ///
325    ///
326    /// #### `accessible-role`
327    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
328    ///
329    /// The accessible role cannot be changed once set.
330    ///
331    /// Readable | Writable
332    /// </details>
333    ///
334    /// ## Signals
335    ///
336    ///
337    /// #### `marker-selected`
338    ///  Emitted when a marker in the layer is selected.
339    ///
340    ///
341    ///
342    ///
343    /// #### `marker-unselected`
344    ///  Emitted when a marker in the layer is unselected.
345    ///
346    ///
347    /// <details><summary><h4>Widget</h4></summary>
348    ///
349    ///
350    /// #### `destroy`
351    ///  Signals that all holders of a reference to the widget should release
352    /// the reference that they hold.
353    ///
354    /// May result in finalization of the widget if all references are released.
355    ///
356    /// This signal is not suitable for saving widget state.
357    ///
358    ///
359    ///
360    ///
361    /// #### `direction-changed`
362    ///  Emitted when the text direction of a widget changes.
363    ///
364    ///
365    ///
366    ///
367    /// #### `hide`
368    ///  Emitted when @widget is hidden.
369    ///
370    ///
371    ///
372    ///
373    /// #### `keynav-failed`
374    ///  Emitted if keyboard navigation fails.
375    ///
376    /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
377    ///
378    ///
379    ///
380    ///
381    /// #### `map`
382    ///  Emitted when @widget is going to be mapped.
383    ///
384    /// A widget is mapped when the widget is visible (which is controlled with
385    /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
386    /// are also visible.
387    ///
388    /// The `::map` signal can be used to determine whether a widget will be drawn,
389    /// for instance it can resume an animation that was stopped during the
390    /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
391    ///
392    ///
393    ///
394    ///
395    /// #### `mnemonic-activate`
396    ///  Emitted when a widget is activated via a mnemonic.
397    ///
398    /// The default handler for this signal activates @widget if @group_cycling
399    /// is false, or just makes @widget grab focus if @group_cycling is true.
400    ///
401    ///
402    ///
403    ///
404    /// #### `move-focus`
405    ///   to move backward.
406    ///
407    /// Action
408    ///
409    ///
410    /// #### `query-tooltip`
411    ///  s tooltip is about to be shown.
412    ///
413    /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
414    /// is true and the hover timeout has expired with the cursor hovering
415    /// above @widget; or emitted when @widget got focus in keyboard mode.
416    ///
417    /// Using the given coordinates, the signal handler should determine
418    /// whether a tooltip should be shown for @widget. If this is the case
419    /// true should be returned, false otherwise. Note that if @keyboard_mode
420    /// is true, the values of @x and @y are undefined and should not be used.
421    ///
422    /// The signal handler is free to manipulate @tooltip with the therefore
423    /// destined function calls.
424    ///
425    ///
426    ///
427    ///
428    /// #### `realize`
429    ///  Emitted when @widget is associated with a `GdkSurface`.
430    ///
431    /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
432    /// or the widget has been mapped (that is, it is going to be drawn).
433    ///
434    ///
435    ///
436    ///
437    /// #### `show`
438    ///  Emitted when @widget is shown.
439    ///
440    ///
441    ///
442    ///
443    /// #### `state-flags-changed`
444    ///  Emitted when the widget state changes.
445    ///
446    /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
447    ///
448    ///
449    ///
450    ///
451    /// #### `unmap`
452    ///  Emitted when @widget is going to be unmapped.
453    ///
454    /// A widget is unmapped when either it or any of its parents up to the
455    /// toplevel widget have been set as hidden.
456    ///
457    /// As `::unmap` indicates that a widget will not be shown any longer,
458    /// it can be used to, for example, stop an animation on the widget.
459    ///
460    ///
461    ///
462    ///
463    /// #### `unrealize`
464    ///  Emitted when the `GdkSurface` associated with @widget is destroyed.
465    ///
466    /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
467    /// or the widget has been unmapped (that is, it is going to be hidden).
468    ///
469    ///
470    /// </details>
471    ///
472    /// # Implements
473    ///
474    /// [`LayerExt`][trait@crate::prelude::LayerExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
475    #[doc(alias = "ShumateMarkerLayer")]
476    pub struct MarkerLayer(Object<ffi::ShumateMarkerLayer, ffi::ShumateMarkerLayerClass>) @extends Layer, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
477
478    match fn {
479        type_ => || ffi::shumate_marker_layer_get_type(),
480    }
481}
482
483#[cfg(not(feature = "gtk_v4_10"))]
484glib::wrapper! {
485    #[doc(alias = "ShumateMarkerLayer")]
486    pub struct MarkerLayer(Object<ffi::ShumateMarkerLayer, ffi::ShumateMarkerLayerClass>) @extends Layer, gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget;
487
488    match fn {
489        type_ => || ffi::shumate_marker_layer_get_type(),
490    }
491}
492
493impl MarkerLayer {
494    /// Creates a new instance of [`MarkerLayer`][crate::MarkerLayer].
495    /// ## `viewport`
496    /// the @ShumateViewport
497    ///
498    /// # Returns
499    ///
500    /// a new [`MarkerLayer`][crate::MarkerLayer] ready to be used as a container for the markers.
501    #[doc(alias = "shumate_marker_layer_new")]
502    pub fn new(viewport: &Viewport) -> MarkerLayer {
503        skip_assert_initialized!();
504        unsafe { from_glib_none(ffi::shumate_marker_layer_new(viewport.to_glib_none().0)) }
505    }
506
507    /// Creates a new instance of [`MarkerLayer`][crate::MarkerLayer] with the specified selection mode.
508    /// ## `viewport`
509    /// the @ShumateViewport
510    /// ## `mode`
511    /// Selection mode
512    ///
513    /// # Returns
514    ///
515    /// a new [`MarkerLayer`][crate::MarkerLayer] ready to be used as a container for the markers.
516    #[doc(alias = "shumate_marker_layer_new_full")]
517    pub fn new_full(viewport: &Viewport, mode: gtk::SelectionMode) -> MarkerLayer {
518        skip_assert_initialized!();
519        unsafe {
520            from_glib_none(ffi::shumate_marker_layer_new_full(
521                viewport.to_glib_none().0,
522                mode.into_glib(),
523            ))
524        }
525    }
526
527    // rustdoc-stripper-ignore-next
528    /// Creates a new builder-pattern struct instance to construct [`MarkerLayer`] objects.
529    ///
530    /// This method returns an instance of [`MarkerLayerBuilder`](crate::builders::MarkerLayerBuilder) which can be used to create [`MarkerLayer`] objects.
531    pub fn builder() -> MarkerLayerBuilder {
532        MarkerLayerBuilder::new()
533    }
534
535    /// Adds the marker to the layer.
536    /// ## `marker`
537    /// a [`Marker`][crate::Marker]
538    #[doc(alias = "shumate_marker_layer_add_marker")]
539    pub fn add_marker(&self, marker: &impl IsA<Marker>) {
540        unsafe {
541            ffi::shumate_marker_layer_add_marker(
542                self.to_glib_none().0,
543                marker.as_ref().to_glib_none().0,
544            );
545        }
546    }
547
548    /// Gets a copy of the list of all markers inserted into the layer. You should
549    /// free the list but not its contents.
550    ///
551    /// # Returns
552    ///
553    /// the list
554    #[doc(alias = "shumate_marker_layer_get_markers")]
555    #[doc(alias = "get_markers")]
556    pub fn markers(&self) -> Vec<Marker> {
557        unsafe {
558            FromGlibPtrContainer::from_glib_container(ffi::shumate_marker_layer_get_markers(
559                self.to_glib_none().0,
560            ))
561        }
562    }
563
564    /// Gets a list of selected markers in the layer.
565    ///
566    /// # Returns
567    ///
568    /// the list
569    #[doc(alias = "shumate_marker_layer_get_selected")]
570    #[doc(alias = "get_selected")]
571    pub fn selected(&self) -> Vec<Marker> {
572        unsafe {
573            FromGlibPtrContainer::from_glib_container(ffi::shumate_marker_layer_get_selected(
574                self.to_glib_none().0,
575            ))
576        }
577    }
578
579    /// Gets the selection mode of the layer.
580    ///
581    /// # Returns
582    ///
583    /// the selection mode of the layer.
584    #[doc(alias = "shumate_marker_layer_get_selection_mode")]
585    #[doc(alias = "get_selection_mode")]
586    #[doc(alias = "selection-mode")]
587    pub fn selection_mode(&self) -> gtk::SelectionMode {
588        unsafe {
589            from_glib(ffi::shumate_marker_layer_get_selection_mode(
590                self.to_glib_none().0,
591            ))
592        }
593    }
594
595    /// Removes all markers from the layer.
596    #[doc(alias = "shumate_marker_layer_remove_all")]
597    pub fn remove_all(&self) {
598        unsafe {
599            ffi::shumate_marker_layer_remove_all(self.to_glib_none().0);
600        }
601    }
602
603    /// Removes the marker from the layer.
604    /// ## `marker`
605    /// a [`Marker`][crate::Marker]
606    #[doc(alias = "shumate_marker_layer_remove_marker")]
607    pub fn remove_marker(&self, marker: &impl IsA<Marker>) {
608        unsafe {
609            ffi::shumate_marker_layer_remove_marker(
610                self.to_glib_none().0,
611                marker.as_ref().to_glib_none().0,
612            );
613        }
614    }
615
616    /// Selects all selectable markers in the layer.
617    #[doc(alias = "shumate_marker_layer_select_all_markers")]
618    pub fn select_all_markers(&self) {
619        unsafe {
620            ffi::shumate_marker_layer_select_all_markers(self.to_glib_none().0);
621        }
622    }
623
624    /// Selects a marker in this layer.
625    ///
626    /// If [`MarkerLayer`][crate::MarkerLayer]:selection-mode is [`gtk::SelectionMode::Single`][crate::gtk::SelectionMode::Single] or
627    /// [`gtk::SelectionMode::Browse`][crate::gtk::SelectionMode::Browse], all other markers will be unselected. If the mode is
628    /// [`gtk::SelectionMode::None`][crate::gtk::SelectionMode::None] or @marker is not selectable, nothing will happen.
629    /// ## `marker`
630    /// a [`Marker`][crate::Marker] that is a child of @self
631    ///
632    /// # Returns
633    ///
634    /// [`true`] if the marker is now selected, otherwise [`false`]
635    #[doc(alias = "shumate_marker_layer_select_marker")]
636    pub fn select_marker(&self, marker: &impl IsA<Marker>) -> bool {
637        unsafe {
638            from_glib(ffi::shumate_marker_layer_select_marker(
639                self.to_glib_none().0,
640                marker.as_ref().to_glib_none().0,
641            ))
642        }
643    }
644
645    /// Sets the selection mode of the layer.
646    ///
647    /// NOTE: changing selection mode to [`gtk::SelectionMode::None`][crate::gtk::SelectionMode::None], [`gtk::SelectionMode::Single`][crate::gtk::SelectionMode::Single]
648    /// or [`gtk::SelectionMode::Browse`][crate::gtk::SelectionMode::Browse] will clear all previously selected markers.
649    /// ## `mode`
650    /// a [`gtk::SelectionMode`][crate::gtk::SelectionMode] value
651    #[doc(alias = "shumate_marker_layer_set_selection_mode")]
652    #[doc(alias = "selection-mode")]
653    pub fn set_selection_mode(&self, mode: gtk::SelectionMode) {
654        unsafe {
655            ffi::shumate_marker_layer_set_selection_mode(self.to_glib_none().0, mode.into_glib());
656        }
657    }
658
659    /// Unselects all markers in the layer.
660    #[doc(alias = "shumate_marker_layer_unselect_all_markers")]
661    pub fn unselect_all_markers(&self) {
662        unsafe {
663            ffi::shumate_marker_layer_unselect_all_markers(self.to_glib_none().0);
664        }
665    }
666
667    /// Unselects a marker in this layer.
668    ///
669    /// This works even if [`MarkerLayer`][crate::MarkerLayer]:selection-mode is
670    /// [`gtk::SelectionMode::Browse`][crate::gtk::SelectionMode::Browse]. Browse mode only prevents user interaction, not the
671    /// program, from unselecting a marker.
672    /// ## `marker`
673    /// a [`Marker`][crate::Marker] that is a child of @self
674    #[doc(alias = "shumate_marker_layer_unselect_marker")]
675    pub fn unselect_marker(&self, marker: &impl IsA<Marker>) {
676        unsafe {
677            ffi::shumate_marker_layer_unselect_marker(
678                self.to_glib_none().0,
679                marker.as_ref().to_glib_none().0,
680            );
681        }
682    }
683
684    /// Emitted when a marker in the layer is selected.
685    /// ## `marker`
686    /// The marker that was selected
687    #[doc(alias = "marker-selected")]
688    pub fn connect_marker_selected<F: Fn(&Self, &Marker) + 'static>(
689        &self,
690        f: F,
691    ) -> SignalHandlerId {
692        unsafe extern "C" fn marker_selected_trampoline<F: Fn(&MarkerLayer, &Marker) + 'static>(
693            this: *mut ffi::ShumateMarkerLayer,
694            marker: *mut ffi::ShumateMarker,
695            f: glib::ffi::gpointer,
696        ) {
697            unsafe {
698                let f: &F = &*(f as *const F);
699                f(&from_glib_borrow(this), &from_glib_borrow(marker))
700            }
701        }
702        unsafe {
703            let f: Box_<F> = Box_::new(f);
704            connect_raw(
705                self.as_ptr() as *mut _,
706                c"marker-selected".as_ptr(),
707                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
708                    marker_selected_trampoline::<F> as *const (),
709                )),
710                Box_::into_raw(f),
711            )
712        }
713    }
714
715    /// Emitted when a marker in the layer is unselected.
716    /// ## `marker`
717    /// The marker that was unselected
718    #[doc(alias = "marker-unselected")]
719    pub fn connect_marker_unselected<F: Fn(&Self, &Marker) + 'static>(
720        &self,
721        f: F,
722    ) -> SignalHandlerId {
723        unsafe extern "C" fn marker_unselected_trampoline<
724            F: Fn(&MarkerLayer, &Marker) + 'static,
725        >(
726            this: *mut ffi::ShumateMarkerLayer,
727            marker: *mut ffi::ShumateMarker,
728            f: glib::ffi::gpointer,
729        ) {
730            unsafe {
731                let f: &F = &*(f as *const F);
732                f(&from_glib_borrow(this), &from_glib_borrow(marker))
733            }
734        }
735        unsafe {
736            let f: Box_<F> = Box_::new(f);
737            connect_raw(
738                self.as_ptr() as *mut _,
739                c"marker-unselected".as_ptr(),
740                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
741                    marker_unselected_trampoline::<F> as *const (),
742                )),
743                Box_::into_raw(f),
744            )
745        }
746    }
747
748    #[doc(alias = "selection-mode")]
749    pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
750        unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&MarkerLayer) + 'static>(
751            this: *mut ffi::ShumateMarkerLayer,
752            _param_spec: glib::ffi::gpointer,
753            f: glib::ffi::gpointer,
754        ) {
755            unsafe {
756                let f: &F = &*(f as *const F);
757                f(&from_glib_borrow(this))
758            }
759        }
760        unsafe {
761            let f: Box_<F> = Box_::new(f);
762            connect_raw(
763                self.as_ptr() as *mut _,
764                c"notify::selection-mode".as_ptr(),
765                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
766                    notify_selection_mode_trampoline::<F> as *const (),
767                )),
768                Box_::into_raw(f),
769            )
770        }
771    }
772}
773
774impl Default for MarkerLayer {
775    fn default() -> Self {
776        glib::object::Object::new::<Self>()
777    }
778}
779
780// rustdoc-stripper-ignore-next
781/// A [builder-pattern] type to construct [`MarkerLayer`] objects.
782///
783/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
784#[must_use = "The builder must be built to be used"]
785pub struct MarkerLayerBuilder {
786    builder: glib::object::ObjectBuilder<'static, MarkerLayer>,
787}
788
789impl MarkerLayerBuilder {
790    fn new() -> Self {
791        Self {
792            builder: glib::object::Object::builder(),
793        }
794    }
795
796    /// Determines the type of selection that will be performed.
797    pub fn selection_mode(self, selection_mode: gtk::SelectionMode) -> Self {
798        Self {
799            builder: self.builder.property("selection-mode", selection_mode),
800        }
801    }
802
803    pub fn viewport(self, viewport: &Viewport) -> Self {
804        Self {
805            builder: self.builder.property("viewport", viewport.clone()),
806        }
807    }
808
809    /// Whether the widget or any of its descendents can accept
810    /// the input focus.
811    ///
812    /// This property is meant to be set by widget implementations,
813    /// typically in their instance init function.
814    pub fn can_focus(self, can_focus: bool) -> Self {
815        Self {
816            builder: self.builder.property("can-focus", can_focus),
817        }
818    }
819
820    /// Whether the widget can receive pointer events.
821    pub fn can_target(self, can_target: bool) -> Self {
822        Self {
823            builder: self.builder.property("can-target", can_target),
824        }
825    }
826
827    /// A list of css classes applied to this widget.
828    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
829        Self {
830            builder: self.builder.property("css-classes", css_classes.into()),
831        }
832    }
833
834    /// The name of this widget in the CSS tree.
835    ///
836    /// This property is meant to be set by widget implementations,
837    /// typically in their instance init function.
838    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
839        Self {
840            builder: self.builder.property("css-name", css_name.into()),
841        }
842    }
843
844    /// The cursor used by @widget.
845    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
846        Self {
847            builder: self.builder.property("cursor", cursor.clone()),
848        }
849    }
850
851    /// Whether the widget should grab focus when it is clicked with the mouse.
852    ///
853    /// This property is only relevant for widgets that can take focus.
854    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
855        Self {
856            builder: self.builder.property("focus-on-click", focus_on_click),
857        }
858    }
859
860    /// Whether this widget itself will accept the input focus.
861    pub fn focusable(self, focusable: bool) -> Self {
862        Self {
863            builder: self.builder.property("focusable", focusable),
864        }
865    }
866
867    /// How to distribute horizontal space if widget gets extra space.
868    pub fn halign(self, halign: gtk::Align) -> Self {
869        Self {
870            builder: self.builder.property("halign", halign),
871        }
872    }
873
874    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
875    /// signal on @widget.
876    ///
877    /// A true value indicates that @widget can have a tooltip, in this case
878    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
879    /// determine whether it will provide a tooltip or not.
880    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
881        Self {
882            builder: self.builder.property("has-tooltip", has_tooltip),
883        }
884    }
885
886    /// Overrides for height request of the widget.
887    ///
888    /// If this is -1, the natural request will be used.
889    pub fn height_request(self, height_request: i32) -> Self {
890        Self {
891            builder: self.builder.property("height-request", height_request),
892        }
893    }
894
895    /// Whether to expand horizontally.
896    pub fn hexpand(self, hexpand: bool) -> Self {
897        Self {
898            builder: self.builder.property("hexpand", hexpand),
899        }
900    }
901
902    /// Whether to use the `hexpand` property.
903    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
904        Self {
905            builder: self.builder.property("hexpand-set", hexpand_set),
906        }
907    }
908
909    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
910    /// the preferred size of the widget, and allocate its children.
911    ///
912    /// This property is meant to be set by widget implementations,
913    /// typically in their instance init function.
914    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
915        Self {
916            builder: self
917                .builder
918                .property("layout-manager", layout_manager.clone().upcast()),
919        }
920    }
921
922    /// Makes this widget act like a modal dialog, with respect to
923    /// event delivery.
924    ///
925    /// Global event controllers will not handle events with targets
926    /// inside the widget, unless they are set up to ignore propagation
927    /// limits. See `Gtk::EventController::set_propagation_limit()`.
928    #[cfg(feature = "gtk_v4_18")]
929    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
930    pub fn limit_events(self, limit_events: bool) -> Self {
931        Self {
932            builder: self.builder.property("limit-events", limit_events),
933        }
934    }
935
936    /// Margin on bottom side of widget.
937    ///
938    /// This property adds margin outside of the widget's normal size
939    /// request, the margin will be added in addition to the size from
940    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
941    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
942        Self {
943            builder: self.builder.property("margin-bottom", margin_bottom),
944        }
945    }
946
947    /// Margin on end of widget, horizontally.
948    ///
949    /// This property supports left-to-right and right-to-left text
950    /// directions.
951    ///
952    /// This property adds margin outside of the widget's normal size
953    /// request, the margin will be added in addition to the size from
954    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
955    pub fn margin_end(self, margin_end: i32) -> Self {
956        Self {
957            builder: self.builder.property("margin-end", margin_end),
958        }
959    }
960
961    /// Margin on start of widget, horizontally.
962    ///
963    /// This property supports left-to-right and right-to-left text
964    /// directions.
965    ///
966    /// This property adds margin outside of the widget's normal size
967    /// request, the margin will be added in addition to the size from
968    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
969    pub fn margin_start(self, margin_start: i32) -> Self {
970        Self {
971            builder: self.builder.property("margin-start", margin_start),
972        }
973    }
974
975    /// Margin on top side of widget.
976    ///
977    /// This property adds margin outside of the widget's normal size
978    /// request, the margin will be added in addition to the size from
979    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
980    pub fn margin_top(self, margin_top: i32) -> Self {
981        Self {
982            builder: self.builder.property("margin-top", margin_top),
983        }
984    }
985
986    /// The name of the widget.
987    pub fn name(self, name: impl Into<glib::GString>) -> Self {
988        Self {
989            builder: self.builder.property("name", name.into()),
990        }
991    }
992
993    /// The requested opacity of the widget.
994    pub fn opacity(self, opacity: f64) -> Self {
995        Self {
996            builder: self.builder.property("opacity", opacity),
997        }
998    }
999
1000    /// How content outside the widget's content area is treated.
1001    ///
1002    /// This property is meant to be set by widget implementations,
1003    /// typically in their instance init function.
1004    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1005        Self {
1006            builder: self.builder.property("overflow", overflow),
1007        }
1008    }
1009
1010    /// Whether the widget will receive the default action when it is focused.
1011    pub fn receives_default(self, receives_default: bool) -> Self {
1012        Self {
1013            builder: self.builder.property("receives-default", receives_default),
1014        }
1015    }
1016
1017    /// Whether the widget responds to input.
1018    pub fn sensitive(self, sensitive: bool) -> Self {
1019        Self {
1020            builder: self.builder.property("sensitive", sensitive),
1021        }
1022    }
1023
1024    /// Sets the text of tooltip to be the given string, which is marked up
1025    /// with Pango markup.
1026    ///
1027    /// Also see `Gtk::Tooltip::set_markup()`.
1028    ///
1029    /// This is a convenience property which will take care of getting the
1030    /// tooltip shown if the given string is not `NULL`:
1031    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1032    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1033    /// the default signal handler.
1034    ///
1035    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1036    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1037    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1038        Self {
1039            builder: self
1040                .builder
1041                .property("tooltip-markup", tooltip_markup.into()),
1042        }
1043    }
1044
1045    /// Sets the text of tooltip to be the given string.
1046    ///
1047    /// Also see `Gtk::Tooltip::set_text()`.
1048    ///
1049    /// This is a convenience property which will take care of getting the
1050    /// tooltip shown if the given string is not `NULL`:
1051    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1052    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1053    /// the default signal handler.
1054    ///
1055    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1056    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1057    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1058        Self {
1059            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1060        }
1061    }
1062
1063    /// How to distribute vertical space if widget gets extra space.
1064    pub fn valign(self, valign: gtk::Align) -> Self {
1065        Self {
1066            builder: self.builder.property("valign", valign),
1067        }
1068    }
1069
1070    /// Whether to expand vertically.
1071    pub fn vexpand(self, vexpand: bool) -> Self {
1072        Self {
1073            builder: self.builder.property("vexpand", vexpand),
1074        }
1075    }
1076
1077    /// Whether to use the `vexpand` property.
1078    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1079        Self {
1080            builder: self.builder.property("vexpand-set", vexpand_set),
1081        }
1082    }
1083
1084    /// Whether the widget is visible.
1085    pub fn visible(self, visible: bool) -> Self {
1086        Self {
1087            builder: self.builder.property("visible", visible),
1088        }
1089    }
1090
1091    /// Overrides for width request of the widget.
1092    ///
1093    /// If this is -1, the natural request will be used.
1094    pub fn width_request(self, width_request: i32) -> Self {
1095        Self {
1096            builder: self.builder.property("width-request", width_request),
1097        }
1098    }
1099
1100    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1101    ///
1102    /// The accessible role cannot be changed once set.
1103    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1104        Self {
1105            builder: self.builder.property("accessible-role", accessible_role),
1106        }
1107    }
1108
1109    // rustdoc-stripper-ignore-next
1110    /// Build the [`MarkerLayer`].
1111    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1112    pub fn build(self) -> MarkerLayer {
1113        assert_initialized_main_thread!();
1114        self.builder.build()
1115    }
1116}