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