libshumate/auto/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::{Viewport, 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 /// Every layer (overlay that moves together with the map) has to inherit this
13 /// class and implement its virtual methods.
14 ///
15 /// You can use the same layer to display many types of maps. In Shumate they
16 /// are called map sources. You can change the [`map-source`][struct@crate::MapLayer#map-source]
17 /// property at any time to replace the current displayed map.
18 ///
19 /// This is an Abstract Base Class, you cannot instantiate it.
20 ///
21 /// ## Properties
22 ///
23 ///
24 /// #### `viewport`
25 /// Readable | Writable | Construct Only
26 /// <details><summary><h4>Widget</h4></summary>
27 ///
28 ///
29 /// #### `can-focus`
30 /// Whether the widget or any of its descendents can accept
31 /// the input focus.
32 ///
33 /// This property is meant to be set by widget implementations,
34 /// typically in their instance init function.
35 ///
36 /// Readable | Writable
37 ///
38 ///
39 /// #### `can-target`
40 /// Whether the widget can receive pointer events.
41 ///
42 /// Readable | Writable
43 ///
44 ///
45 /// #### `css-classes`
46 /// A list of css classes applied to this widget.
47 ///
48 /// Readable | Writable
49 ///
50 ///
51 /// #### `css-name`
52 /// The name of this widget in the CSS tree.
53 ///
54 /// This property is meant to be set by widget implementations,
55 /// typically in their instance init function.
56 ///
57 /// Readable | Writable | Construct Only
58 ///
59 ///
60 /// #### `cursor`
61 /// The cursor used by @widget.
62 ///
63 /// Readable | Writable
64 ///
65 ///
66 /// #### `focus-on-click`
67 /// Whether the widget should grab focus when it is clicked with the mouse.
68 ///
69 /// This property is only relevant for widgets that can take focus.
70 ///
71 /// Readable | Writable
72 ///
73 ///
74 /// #### `focusable`
75 /// Whether this widget itself will accept the input focus.
76 ///
77 /// Readable | Writable
78 ///
79 ///
80 /// #### `halign`
81 /// How to distribute horizontal space if widget gets extra space.
82 ///
83 /// Readable | Writable
84 ///
85 ///
86 /// #### `has-default`
87 /// Whether the widget is the default widget.
88 ///
89 /// Readable
90 ///
91 ///
92 /// #### `has-focus`
93 /// Whether the widget has the input focus.
94 ///
95 /// Readable
96 ///
97 ///
98 /// #### `has-tooltip`
99 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
100 /// signal on @widget.
101 ///
102 /// A true value indicates that @widget can have a tooltip, in this case
103 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
104 /// determine whether it will provide a tooltip or not.
105 ///
106 /// Readable | Writable
107 ///
108 ///
109 /// #### `height-request`
110 /// Overrides for height request of the widget.
111 ///
112 /// If this is -1, the natural request will be used.
113 ///
114 /// Readable | Writable
115 ///
116 ///
117 /// #### `hexpand`
118 /// Whether to expand horizontally.
119 ///
120 /// Readable | Writable
121 ///
122 ///
123 /// #### `hexpand-set`
124 /// Whether to use the `hexpand` property.
125 ///
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `layout-manager`
130 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
131 /// the preferred size of the widget, and allocate its children.
132 ///
133 /// This property is meant to be set by widget implementations,
134 /// typically in their instance init function.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `limit-events`
140 /// Makes this widget act like a modal dialog, with respect to
141 /// event delivery.
142 ///
143 /// Global event controllers will not handle events with targets
144 /// inside the widget, unless they are set up to ignore propagation
145 /// limits. See `Gtk::EventController::set_propagation_limit()`.
146 ///
147 /// Readable | Writable
148 ///
149 ///
150 /// #### `margin-bottom`
151 /// Margin on bottom side of widget.
152 ///
153 /// This property adds margin outside of the widget's normal size
154 /// request, the margin will be added in addition to the size from
155 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `margin-end`
161 /// Margin on end of widget, horizontally.
162 ///
163 /// This property supports left-to-right and right-to-left text
164 /// directions.
165 ///
166 /// This property adds margin outside of the widget's normal size
167 /// request, the margin will be added in addition to the size from
168 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
169 ///
170 /// Readable | Writable
171 ///
172 ///
173 /// #### `margin-start`
174 /// Margin on start of widget, horizontally.
175 ///
176 /// This property supports left-to-right and right-to-left text
177 /// directions.
178 ///
179 /// This property adds margin outside of the widget's normal size
180 /// request, the margin will be added in addition to the size from
181 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
182 ///
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `margin-top`
187 /// Margin on top side of widget.
188 ///
189 /// This property adds margin outside of the widget's normal size
190 /// request, the margin will be added in addition to the size from
191 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
192 ///
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `name`
197 /// The name of the widget.
198 ///
199 /// Readable | Writable
200 ///
201 ///
202 /// #### `opacity`
203 /// The requested opacity of the widget.
204 ///
205 /// Readable | Writable
206 ///
207 ///
208 /// #### `overflow`
209 /// How content outside the widget's content area is treated.
210 ///
211 /// This property is meant to be set by widget implementations,
212 /// typically in their instance init function.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `parent`
218 /// The parent widget of this widget.
219 ///
220 /// Readable
221 ///
222 ///
223 /// #### `receives-default`
224 /// Whether the widget will receive the default action when it is focused.
225 ///
226 /// Readable | Writable
227 ///
228 ///
229 /// #### `root`
230 /// The `GtkRoot` widget of the widget tree containing this widget.
231 ///
232 /// This will be `NULL` if the widget is not contained in a root widget.
233 ///
234 /// Readable
235 ///
236 ///
237 /// #### `scale-factor`
238 /// The scale factor of the widget.
239 ///
240 /// Readable
241 ///
242 ///
243 /// #### `sensitive`
244 /// Whether the widget responds to input.
245 ///
246 /// Readable | Writable
247 ///
248 ///
249 /// #### `tooltip-markup`
250 /// Sets the text of tooltip to be the given string, which is marked up
251 /// with Pango markup.
252 ///
253 /// Also see `Gtk::Tooltip::set_markup()`.
254 ///
255 /// This is a convenience property which will take care of getting the
256 /// tooltip shown if the given string is not `NULL`:
257 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
258 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
259 /// the default signal handler.
260 ///
261 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
262 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
263 ///
264 /// Readable | Writable
265 ///
266 ///
267 /// #### `tooltip-text`
268 /// Sets the text of tooltip to be the given string.
269 ///
270 /// Also see `Gtk::Tooltip::set_text()`.
271 ///
272 /// This is a convenience property which will take care of getting the
273 /// tooltip shown if the given string is not `NULL`:
274 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
275 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
276 /// the default signal handler.
277 ///
278 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
279 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
280 ///
281 /// Readable | Writable
282 ///
283 ///
284 /// #### `valign`
285 /// How to distribute vertical space if widget gets extra space.
286 ///
287 /// Readable | Writable
288 ///
289 ///
290 /// #### `vexpand`
291 /// Whether to expand vertically.
292 ///
293 /// Readable | Writable
294 ///
295 ///
296 /// #### `vexpand-set`
297 /// Whether to use the `vexpand` property.
298 ///
299 /// Readable | Writable
300 ///
301 ///
302 /// #### `visible`
303 /// Whether the widget is visible.
304 ///
305 /// Readable | Writable
306 ///
307 ///
308 /// #### `width-request`
309 /// Overrides for width request of the widget.
310 ///
311 /// If this is -1, the natural request will be used.
312 ///
313 /// Readable | Writable
314 /// </details>
315 /// <details><summary><h4>Accessible</h4></summary>
316 ///
317 ///
318 /// #### `accessible-role`
319 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
320 ///
321 /// The accessible role cannot be changed once set.
322 ///
323 /// Readable | Writable
324 /// </details>
325 ///
326 /// # Implements
327 ///
328 /// [`LayerExt`][trait@crate::prelude::LayerExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
329 #[doc(alias = "ShumateLayer")]
330 pub struct Layer(Object<ffi::ShumateLayer, ffi::ShumateLayerClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
331
332 match fn {
333 type_ => || ffi::shumate_layer_get_type(),
334 }
335}
336
337#[cfg(not(feature = "gtk_v4_10"))]
338glib::wrapper! {
339 #[doc(alias = "ShumateLayer")]
340 pub struct Layer(Object<ffi::ShumateLayer, ffi::ShumateLayerClass>) @extends gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget;
341
342 match fn {
343 type_ => || ffi::shumate_layer_get_type(),
344 }
345}
346
347impl Layer {
348 pub const NONE: Option<&'static Layer> = None;
349}
350
351/// Trait containing all [`struct@Layer`] methods.
352///
353/// # Implementors
354///
355/// [`Layer`][struct@crate::Layer], [`MapLayer`][struct@crate::MapLayer], [`MarkerLayer`][struct@crate::MarkerLayer], [`PathLayer`][struct@crate::PathLayer]
356pub trait LayerExt: IsA<Layer> + 'static {
357 /// Gets the #ShumateViewport used by this layer.
358 ///
359 /// # Returns
360 ///
361 /// The #ShumateViewport.
362 #[doc(alias = "shumate_layer_get_viewport")]
363 #[doc(alias = "get_viewport")]
364 fn viewport(&self) -> Option<Viewport> {
365 unsafe {
366 from_glib_none(ffi::shumate_layer_get_viewport(
367 self.as_ref().to_glib_none().0,
368 ))
369 }
370 }
371}
372
373impl<O: IsA<Layer>> LayerExt for O {}