Skip to main content

libshumate/auto/
point.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::{Location, Marker, ffi};
7use glib::{prelude::*, translate::*};
8
9#[cfg(feature = "gtk_v4_10")]
10#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_10")))]
11glib::wrapper! {
12    /// A simple variant of [`Marker`][crate::Marker] showing the location of the point as a
13    /// circle on the map.
14    ///
15    /// ## CSS nodes
16    ///
17    /// `ShumatePoint` has a single CSS node with the name “map-point”.
18    ///
19    /// # Implements
20    ///
21    /// [`MarkerExt`][trait@crate::prelude::MarkerExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`LocationExt`][trait@crate::prelude::LocationExt]
22    #[doc(alias = "ShumatePoint")]
23    pub struct Point(Object<ffi::ShumatePoint, ffi::ShumatePointClass>) @extends Marker, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Location;
24
25    match fn {
26        type_ => || ffi::shumate_point_get_type(),
27    }
28}
29
30#[cfg(not(feature = "gtk_v4_10"))]
31glib::wrapper! {
32    #[doc(alias = "ShumatePoint")]
33    pub struct Point(Object<ffi::ShumatePoint, ffi::ShumatePointClass>) @extends Marker, gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget, Location;
34
35    match fn {
36        type_ => || ffi::shumate_point_get_type(),
37    }
38}
39
40impl Point {
41    /// Creates an instance of #ShumatePoint.
42    ///
43    /// # Returns
44    ///
45    /// a new #ShumatePoint.
46    #[doc(alias = "shumate_point_new")]
47    pub fn new() -> Point {
48        assert_initialized_main_thread!();
49        unsafe { from_glib_none(ffi::shumate_point_new()) }
50    }
51
52    // rustdoc-stripper-ignore-next
53    /// Creates a new builder-pattern struct instance to construct [`Point`] objects.
54    ///
55    /// This method returns an instance of [`PointBuilder`](crate::builders::PointBuilder) which can be used to create [`Point`] objects.
56    pub fn builder() -> PointBuilder {
57        PointBuilder::new()
58    }
59}
60
61impl Default for Point {
62    fn default() -> Self {
63        Self::new()
64    }
65}
66
67// rustdoc-stripper-ignore-next
68/// A [builder-pattern] type to construct [`Point`] objects.
69///
70/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
71#[must_use = "The builder must be built to be used"]
72pub struct PointBuilder {
73    builder: glib::object::ObjectBuilder<'static, Point>,
74}
75
76impl PointBuilder {
77    fn new() -> Self {
78        Self {
79            builder: glib::object::Object::builder(),
80        }
81    }
82
83    /// The child widget of the marker
84    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
85        Self {
86            builder: self.builder.property("child", child.clone().upcast()),
87        }
88    }
89
90    /// The selectable state of the marker
91    pub fn selectable(self, selectable: bool) -> Self {
92        Self {
93            builder: self.builder.property("selectable", selectable),
94        }
95    }
96
97    /// The x hotspot of the marker, a negative value means that the actual
98    /// x hotspot is calculated with the [`halign`][struct@crate::gtk::Widget#halign] property.
99    /// The x hotspot should not be more than the width of the widget.
100    #[cfg(feature = "v1_5")]
101    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
102    pub fn x_hotspot(self, x_hotspot: f64) -> Self {
103        Self {
104            builder: self.builder.property("x-hotspot", x_hotspot),
105        }
106    }
107
108    /// The y hotspot of the marker, a negative value means that the actual
109    /// y hotspot is calculated with the [`valign`][struct@crate::gtk::Widget#valign] property.
110    /// The y hotspot should not be more than the height of the widget.
111    #[cfg(feature = "v1_5")]
112    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
113    pub fn y_hotspot(self, y_hotspot: f64) -> Self {
114        Self {
115            builder: self.builder.property("y-hotspot", y_hotspot),
116        }
117    }
118
119    /// Whether the widget or any of its descendents can accept
120    /// the input focus.
121    ///
122    /// This property is meant to be set by widget implementations,
123    /// typically in their instance init function.
124    pub fn can_focus(self, can_focus: bool) -> Self {
125        Self {
126            builder: self.builder.property("can-focus", can_focus),
127        }
128    }
129
130    /// Whether the widget can receive pointer events.
131    pub fn can_target(self, can_target: bool) -> Self {
132        Self {
133            builder: self.builder.property("can-target", can_target),
134        }
135    }
136
137    /// A list of css classes applied to this widget.
138    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
139        Self {
140            builder: self.builder.property("css-classes", css_classes.into()),
141        }
142    }
143
144    /// The name of this widget in the CSS tree.
145    ///
146    /// This property is meant to be set by widget implementations,
147    /// typically in their instance init function.
148    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
149        Self {
150            builder: self.builder.property("css-name", css_name.into()),
151        }
152    }
153
154    /// The cursor used by @widget.
155    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
156        Self {
157            builder: self.builder.property("cursor", cursor.clone()),
158        }
159    }
160
161    /// Whether the widget should grab focus when it is clicked with the mouse.
162    ///
163    /// This property is only relevant for widgets that can take focus.
164    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
165        Self {
166            builder: self.builder.property("focus-on-click", focus_on_click),
167        }
168    }
169
170    /// Whether this widget itself will accept the input focus.
171    pub fn focusable(self, focusable: bool) -> Self {
172        Self {
173            builder: self.builder.property("focusable", focusable),
174        }
175    }
176
177    /// How to distribute horizontal space if widget gets extra space.
178    pub fn halign(self, halign: gtk::Align) -> Self {
179        Self {
180            builder: self.builder.property("halign", halign),
181        }
182    }
183
184    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
185    /// signal on @widget.
186    ///
187    /// A true value indicates that @widget can have a tooltip, in this case
188    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
189    /// determine whether it will provide a tooltip or not.
190    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
191        Self {
192            builder: self.builder.property("has-tooltip", has_tooltip),
193        }
194    }
195
196    /// Overrides for height request of the widget.
197    ///
198    /// If this is -1, the natural request will be used.
199    pub fn height_request(self, height_request: i32) -> Self {
200        Self {
201            builder: self.builder.property("height-request", height_request),
202        }
203    }
204
205    /// Whether to expand horizontally.
206    pub fn hexpand(self, hexpand: bool) -> Self {
207        Self {
208            builder: self.builder.property("hexpand", hexpand),
209        }
210    }
211
212    /// Whether to use the `hexpand` property.
213    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
214        Self {
215            builder: self.builder.property("hexpand-set", hexpand_set),
216        }
217    }
218
219    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
220    /// the preferred size of the widget, and allocate its children.
221    ///
222    /// This property is meant to be set by widget implementations,
223    /// typically in their instance init function.
224    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
225        Self {
226            builder: self
227                .builder
228                .property("layout-manager", layout_manager.clone().upcast()),
229        }
230    }
231
232    /// Makes this widget act like a modal dialog, with respect to
233    /// event delivery.
234    ///
235    /// Global event controllers will not handle events with targets
236    /// inside the widget, unless they are set up to ignore propagation
237    /// limits. See `Gtk::EventController::set_propagation_limit()`.
238    #[cfg(feature = "gtk_v4_18")]
239    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
240    pub fn limit_events(self, limit_events: bool) -> Self {
241        Self {
242            builder: self.builder.property("limit-events", limit_events),
243        }
244    }
245
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    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
251    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
252        Self {
253            builder: self.builder.property("margin-bottom", margin_bottom),
254        }
255    }
256
257    /// Margin on end of widget, horizontally.
258    ///
259    /// This property supports left-to-right and right-to-left text
260    /// directions.
261    ///
262    /// This property adds margin outside of the widget's normal size
263    /// request, the margin will be added in addition to the size from
264    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
265    pub fn margin_end(self, margin_end: i32) -> Self {
266        Self {
267            builder: self.builder.property("margin-end", margin_end),
268        }
269    }
270
271    /// Margin on start of widget, horizontally.
272    ///
273    /// This property supports left-to-right and right-to-left text
274    /// directions.
275    ///
276    /// This property adds margin outside of the widget's normal size
277    /// request, the margin will be added in addition to the size from
278    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
279    pub fn margin_start(self, margin_start: i32) -> Self {
280        Self {
281            builder: self.builder.property("margin-start", margin_start),
282        }
283    }
284
285    /// Margin on top side of widget.
286    ///
287    /// This property adds margin outside of the widget's normal size
288    /// request, the margin will be added in addition to the size from
289    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
290    pub fn margin_top(self, margin_top: i32) -> Self {
291        Self {
292            builder: self.builder.property("margin-top", margin_top),
293        }
294    }
295
296    /// The name of the widget.
297    pub fn name(self, name: impl Into<glib::GString>) -> Self {
298        Self {
299            builder: self.builder.property("name", name.into()),
300        }
301    }
302
303    /// The requested opacity of the widget.
304    pub fn opacity(self, opacity: f64) -> Self {
305        Self {
306            builder: self.builder.property("opacity", opacity),
307        }
308    }
309
310    /// How content outside the widget's content area is treated.
311    ///
312    /// This property is meant to be set by widget implementations,
313    /// typically in their instance init function.
314    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
315        Self {
316            builder: self.builder.property("overflow", overflow),
317        }
318    }
319
320    /// Whether the widget will receive the default action when it is focused.
321    pub fn receives_default(self, receives_default: bool) -> Self {
322        Self {
323            builder: self.builder.property("receives-default", receives_default),
324        }
325    }
326
327    /// Whether the widget responds to input.
328    pub fn sensitive(self, sensitive: bool) -> Self {
329        Self {
330            builder: self.builder.property("sensitive", sensitive),
331        }
332    }
333
334    /// Sets the text of tooltip to be the given string, which is marked up
335    /// with Pango markup.
336    ///
337    /// Also see `Gtk::Tooltip::set_markup()`.
338    ///
339    /// This is a convenience property which will take care of getting the
340    /// tooltip shown if the given string is not `NULL`:
341    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
342    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
343    /// the default signal handler.
344    ///
345    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
346    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
347    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
348        Self {
349            builder: self
350                .builder
351                .property("tooltip-markup", tooltip_markup.into()),
352        }
353    }
354
355    /// Sets the text of tooltip to be the given string.
356    ///
357    /// Also see `Gtk::Tooltip::set_text()`.
358    ///
359    /// This is a convenience property which will take care of getting the
360    /// tooltip shown if the given string is not `NULL`:
361    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
362    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
363    /// the default signal handler.
364    ///
365    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
366    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
367    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
368        Self {
369            builder: self.builder.property("tooltip-text", tooltip_text.into()),
370        }
371    }
372
373    /// How to distribute vertical space if widget gets extra space.
374    pub fn valign(self, valign: gtk::Align) -> Self {
375        Self {
376            builder: self.builder.property("valign", valign),
377        }
378    }
379
380    /// Whether to expand vertically.
381    pub fn vexpand(self, vexpand: bool) -> Self {
382        Self {
383            builder: self.builder.property("vexpand", vexpand),
384        }
385    }
386
387    /// Whether to use the `vexpand` property.
388    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
389        Self {
390            builder: self.builder.property("vexpand-set", vexpand_set),
391        }
392    }
393
394    /// Whether the widget is visible.
395    pub fn visible(self, visible: bool) -> Self {
396        Self {
397            builder: self.builder.property("visible", visible),
398        }
399    }
400
401    /// Overrides for width request of the widget.
402    ///
403    /// If this is -1, the natural request will be used.
404    pub fn width_request(self, width_request: i32) -> Self {
405        Self {
406            builder: self.builder.property("width-request", width_request),
407        }
408    }
409
410    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
411    ///
412    /// The accessible role cannot be changed once set.
413    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
414        Self {
415            builder: self.builder.property("accessible-role", accessible_role),
416        }
417    }
418
419    /// The latitude coordonate in degrees
420    pub fn latitude(self, latitude: f64) -> Self {
421        Self {
422            builder: self.builder.property("latitude", latitude),
423        }
424    }
425
426    /// The longitude coordonate in degrees
427    pub fn longitude(self, longitude: f64) -> Self {
428        Self {
429            builder: self.builder.property("longitude", longitude),
430        }
431    }
432
433    // rustdoc-stripper-ignore-next
434    /// Build the [`Point`].
435    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
436    pub fn build(self) -> Point {
437        assert_initialized_main_thread!();
438        self.builder.build()
439    }
440}