gtk/auto/level_bar.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
5use crate::{Align, Buildable, Container, LevelBarMode, Orientable, Orientation, Widget, ffi};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// The [`LevelBar`][crate::LevelBar] is a bar widget that can be used
16 /// as a level indicator. Typical use cases are displaying the strength
17 /// of a password, or showing the charge level of a battery.
18 ///
19 /// Use [`LevelBarExt::set_value()`][crate::prelude::LevelBarExt::set_value()] to set the current value, and
20 /// [`LevelBarExt::add_offset_value()`][crate::prelude::LevelBarExt::add_offset_value()] to set the value offsets at which
21 /// the bar will be considered in a different state. GTK will add a few
22 /// offsets by default on the level bar: [`LEVEL_BAR_OFFSET_LOW`][crate::LEVEL_BAR_OFFSET_LOW],
23 /// [`LEVEL_BAR_OFFSET_HIGH`][crate::LEVEL_BAR_OFFSET_HIGH] and [`LEVEL_BAR_OFFSET_FULL`][crate::LEVEL_BAR_OFFSET_FULL], with
24 /// values 0.25, 0.75 and 1.0 respectively.
25 ///
26 /// Note that it is your responsibility to update preexisting offsets
27 /// when changing the minimum or maximum value. GTK+ will simply clamp
28 /// them to the new range.
29 ///
30 /// ## Adding a custom offset on the bar
31 ///
32 ///
33 ///
34 /// **⚠️ The following code is in C ⚠️**
35 ///
36 /// ```C
37 ///
38 /// static GtkWidget *
39 /// create_level_bar (void)
40 /// {
41 /// GtkWidget *widget;
42 /// GtkLevelBar *bar;
43 ///
44 /// widget = gtk_level_bar_new ();
45 /// bar = GTK_LEVEL_BAR (widget);
46 ///
47 /// // This changes the value of the default low offset
48 ///
49 /// gtk_level_bar_add_offset_value (bar,
50 /// GTK_LEVEL_BAR_OFFSET_LOW,
51 /// 0.10);
52 ///
53 /// // This adds a new offset to the bar; the application will
54 /// // be able to change its color CSS like this:
55 /// //
56 /// // levelbar block.my-offset {
57 /// // background-color: magenta;
58 /// // border-style: solid;
59 /// // border-color: black;
60 /// // border-style: 1px;
61 /// // }
62 ///
63 /// gtk_level_bar_add_offset_value (bar, "my-offset", 0.60);
64 ///
65 /// return widget;
66 /// }
67 /// ```
68 ///
69 /// The default interval of values is between zero and one, but it’s possible to
70 /// modify the interval using [`LevelBarExt::set_min_value()`][crate::prelude::LevelBarExt::set_min_value()] and
71 /// [`LevelBarExt::set_max_value()`][crate::prelude::LevelBarExt::set_max_value()]. The value will be always drawn in proportion to
72 /// the admissible interval, i.e. a value of 15 with a specified interval between
73 /// 10 and 20 is equivalent to a value of 0.5 with an interval between 0 and 1.
74 /// When [`LevelBarMode::Discrete`][crate::LevelBarMode::Discrete] is used, the bar level is rendered
75 /// as a finite number of separated blocks instead of a single one. The number
76 /// of blocks that will be rendered is equal to the number of units specified by
77 /// the admissible interval.
78 ///
79 /// For instance, to build a bar rendered with five blocks, it’s sufficient to
80 /// set the minimum value to 0 and the maximum value to 5 after changing the indicator
81 /// mode to discrete.
82 ///
83 /// GtkLevelBar was introduced in GTK+ 3.6.
84 ///
85 /// # GtkLevelBar as GtkBuildable
86 ///
87 /// The GtkLevelBar implementation of the GtkBuildable interface supports a
88 /// custom ``<offsets>`` element, which can contain any number of ``<offset>`` elements,
89 /// each of which must have "name" and "value" attributes.
90 ///
91 /// # CSS nodes
92 ///
93 ///
94 ///
95 /// **⚠️ The following code is in plain ⚠️**
96 ///
97 /// ```plain
98 /// levelbar[.discrete]
99 /// ╰── trough
100 /// ├── block.filled.level-name
101 /// ┊
102 /// ├── block.empty
103 /// ┊
104 /// ```
105 ///
106 /// GtkLevelBar has a main CSS node with name levelbar and one of the style
107 /// classes .discrete or .continuous and a subnode with name trough. Below the
108 /// trough node are a number of nodes with name block and style class .filled
109 /// or .empty. In continuous mode, there is exactly one node of each, in discrete
110 /// mode, the number of filled and unfilled nodes corresponds to blocks that are
111 /// drawn. The block.filled nodes also get a style class .level-name corresponding
112 /// to the level for the current value.
113 ///
114 /// In horizontal orientation, the nodes are always arranged from left to right,
115 /// regardless of text direction.
116 ///
117 /// ## Properties
118 ///
119 ///
120 /// #### `inverted`
121 /// Level bars normally grow from top to bottom or left to right.
122 /// Inverted level bars grow in the opposite direction.
123 ///
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `max-value`
128 /// The [`max-value`][struct@crate::LevelBar#max-value] property determaxes the maximum value of
129 /// the interval that can be displayed by the bar.
130 ///
131 /// Readable | Writable
132 ///
133 ///
134 /// #### `min-value`
135 /// The [`min-value`][struct@crate::LevelBar#min-value] property determines the minimum value of
136 /// the interval that can be displayed by the bar.
137 ///
138 /// Readable | Writable
139 ///
140 ///
141 /// #### `mode`
142 /// The [`mode`][struct@crate::LevelBar#mode] property determines the way [`LevelBar`][crate::LevelBar]
143 /// interprets the value properties to draw the level fill area.
144 /// Specifically, when the value is [`LevelBarMode::Continuous`][crate::LevelBarMode::Continuous],
145 /// [`LevelBar`][crate::LevelBar] will draw a single block representing the current value in
146 /// that area; when the value is [`LevelBarMode::Discrete`][crate::LevelBarMode::Discrete],
147 /// the widget will draw a succession of separate blocks filling the
148 /// draw area, with the number of blocks being equal to the units separating
149 /// the integral roundings of [`min-value`][struct@crate::LevelBar#min-value] and [`max-value`][struct@crate::LevelBar#max-value].
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `value`
155 /// The [`value`][struct@crate::LevelBar#value] property determines the currently
156 /// filled value of the level bar.
157 ///
158 /// Readable | Writable
159 /// <details><summary><h4>Widget</h4></summary>
160 ///
161 ///
162 /// #### `app-paintable`
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `can-default`
167 /// Readable | Writable
168 ///
169 ///
170 /// #### `can-focus`
171 /// Readable | Writable
172 ///
173 ///
174 /// #### `composite-child`
175 /// Readable
176 ///
177 ///
178 /// #### `double-buffered`
179 /// Whether the widget is double buffered.
180 ///
181 /// Readable | Writable
182 ///
183 ///
184 /// #### `events`
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `expand`
189 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
190 ///
191 /// Readable | Writable
192 ///
193 ///
194 /// #### `focus-on-click`
195 /// Whether the widget should grab focus when it is clicked with the mouse.
196 ///
197 /// This property is only relevant for widgets that can take focus.
198 ///
199 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
200 /// GtkComboBox) implemented this property individually.
201 ///
202 /// Readable | Writable
203 ///
204 ///
205 /// #### `halign`
206 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
207 ///
208 /// Readable | Writable
209 ///
210 ///
211 /// #### `has-default`
212 /// Readable | Writable
213 ///
214 ///
215 /// #### `has-focus`
216 /// Readable | Writable
217 ///
218 ///
219 /// #### `has-tooltip`
220 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
221 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
222 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
223 /// whether it will provide a tooltip or not.
224 ///
225 /// Note that setting this property to [`true`] for the first time will change
226 /// the event masks of the GdkWindows of this widget to include leave-notify
227 /// and motion-notify events. This cannot and will not be undone when the
228 /// property is set to [`false`] again.
229 ///
230 /// Readable | Writable
231 ///
232 ///
233 /// #### `height-request`
234 /// Readable | Writable
235 ///
236 ///
237 /// #### `hexpand`
238 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
239 ///
240 /// Readable | Writable
241 ///
242 ///
243 /// #### `hexpand-set`
244 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
245 ///
246 /// Readable | Writable
247 ///
248 ///
249 /// #### `is-focus`
250 /// Readable | Writable
251 ///
252 ///
253 /// #### `margin`
254 /// Sets all four sides' margin at once. If read, returns max
255 /// margin on any side.
256 ///
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `margin-bottom`
261 /// Margin on bottom side of widget.
262 ///
263 /// This property adds margin outside of the widget's normal size
264 /// request, the margin will be added in addition to the size from
265 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
266 ///
267 /// Readable | Writable
268 ///
269 ///
270 /// #### `margin-end`
271 /// Margin on end of widget, horizontally. This property supports
272 /// left-to-right and right-to-left text 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-left`
282 /// Margin on left 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 /// #### `margin-right`
292 /// Margin on right side of widget.
293 ///
294 /// This property adds margin outside of the widget's normal size
295 /// request, the margin will be added in addition to the size from
296 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
297 ///
298 /// Readable | Writable
299 ///
300 ///
301 /// #### `margin-start`
302 /// Margin on start of widget, horizontally. This property supports
303 /// left-to-right and right-to-left text directions.
304 ///
305 /// This property adds margin outside of the widget's normal size
306 /// request, the margin will be added in addition to the size from
307 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
308 ///
309 /// Readable | Writable
310 ///
311 ///
312 /// #### `margin-top`
313 /// Margin on top side of widget.
314 ///
315 /// This property adds margin outside of the widget's normal size
316 /// request, the margin will be added in addition to the size from
317 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
318 ///
319 /// Readable | Writable
320 ///
321 ///
322 /// #### `name`
323 /// Readable | Writable
324 ///
325 ///
326 /// #### `no-show-all`
327 /// Readable | Writable
328 ///
329 ///
330 /// #### `opacity`
331 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
332 /// more details about window opacity.
333 ///
334 /// Before 3.8 this was only available in GtkWindow
335 ///
336 /// Readable | Writable
337 ///
338 ///
339 /// #### `parent`
340 /// Readable | Writable
341 ///
342 ///
343 /// #### `receives-default`
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `scale-factor`
348 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
349 /// more details about widget scaling.
350 ///
351 /// Readable
352 ///
353 ///
354 /// #### `sensitive`
355 /// Readable | Writable
356 ///
357 ///
358 /// #### `style`
359 /// The style of the widget, which contains information about how it will look (colors, etc).
360 ///
361 /// Readable | Writable
362 ///
363 ///
364 /// #### `tooltip-markup`
365 /// Sets the text of tooltip to be the given string, which is marked up
366 /// with the [Pango text markup language][PangoMarkupFormat].
367 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
368 ///
369 /// This is a convenience property which will take care of getting the
370 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
371 /// will automatically be set to [`true`] and there will be taken care of
372 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
373 ///
374 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
375 /// are set, the last one wins.
376 ///
377 /// Readable | Writable
378 ///
379 ///
380 /// #### `tooltip-text`
381 /// Sets the text of tooltip to be the given string.
382 ///
383 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
384 ///
385 /// This is a convenience property which will take care of getting the
386 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
387 /// will automatically be set to [`true`] and there will be taken care of
388 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
389 ///
390 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
391 /// are set, the last one wins.
392 ///
393 /// Readable | Writable
394 ///
395 ///
396 /// #### `valign`
397 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
398 ///
399 /// Readable | Writable
400 ///
401 ///
402 /// #### `vexpand`
403 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
404 ///
405 /// Readable | Writable
406 ///
407 ///
408 /// #### `vexpand-set`
409 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
410 ///
411 /// Readable | Writable
412 ///
413 ///
414 /// #### `visible`
415 /// Readable | Writable
416 ///
417 ///
418 /// #### `width-request`
419 /// Readable | Writable
420 ///
421 ///
422 /// #### `window`
423 /// The widget's window if it is realized, [`None`] otherwise.
424 ///
425 /// Readable
426 /// </details>
427 /// <details><summary><h4>Orientable</h4></summary>
428 ///
429 ///
430 /// #### `orientation`
431 /// The orientation of the orientable.
432 ///
433 /// Readable | Writable
434 /// </details>
435 ///
436 /// ## Signals
437 ///
438 ///
439 /// #### `offset-changed`
440 /// Emitted when an offset specified on the bar changes value as an
441 /// effect to [`LevelBarExt::add_offset_value()`][crate::prelude::LevelBarExt::add_offset_value()] being called.
442 ///
443 /// The signal supports detailed connections; you can connect to the
444 /// detailed signal "changed::x" in order to only receive callbacks when
445 /// the value of offset "x" changes.
446 ///
447 /// Detailed
448 /// <details><summary><h4>Widget</h4></summary>
449 ///
450 ///
451 /// #### `accel-closures-changed`
452 ///
453 ///
454 ///
455 /// #### `button-press-event`
456 /// The ::button-press-event signal will be emitted when a button
457 /// (typically from a mouse) is pressed.
458 ///
459 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
460 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
461 ///
462 /// This signal will be sent to the grab widget if there is one.
463 ///
464 ///
465 ///
466 ///
467 /// #### `button-release-event`
468 /// The ::button-release-event signal will be emitted when a button
469 /// (typically from a mouse) is released.
470 ///
471 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
472 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
473 ///
474 /// This signal will be sent to the grab widget if there is one.
475 ///
476 ///
477 ///
478 ///
479 /// #### `can-activate-accel`
480 /// Determines whether an accelerator that activates the signal
481 /// identified by `signal_id` can currently be activated.
482 /// This signal is present to allow applications and derived
483 /// widgets to override the default [`Widget`][crate::Widget] handling
484 /// for determining whether an accelerator can be activated.
485 ///
486 ///
487 ///
488 ///
489 /// #### `child-notify`
490 /// The ::child-notify signal is emitted for each
491 /// [child property][child-properties] that has
492 /// changed on an object. The signal's detail holds the property name.
493 ///
494 /// Detailed
495 ///
496 ///
497 /// #### `composited-changed`
498 /// The ::composited-changed signal is emitted when the composited
499 /// status of `widgets` screen changes.
500 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
501 ///
502 /// Action
503 ///
504 ///
505 /// #### `configure-event`
506 /// The ::configure-event signal will be emitted when the size, position or
507 /// stacking of the `widget`'s window has changed.
508 ///
509 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
510 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
511 /// automatically for all new windows.
512 ///
513 ///
514 ///
515 ///
516 /// #### `damage-event`
517 /// Emitted when a redirected window belonging to `widget` gets drawn into.
518 /// The region/area members of the event shows what area of the redirected
519 /// drawable was drawn into.
520 ///
521 ///
522 ///
523 ///
524 /// #### `delete-event`
525 /// The ::delete-event signal is emitted if a user requests that
526 /// a toplevel window is closed. The default handler for this signal
527 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
528 /// this signal will cause the window to be hidden instead, so that
529 /// it can later be shown again without reconstructing it.
530 ///
531 ///
532 ///
533 ///
534 /// #### `destroy`
535 /// Signals that all holders of a reference to the widget should release
536 /// the reference that they hold. May result in finalization of the widget
537 /// if all references are released.
538 ///
539 /// This signal is not suitable for saving widget state.
540 ///
541 ///
542 ///
543 ///
544 /// #### `destroy-event`
545 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
546 /// You rarely get this signal, because most widgets disconnect themselves
547 /// from their window before they destroy it, so no widget owns the
548 /// window at destroy time.
549 ///
550 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
551 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
552 /// automatically for all new windows.
553 ///
554 ///
555 ///
556 ///
557 /// #### `direction-changed`
558 /// The ::direction-changed signal is emitted when the text direction
559 /// of a widget changes.
560 ///
561 ///
562 ///
563 ///
564 /// #### `drag-begin`
565 /// The ::drag-begin signal is emitted on the drag source when a drag is
566 /// started. A typical reason to connect to this signal is to set up a
567 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
568 ///
569 /// Note that some widgets set up a drag icon in the default handler of
570 /// this signal, so you may have to use `g_signal_connect_after()` to
571 /// override what the default handler did.
572 ///
573 ///
574 ///
575 ///
576 /// #### `drag-data-delete`
577 /// The ::drag-data-delete signal is emitted on the drag source when a drag
578 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
579 /// handler is responsible for deleting the data that has been dropped. What
580 /// "delete" means depends on the context of the drag operation.
581 ///
582 ///
583 ///
584 ///
585 /// #### `drag-data-get`
586 /// The ::drag-data-get signal is emitted on the drag source when the drop
587 /// site requests the data which is dragged. It is the responsibility of
588 /// the signal handler to fill `data` with the data in the format which
589 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
590 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
591 ///
592 ///
593 ///
594 ///
595 /// #### `drag-data-received`
596 /// The ::drag-data-received signal is emitted on the drop site when the
597 /// dragged data has been received. If the data was received in order to
598 /// determine whether the drop will be accepted, the handler is expected
599 /// to call `gdk_drag_status()` and not finish the drag.
600 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
601 /// (and this is the last target to be received), the handler for this
602 /// signal is expected to process the received data and then call
603 /// `gtk_drag_finish()`, setting the `success` parameter depending on
604 /// whether the data was processed successfully.
605 ///
606 /// Applications must create some means to determine why the signal was emitted
607 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
608 ///
609 /// The handler may inspect the selected action with
610 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
611 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
612 /// shown in the following example:
613 ///
614 ///
615 /// **⚠️ The following code is in C ⚠️**
616 ///
617 /// ```C
618 /// void
619 /// drag_data_received (GtkWidget *widget,
620 /// GdkDragContext *context,
621 /// gint x,
622 /// gint y,
623 /// GtkSelectionData *data,
624 /// guint info,
625 /// guint time)
626 /// {
627 /// if ((data->length >= 0) && (data->format == 8))
628 /// {
629 /// GdkDragAction action;
630 ///
631 /// // handle data here
632 ///
633 /// action = gdk_drag_context_get_selected_action (context);
634 /// if (action == GDK_ACTION_ASK)
635 /// {
636 /// GtkWidget *dialog;
637 /// gint response;
638 ///
639 /// dialog = gtk_message_dialog_new (NULL,
640 /// GTK_DIALOG_MODAL |
641 /// GTK_DIALOG_DESTROY_WITH_PARENT,
642 /// GTK_MESSAGE_INFO,
643 /// GTK_BUTTONS_YES_NO,
644 /// "Move the data ?\n");
645 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
646 /// gtk_widget_destroy (dialog);
647 ///
648 /// if (response == GTK_RESPONSE_YES)
649 /// action = GDK_ACTION_MOVE;
650 /// else
651 /// action = GDK_ACTION_COPY;
652 /// }
653 ///
654 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
655 /// }
656 /// else
657 /// gtk_drag_finish (context, FALSE, FALSE, time);
658 /// }
659 /// ```
660 ///
661 ///
662 ///
663 ///
664 /// #### `drag-drop`
665 /// The ::drag-drop signal is emitted on the drop site when the user drops
666 /// the data onto the widget. The signal handler must determine whether
667 /// the cursor position is in a drop zone or not. If it is not in a drop
668 /// zone, it returns [`false`] and no further processing is necessary.
669 /// Otherwise, the handler returns [`true`]. In this case, the handler must
670 /// ensure that `gtk_drag_finish()` is called to let the source know that
671 /// the drop is done. The call to `gtk_drag_finish()` can be done either
672 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
673 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
674 /// or more of the supported targets.
675 ///
676 ///
677 ///
678 ///
679 /// #### `drag-end`
680 /// The ::drag-end signal is emitted on the drag source when a drag is
681 /// finished. A typical reason to connect to this signal is to undo
682 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
683 ///
684 ///
685 ///
686 ///
687 /// #### `drag-failed`
688 /// The ::drag-failed signal is emitted on the drag source when a drag has
689 /// failed. The signal handler may hook custom code to handle a failed DnD
690 /// operation based on the type of error, it returns [`true`] is the failure has
691 /// been already handled (not showing the default "drag operation failed"
692 /// animation), otherwise it returns [`false`].
693 ///
694 ///
695 ///
696 ///
697 /// #### `drag-leave`
698 /// The ::drag-leave signal is emitted on the drop site when the cursor
699 /// leaves the widget. A typical reason to connect to this signal is to
700 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
701 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
702 ///
703 ///
704 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
705 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
706 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
707 ///
708 ///
709 ///
710 ///
711 /// #### `drag-motion`
712 /// The ::drag-motion signal is emitted on the drop site when the user
713 /// moves the cursor over the widget during a drag. The signal handler
714 /// must determine whether the cursor position is in a drop zone or not.
715 /// If it is not in a drop zone, it returns [`false`] and no further processing
716 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
717 /// handler is responsible for providing the necessary information for
718 /// displaying feedback to the user, by calling `gdk_drag_status()`.
719 ///
720 /// If the decision whether the drop will be accepted or rejected can't be
721 /// made based solely on the cursor position and the type of the data, the
722 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
723 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
724 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
725 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
726 /// when using the drag-motion signal that way.
727 ///
728 /// Also note that there is no drag-enter signal. The drag receiver has to
729 /// keep track of whether he has received any drag-motion signals since the
730 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
731 /// an "enter" signal. Upon an "enter", the handler will typically highlight
732 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
733 ///
734 ///
735 /// **⚠️ The following code is in C ⚠️**
736 ///
737 /// ```C
738 /// static void
739 /// drag_motion (GtkWidget *widget,
740 /// GdkDragContext *context,
741 /// gint x,
742 /// gint y,
743 /// guint time)
744 /// {
745 /// GdkAtom target;
746 ///
747 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
748 ///
749 /// if (!private_data->drag_highlight)
750 /// {
751 /// private_data->drag_highlight = 1;
752 /// gtk_drag_highlight (widget);
753 /// }
754 ///
755 /// target = gtk_drag_dest_find_target (widget, context, NULL);
756 /// if (target == GDK_NONE)
757 /// gdk_drag_status (context, 0, time);
758 /// else
759 /// {
760 /// private_data->pending_status
761 /// = gdk_drag_context_get_suggested_action (context);
762 /// gtk_drag_get_data (widget, context, target, time);
763 /// }
764 ///
765 /// return TRUE;
766 /// }
767 ///
768 /// static void
769 /// drag_data_received (GtkWidget *widget,
770 /// GdkDragContext *context,
771 /// gint x,
772 /// gint y,
773 /// GtkSelectionData *selection_data,
774 /// guint info,
775 /// guint time)
776 /// {
777 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
778 ///
779 /// if (private_data->suggested_action)
780 /// {
781 /// private_data->suggested_action = 0;
782 ///
783 /// // We are getting this data due to a request in drag_motion,
784 /// // rather than due to a request in drag_drop, so we are just
785 /// // supposed to call gdk_drag_status(), not actually paste in
786 /// // the data.
787 ///
788 /// str = gtk_selection_data_get_text (selection_data);
789 /// if (!data_is_acceptable (str))
790 /// gdk_drag_status (context, 0, time);
791 /// else
792 /// gdk_drag_status (context,
793 /// private_data->suggested_action,
794 /// time);
795 /// }
796 /// else
797 /// {
798 /// // accept the drop
799 /// }
800 /// }
801 /// ```
802 ///
803 ///
804 ///
805 ///
806 /// #### `draw`
807 /// This signal is emitted when a widget is supposed to render itself.
808 /// The `widget`'s top left corner must be painted at the origin of
809 /// the passed in context and be sized to the values returned by
810 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
811 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
812 ///
813 /// Signal handlers connected to this signal can modify the cairo
814 /// context passed as `cr` in any way they like and don't need to
815 /// restore it. The signal emission takes care of calling `cairo_save()`
816 /// before and `cairo_restore()` after invoking the handler.
817 ///
818 /// The signal handler will get a `cr` with a clip region already set to the
819 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
820 /// widgets that want to avoid redrawing themselves completely can get the full
821 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
822 /// get a finer-grained representation of the dirty region with
823 /// `cairo_copy_clip_rectangle_list()`.
824 ///
825 ///
826 ///
827 ///
828 /// #### `enter-notify-event`
829 /// The ::enter-notify-event will be emitted when the pointer enters
830 /// the `widget`'s window.
831 ///
832 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
833 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
834 ///
835 /// This signal will be sent to the grab widget if there is one.
836 ///
837 ///
838 ///
839 ///
840 /// #### `event`
841 /// The GTK+ main loop will emit three signals for each GDK event delivered
842 /// to a widget: one generic ::event signal, another, more specific,
843 /// signal that matches the type of event delivered (e.g.
844 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
845 /// [`event-after`][struct@crate::Widget#event-after] signal.
846 ///
847 ///
848 ///
849 ///
850 /// #### `event-after`
851 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
852 /// the second more specific signal, ::event-after will be emitted
853 /// regardless of the previous two signals handlers return values.
854 ///
855 ///
856 ///
857 ///
858 /// #### `focus`
859 ///
860 ///
861 ///
862 /// #### `focus-in-event`
863 /// The ::focus-in-event signal will be emitted when the keyboard focus
864 /// enters the `widget`'s window.
865 ///
866 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
867 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
868 ///
869 ///
870 ///
871 ///
872 /// #### `focus-out-event`
873 /// The ::focus-out-event signal will be emitted when the keyboard focus
874 /// leaves the `widget`'s window.
875 ///
876 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
877 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
878 ///
879 ///
880 ///
881 ///
882 /// #### `grab-broken-event`
883 /// Emitted when a pointer or keyboard grab on a window belonging
884 /// to `widget` gets broken.
885 ///
886 /// On X11, this happens when the grab window becomes unviewable
887 /// (i.e. it or one of its ancestors is unmapped), or if the same
888 /// application grabs the pointer or keyboard again.
889 ///
890 ///
891 ///
892 ///
893 /// #### `grab-focus`
894 /// Action
895 ///
896 ///
897 /// #### `grab-notify`
898 /// The ::grab-notify signal is emitted when a widget becomes
899 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
900 /// another widget, or when it becomes unshadowed due to a grab
901 /// being removed.
902 ///
903 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
904 /// grab widget in the grab stack of its window group is not
905 /// its ancestor.
906 ///
907 ///
908 ///
909 ///
910 /// #### `hide`
911 /// The ::hide signal is emitted when `widget` is hidden, for example with
912 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
913 ///
914 ///
915 ///
916 ///
917 /// #### `hierarchy-changed`
918 /// The ::hierarchy-changed signal is emitted when the
919 /// anchored state of a widget changes. A widget is
920 /// “anchored” when its toplevel
921 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
922 /// a widget changes from un-anchored to anchored or vice-versa.
923 ///
924 ///
925 ///
926 ///
927 /// #### `key-press-event`
928 /// The ::key-press-event signal is emitted when a key is pressed. The signal
929 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
930 ///
931 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
932 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
933 ///
934 /// This signal will be sent to the grab widget if there is one.
935 ///
936 ///
937 ///
938 ///
939 /// #### `key-release-event`
940 /// The ::key-release-event signal is emitted when a key is released.
941 ///
942 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
943 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
944 ///
945 /// This signal will be sent to the grab widget if there is one.
946 ///
947 ///
948 ///
949 ///
950 /// #### `keynav-failed`
951 /// Gets emitted if keyboard navigation fails.
952 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
953 ///
954 ///
955 ///
956 ///
957 /// #### `leave-notify-event`
958 /// The ::leave-notify-event will be emitted when the pointer leaves
959 /// the `widget`'s window.
960 ///
961 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
962 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
963 ///
964 /// This signal will be sent to the grab widget if there is one.
965 ///
966 ///
967 ///
968 ///
969 /// #### `map`
970 /// The ::map signal is emitted when `widget` is going to be mapped, that is
971 /// when the widget is visible (which is controlled with
972 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
973 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
974 /// be emitted.
975 ///
976 /// The ::map signal can be used to determine whether a widget will be drawn,
977 /// for instance it can resume an animation that was stopped during the
978 /// emission of [`unmap`][struct@crate::Widget#unmap].
979 ///
980 ///
981 ///
982 ///
983 /// #### `map-event`
984 /// The ::map-event signal will be emitted when the `widget`'s window is
985 /// mapped. A window is mapped when it becomes visible on the screen.
986 ///
987 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
988 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
989 /// automatically for all new windows.
990 ///
991 ///
992 ///
993 ///
994 /// #### `mnemonic-activate`
995 /// The default handler for this signal activates `widget` if `group_cycling`
996 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
997 ///
998 ///
999 ///
1000 ///
1001 /// #### `motion-notify-event`
1002 /// The ::motion-notify-event signal is emitted when the pointer moves
1003 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1004 ///
1005 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1006 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1007 ///
1008 /// This signal will be sent to the grab widget if there is one.
1009 ///
1010 ///
1011 ///
1012 ///
1013 /// #### `move-focus`
1014 /// Action
1015 ///
1016 ///
1017 /// #### `parent-set`
1018 /// The ::parent-set signal is emitted when a new parent
1019 /// has been set on a widget.
1020 ///
1021 ///
1022 ///
1023 ///
1024 /// #### `popup-menu`
1025 /// This signal gets emitted whenever a widget should pop up a context
1026 /// menu. This usually happens through the standard key binding mechanism;
1027 /// by pressing a certain key while a widget is focused, the user can cause
1028 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1029 /// a menu with clipboard commands. See the
1030 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1031 /// for an example of how to use this signal.
1032 ///
1033 /// Action
1034 ///
1035 ///
1036 /// #### `property-notify-event`
1037 /// The ::property-notify-event signal will be emitted when a property on
1038 /// the `widget`'s window has been changed or deleted.
1039 ///
1040 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1041 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1042 ///
1043 ///
1044 ///
1045 ///
1046 /// #### `proximity-in-event`
1047 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1048 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1049 ///
1050 /// This signal will be sent to the grab widget if there is one.
1051 ///
1052 ///
1053 ///
1054 ///
1055 /// #### `proximity-out-event`
1056 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1057 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1058 ///
1059 /// This signal will be sent to the grab widget if there is one.
1060 ///
1061 ///
1062 ///
1063 ///
1064 /// #### `query-tooltip`
1065 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1066 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1067 /// focus in keyboard mode.
1068 ///
1069 /// Using the given coordinates, the signal handler should determine
1070 /// whether a tooltip should be shown for `widget`. If this is the case
1071 /// [`true`] should be returned, [`false`] otherwise. Note that if
1072 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1073 /// should not be used.
1074 ///
1075 /// The signal handler is free to manipulate `tooltip` with the therefore
1076 /// destined function calls.
1077 ///
1078 ///
1079 ///
1080 ///
1081 /// #### `realize`
1082 /// The ::realize signal is emitted when `widget` is associated with a
1083 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1084 /// widget has been mapped (that is, it is going to be drawn).
1085 ///
1086 ///
1087 ///
1088 ///
1089 /// #### `screen-changed`
1090 /// The ::screen-changed signal gets emitted when the
1091 /// screen of a widget has changed.
1092 ///
1093 ///
1094 ///
1095 ///
1096 /// #### `scroll-event`
1097 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1098 /// range is pressed. Wheel mice are usually configured to generate
1099 /// button press events for buttons 4 and 5 when the wheel is turned.
1100 ///
1101 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1102 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1103 ///
1104 /// This signal will be sent to the grab widget if there is one.
1105 ///
1106 ///
1107 ///
1108 ///
1109 /// #### `selection-clear-event`
1110 /// The ::selection-clear-event signal will be emitted when the
1111 /// the `widget`'s window has lost ownership of a selection.
1112 ///
1113 ///
1114 ///
1115 ///
1116 /// #### `selection-get`
1117 ///
1118 ///
1119 ///
1120 /// #### `selection-notify-event`
1121 ///
1122 ///
1123 ///
1124 /// #### `selection-received`
1125 ///
1126 ///
1127 ///
1128 /// #### `selection-request-event`
1129 /// The ::selection-request-event signal will be emitted when
1130 /// another client requests ownership of the selection owned by
1131 /// the `widget`'s window.
1132 ///
1133 ///
1134 ///
1135 ///
1136 /// #### `show`
1137 /// The ::show signal is emitted when `widget` is shown, for example with
1138 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1139 ///
1140 ///
1141 ///
1142 ///
1143 /// #### `show-help`
1144 /// Action
1145 ///
1146 ///
1147 /// #### `size-allocate`
1148 ///
1149 ///
1150 ///
1151 /// #### `state-changed`
1152 /// The ::state-changed signal is emitted when the widget state changes.
1153 /// See `gtk_widget_get_state()`.
1154 ///
1155 ///
1156 ///
1157 ///
1158 /// #### `state-flags-changed`
1159 /// The ::state-flags-changed signal is emitted when the widget state
1160 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1161 ///
1162 ///
1163 ///
1164 ///
1165 /// #### `style-set`
1166 /// The ::style-set signal is emitted when a new style has been set
1167 /// on a widget. Note that style-modifying functions like
1168 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1169 ///
1170 /// Note that this signal is emitted for changes to the deprecated
1171 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1172 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1173 ///
1174 ///
1175 ///
1176 ///
1177 /// #### `style-updated`
1178 /// The ::style-updated signal is a convenience signal that is emitted when the
1179 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1180 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1181 ///
1182 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1183 /// cause this signal to be emitted.
1184 ///
1185 ///
1186 ///
1187 ///
1188 /// #### `touch-event`
1189 ///
1190 ///
1191 ///
1192 /// #### `unmap`
1193 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1194 /// means that either it or any of its parents up to the toplevel widget have
1195 /// been set as hidden.
1196 ///
1197 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1198 /// used to, for example, stop an animation on the widget.
1199 ///
1200 ///
1201 ///
1202 ///
1203 /// #### `unmap-event`
1204 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1205 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1206 ///
1207 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1208 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1209 /// automatically for all new windows.
1210 ///
1211 ///
1212 ///
1213 ///
1214 /// #### `unrealize`
1215 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1216 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1217 /// called or the widget has been unmapped (that is, it is going to be
1218 /// hidden).
1219 ///
1220 ///
1221 ///
1222 ///
1223 /// #### `visibility-notify-event`
1224 /// The ::visibility-notify-event will be emitted when the `widget`'s
1225 /// window is obscured or unobscured.
1226 ///
1227 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1228 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1229 ///
1230 ///
1231 ///
1232 ///
1233 /// #### `window-state-event`
1234 /// The ::window-state-event will be emitted when the state of the
1235 /// toplevel window associated to the `widget` changes.
1236 ///
1237 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1238 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1239 /// this mask automatically for all new windows.
1240 ///
1241 ///
1242 /// </details>
1243 ///
1244 /// # Implements
1245 ///
1246 /// [`LevelBarExt`][trait@crate::prelude::LevelBarExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1247 #[doc(alias = "GtkLevelBar")]
1248 pub struct LevelBar(Object<ffi::GtkLevelBar, ffi::GtkLevelBarClass>) @extends Widget, @implements Buildable, Orientable;
1249
1250 match fn {
1251 type_ => || ffi::gtk_level_bar_get_type(),
1252 }
1253}
1254
1255impl LevelBar {
1256 pub const NONE: Option<&'static LevelBar> = None;
1257
1258 /// Creates a new [`LevelBar`][crate::LevelBar].
1259 ///
1260 /// # Returns
1261 ///
1262 /// a [`LevelBar`][crate::LevelBar].
1263 #[doc(alias = "gtk_level_bar_new")]
1264 pub fn new() -> LevelBar {
1265 assert_initialized_main_thread!();
1266 unsafe { Widget::from_glib_none(ffi::gtk_level_bar_new()).unsafe_cast() }
1267 }
1268
1269 /// Utility constructor that creates a new [`LevelBar`][crate::LevelBar] for the specified
1270 /// interval.
1271 /// ## `min_value`
1272 /// a positive value
1273 /// ## `max_value`
1274 /// a positive value
1275 ///
1276 /// # Returns
1277 ///
1278 /// a [`LevelBar`][crate::LevelBar]
1279 #[doc(alias = "gtk_level_bar_new_for_interval")]
1280 #[doc(alias = "new_for_interval")]
1281 pub fn for_interval(min_value: f64, max_value: f64) -> LevelBar {
1282 assert_initialized_main_thread!();
1283 unsafe {
1284 Widget::from_glib_none(ffi::gtk_level_bar_new_for_interval(min_value, max_value))
1285 .unsafe_cast()
1286 }
1287 }
1288
1289 // rustdoc-stripper-ignore-next
1290 /// Creates a new builder-pattern struct instance to construct [`LevelBar`] objects.
1291 ///
1292 /// This method returns an instance of [`LevelBarBuilder`](crate::builders::LevelBarBuilder) which can be used to create [`LevelBar`] objects.
1293 pub fn builder() -> LevelBarBuilder {
1294 LevelBarBuilder::new()
1295 }
1296}
1297
1298impl Default for LevelBar {
1299 fn default() -> Self {
1300 Self::new()
1301 }
1302}
1303
1304// rustdoc-stripper-ignore-next
1305/// A [builder-pattern] type to construct [`LevelBar`] objects.
1306///
1307/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1308#[must_use = "The builder must be built to be used"]
1309pub struct LevelBarBuilder {
1310 builder: glib::object::ObjectBuilder<'static, LevelBar>,
1311}
1312
1313impl LevelBarBuilder {
1314 fn new() -> Self {
1315 Self {
1316 builder: glib::object::Object::builder(),
1317 }
1318 }
1319
1320 /// Level bars normally grow from top to bottom or left to right.
1321 /// Inverted level bars grow in the opposite direction.
1322 pub fn inverted(self, inverted: bool) -> Self {
1323 Self {
1324 builder: self.builder.property("inverted", inverted),
1325 }
1326 }
1327
1328 /// The [`max-value`][struct@crate::LevelBar#max-value] property determaxes the maximum value of
1329 /// the interval that can be displayed by the bar.
1330 pub fn max_value(self, max_value: f64) -> Self {
1331 Self {
1332 builder: self.builder.property("max-value", max_value),
1333 }
1334 }
1335
1336 /// The [`min-value`][struct@crate::LevelBar#min-value] property determines the minimum value of
1337 /// the interval that can be displayed by the bar.
1338 pub fn min_value(self, min_value: f64) -> Self {
1339 Self {
1340 builder: self.builder.property("min-value", min_value),
1341 }
1342 }
1343
1344 /// The [`mode`][struct@crate::LevelBar#mode] property determines the way [`LevelBar`][crate::LevelBar]
1345 /// interprets the value properties to draw the level fill area.
1346 /// Specifically, when the value is [`LevelBarMode::Continuous`][crate::LevelBarMode::Continuous],
1347 /// [`LevelBar`][crate::LevelBar] will draw a single block representing the current value in
1348 /// that area; when the value is [`LevelBarMode::Discrete`][crate::LevelBarMode::Discrete],
1349 /// the widget will draw a succession of separate blocks filling the
1350 /// draw area, with the number of blocks being equal to the units separating
1351 /// the integral roundings of [`min-value`][struct@crate::LevelBar#min-value] and [`max-value`][struct@crate::LevelBar#max-value].
1352 pub fn mode(self, mode: LevelBarMode) -> Self {
1353 Self {
1354 builder: self.builder.property("mode", mode),
1355 }
1356 }
1357
1358 /// The [`value`][struct@crate::LevelBar#value] property determines the currently
1359 /// filled value of the level bar.
1360 pub fn value(self, value: f64) -> Self {
1361 Self {
1362 builder: self.builder.property("value", value),
1363 }
1364 }
1365
1366 pub fn app_paintable(self, app_paintable: bool) -> Self {
1367 Self {
1368 builder: self.builder.property("app-paintable", app_paintable),
1369 }
1370 }
1371
1372 pub fn can_default(self, can_default: bool) -> Self {
1373 Self {
1374 builder: self.builder.property("can-default", can_default),
1375 }
1376 }
1377
1378 pub fn can_focus(self, can_focus: bool) -> Self {
1379 Self {
1380 builder: self.builder.property("can-focus", can_focus),
1381 }
1382 }
1383
1384 pub fn events(self, events: gdk::EventMask) -> Self {
1385 Self {
1386 builder: self.builder.property("events", events),
1387 }
1388 }
1389
1390 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1391 pub fn expand(self, expand: bool) -> Self {
1392 Self {
1393 builder: self.builder.property("expand", expand),
1394 }
1395 }
1396
1397 /// Whether the widget should grab focus when it is clicked with the mouse.
1398 ///
1399 /// This property is only relevant for widgets that can take focus.
1400 ///
1401 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1402 /// GtkComboBox) implemented this property individually.
1403 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1404 Self {
1405 builder: self.builder.property("focus-on-click", focus_on_click),
1406 }
1407 }
1408
1409 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1410 pub fn halign(self, halign: Align) -> Self {
1411 Self {
1412 builder: self.builder.property("halign", halign),
1413 }
1414 }
1415
1416 pub fn has_default(self, has_default: bool) -> Self {
1417 Self {
1418 builder: self.builder.property("has-default", has_default),
1419 }
1420 }
1421
1422 pub fn has_focus(self, has_focus: bool) -> Self {
1423 Self {
1424 builder: self.builder.property("has-focus", has_focus),
1425 }
1426 }
1427
1428 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1429 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1430 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1431 /// whether it will provide a tooltip or not.
1432 ///
1433 /// Note that setting this property to [`true`] for the first time will change
1434 /// the event masks of the GdkWindows of this widget to include leave-notify
1435 /// and motion-notify events. This cannot and will not be undone when the
1436 /// property is set to [`false`] again.
1437 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1438 Self {
1439 builder: self.builder.property("has-tooltip", has_tooltip),
1440 }
1441 }
1442
1443 pub fn height_request(self, height_request: i32) -> Self {
1444 Self {
1445 builder: self.builder.property("height-request", height_request),
1446 }
1447 }
1448
1449 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1450 pub fn hexpand(self, hexpand: bool) -> Self {
1451 Self {
1452 builder: self.builder.property("hexpand", hexpand),
1453 }
1454 }
1455
1456 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1457 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1458 Self {
1459 builder: self.builder.property("hexpand-set", hexpand_set),
1460 }
1461 }
1462
1463 pub fn is_focus(self, is_focus: bool) -> Self {
1464 Self {
1465 builder: self.builder.property("is-focus", is_focus),
1466 }
1467 }
1468
1469 /// Sets all four sides' margin at once. If read, returns max
1470 /// margin on any side.
1471 pub fn margin(self, margin: i32) -> Self {
1472 Self {
1473 builder: self.builder.property("margin", margin),
1474 }
1475 }
1476
1477 /// Margin on bottom side of widget.
1478 ///
1479 /// This property adds margin outside of the widget's normal size
1480 /// request, the margin will be added in addition to the size from
1481 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1482 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1483 Self {
1484 builder: self.builder.property("margin-bottom", margin_bottom),
1485 }
1486 }
1487
1488 /// Margin on end of widget, horizontally. This property supports
1489 /// left-to-right and right-to-left text directions.
1490 ///
1491 /// This property adds margin outside of the widget's normal size
1492 /// request, the margin will be added in addition to the size from
1493 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1494 pub fn margin_end(self, margin_end: i32) -> Self {
1495 Self {
1496 builder: self.builder.property("margin-end", margin_end),
1497 }
1498 }
1499
1500 /// Margin on start of widget, horizontally. This property supports
1501 /// left-to-right and right-to-left text directions.
1502 ///
1503 /// This property adds margin outside of the widget's normal size
1504 /// request, the margin will be added in addition to the size from
1505 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1506 pub fn margin_start(self, margin_start: i32) -> Self {
1507 Self {
1508 builder: self.builder.property("margin-start", margin_start),
1509 }
1510 }
1511
1512 /// Margin on top side of widget.
1513 ///
1514 /// This property adds margin outside of the widget's normal size
1515 /// request, the margin will be added in addition to the size from
1516 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1517 pub fn margin_top(self, margin_top: i32) -> Self {
1518 Self {
1519 builder: self.builder.property("margin-top", margin_top),
1520 }
1521 }
1522
1523 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1524 Self {
1525 builder: self.builder.property("name", name.into()),
1526 }
1527 }
1528
1529 pub fn no_show_all(self, no_show_all: bool) -> Self {
1530 Self {
1531 builder: self.builder.property("no-show-all", no_show_all),
1532 }
1533 }
1534
1535 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1536 /// more details about window opacity.
1537 ///
1538 /// Before 3.8 this was only available in GtkWindow
1539 pub fn opacity(self, opacity: f64) -> Self {
1540 Self {
1541 builder: self.builder.property("opacity", opacity),
1542 }
1543 }
1544
1545 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1546 Self {
1547 builder: self.builder.property("parent", parent.clone().upcast()),
1548 }
1549 }
1550
1551 pub fn receives_default(self, receives_default: bool) -> Self {
1552 Self {
1553 builder: self.builder.property("receives-default", receives_default),
1554 }
1555 }
1556
1557 pub fn sensitive(self, sensitive: bool) -> Self {
1558 Self {
1559 builder: self.builder.property("sensitive", sensitive),
1560 }
1561 }
1562
1563 /// Sets the text of tooltip to be the given string, which is marked up
1564 /// with the [Pango text markup language][PangoMarkupFormat].
1565 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1566 ///
1567 /// This is a convenience property which will take care of getting the
1568 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1569 /// will automatically be set to [`true`] and there will be taken care of
1570 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1571 ///
1572 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1573 /// are set, the last one wins.
1574 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1575 Self {
1576 builder: self
1577 .builder
1578 .property("tooltip-markup", tooltip_markup.into()),
1579 }
1580 }
1581
1582 /// Sets the text of tooltip to be the given string.
1583 ///
1584 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1585 ///
1586 /// This is a convenience property which will take care of getting the
1587 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1588 /// will automatically be set to [`true`] and there will be taken care of
1589 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1590 ///
1591 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1592 /// are set, the last one wins.
1593 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1594 Self {
1595 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1596 }
1597 }
1598
1599 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1600 pub fn valign(self, valign: Align) -> Self {
1601 Self {
1602 builder: self.builder.property("valign", valign),
1603 }
1604 }
1605
1606 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1607 pub fn vexpand(self, vexpand: bool) -> Self {
1608 Self {
1609 builder: self.builder.property("vexpand", vexpand),
1610 }
1611 }
1612
1613 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1614 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1615 Self {
1616 builder: self.builder.property("vexpand-set", vexpand_set),
1617 }
1618 }
1619
1620 pub fn visible(self, visible: bool) -> Self {
1621 Self {
1622 builder: self.builder.property("visible", visible),
1623 }
1624 }
1625
1626 pub fn width_request(self, width_request: i32) -> Self {
1627 Self {
1628 builder: self.builder.property("width-request", width_request),
1629 }
1630 }
1631
1632 /// The orientation of the orientable.
1633 pub fn orientation(self, orientation: Orientation) -> Self {
1634 Self {
1635 builder: self.builder.property("orientation", orientation),
1636 }
1637 }
1638
1639 // rustdoc-stripper-ignore-next
1640 /// Build the [`LevelBar`].
1641 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1642 pub fn build(self) -> LevelBar {
1643 assert_initialized_main_thread!();
1644 self.builder.build()
1645 }
1646}
1647
1648/// Trait containing all [`struct@LevelBar`] methods.
1649///
1650/// # Implementors
1651///
1652/// [`LevelBar`][struct@crate::LevelBar]
1653pub trait LevelBarExt: IsA<LevelBar> + 'static {
1654 /// Adds a new offset marker on `self` at the position specified by `value`.
1655 /// When the bar value is in the interval topped by `value` (or between `value`
1656 /// and [`max-value`][struct@crate::LevelBar#max-value] in case the offset is the last one on the bar)
1657 /// a style class named `level-``name` will be applied
1658 /// when rendering the level bar fill.
1659 /// If another offset marker named `name` exists, its value will be
1660 /// replaced by `value`.
1661 /// ## `name`
1662 /// the name of the new offset
1663 /// ## `value`
1664 /// the value for the new offset
1665 #[doc(alias = "gtk_level_bar_add_offset_value")]
1666 fn add_offset_value(&self, name: &str, value: f64) {
1667 unsafe {
1668 ffi::gtk_level_bar_add_offset_value(
1669 self.as_ref().to_glib_none().0,
1670 name.to_glib_none().0,
1671 value,
1672 );
1673 }
1674 }
1675
1676 /// Return the value of the [`inverted`][struct@crate::LevelBar#inverted] property.
1677 ///
1678 /// # Returns
1679 ///
1680 /// [`true`] if the level bar is inverted
1681 #[doc(alias = "gtk_level_bar_get_inverted")]
1682 #[doc(alias = "get_inverted")]
1683 #[doc(alias = "inverted")]
1684 fn is_inverted(&self) -> bool {
1685 unsafe {
1686 from_glib(ffi::gtk_level_bar_get_inverted(
1687 self.as_ref().to_glib_none().0,
1688 ))
1689 }
1690 }
1691
1692 /// Returns the value of the [`max-value`][struct@crate::LevelBar#max-value] property.
1693 ///
1694 /// # Returns
1695 ///
1696 /// a positive value
1697 #[doc(alias = "gtk_level_bar_get_max_value")]
1698 #[doc(alias = "get_max_value")]
1699 #[doc(alias = "max-value")]
1700 fn max_value(&self) -> f64 {
1701 unsafe { ffi::gtk_level_bar_get_max_value(self.as_ref().to_glib_none().0) }
1702 }
1703
1704 /// Returns the value of the [`min-value`][struct@crate::LevelBar#min-value] property.
1705 ///
1706 /// # Returns
1707 ///
1708 /// a positive value
1709 #[doc(alias = "gtk_level_bar_get_min_value")]
1710 #[doc(alias = "get_min_value")]
1711 #[doc(alias = "min-value")]
1712 fn min_value(&self) -> f64 {
1713 unsafe { ffi::gtk_level_bar_get_min_value(self.as_ref().to_glib_none().0) }
1714 }
1715
1716 /// Returns the value of the [`mode`][struct@crate::LevelBar#mode] property.
1717 ///
1718 /// # Returns
1719 ///
1720 /// a [`LevelBarMode`][crate::LevelBarMode]
1721 #[doc(alias = "gtk_level_bar_get_mode")]
1722 #[doc(alias = "get_mode")]
1723 fn mode(&self) -> LevelBarMode {
1724 unsafe { from_glib(ffi::gtk_level_bar_get_mode(self.as_ref().to_glib_none().0)) }
1725 }
1726
1727 /// Fetches the value specified for the offset marker `name` in `self`,
1728 /// returning [`true`] in case an offset named `name` was found.
1729 /// ## `name`
1730 /// the name of an offset in the bar
1731 ///
1732 /// # Returns
1733 ///
1734 /// [`true`] if the specified offset is found
1735 ///
1736 /// ## `value`
1737 /// location where to store the value
1738 #[doc(alias = "gtk_level_bar_get_offset_value")]
1739 #[doc(alias = "get_offset_value")]
1740 fn offset_value(&self, name: Option<&str>) -> Option<f64> {
1741 unsafe {
1742 let mut value = std::mem::MaybeUninit::uninit();
1743 let ret = from_glib(ffi::gtk_level_bar_get_offset_value(
1744 self.as_ref().to_glib_none().0,
1745 name.to_glib_none().0,
1746 value.as_mut_ptr(),
1747 ));
1748 if ret { Some(value.assume_init()) } else { None }
1749 }
1750 }
1751
1752 /// Returns the value of the [`value`][struct@crate::LevelBar#value] property.
1753 ///
1754 /// # Returns
1755 ///
1756 /// a value in the interval between
1757 /// [`min-value`][struct@crate::LevelBar#min-value] and [`max-value`][struct@crate::LevelBar#max-value]
1758 #[doc(alias = "gtk_level_bar_get_value")]
1759 #[doc(alias = "get_value")]
1760 fn value(&self) -> f64 {
1761 unsafe { ffi::gtk_level_bar_get_value(self.as_ref().to_glib_none().0) }
1762 }
1763
1764 /// Removes an offset marker previously added with
1765 /// [`add_offset_value()`][Self::add_offset_value()].
1766 /// ## `name`
1767 /// the name of an offset in the bar
1768 #[doc(alias = "gtk_level_bar_remove_offset_value")]
1769 fn remove_offset_value(&self, name: Option<&str>) {
1770 unsafe {
1771 ffi::gtk_level_bar_remove_offset_value(
1772 self.as_ref().to_glib_none().0,
1773 name.to_glib_none().0,
1774 );
1775 }
1776 }
1777
1778 /// Sets the value of the [`inverted`][struct@crate::LevelBar#inverted] property.
1779 /// ## `inverted`
1780 /// [`true`] to invert the level bar
1781 #[doc(alias = "gtk_level_bar_set_inverted")]
1782 #[doc(alias = "inverted")]
1783 fn set_inverted(&self, inverted: bool) {
1784 unsafe {
1785 ffi::gtk_level_bar_set_inverted(self.as_ref().to_glib_none().0, inverted.into_glib());
1786 }
1787 }
1788
1789 /// Sets the value of the [`max-value`][struct@crate::LevelBar#max-value] property.
1790 ///
1791 /// You probably want to update preexisting level offsets after calling
1792 /// this function.
1793 /// ## `value`
1794 /// a positive value
1795 #[doc(alias = "gtk_level_bar_set_max_value")]
1796 #[doc(alias = "max-value")]
1797 fn set_max_value(&self, value: f64) {
1798 unsafe {
1799 ffi::gtk_level_bar_set_max_value(self.as_ref().to_glib_none().0, value);
1800 }
1801 }
1802
1803 /// Sets the value of the [`min-value`][struct@crate::LevelBar#min-value] property.
1804 ///
1805 /// You probably want to update preexisting level offsets after calling
1806 /// this function.
1807 /// ## `value`
1808 /// a positive value
1809 #[doc(alias = "gtk_level_bar_set_min_value")]
1810 #[doc(alias = "min-value")]
1811 fn set_min_value(&self, value: f64) {
1812 unsafe {
1813 ffi::gtk_level_bar_set_min_value(self.as_ref().to_glib_none().0, value);
1814 }
1815 }
1816
1817 /// Sets the value of the [`mode`][struct@crate::LevelBar#mode] property.
1818 /// ## `mode`
1819 /// a [`LevelBarMode`][crate::LevelBarMode]
1820 #[doc(alias = "gtk_level_bar_set_mode")]
1821 #[doc(alias = "mode")]
1822 fn set_mode(&self, mode: LevelBarMode) {
1823 unsafe {
1824 ffi::gtk_level_bar_set_mode(self.as_ref().to_glib_none().0, mode.into_glib());
1825 }
1826 }
1827
1828 /// Sets the value of the [`value`][struct@crate::LevelBar#value] property.
1829 /// ## `value`
1830 /// a value in the interval between
1831 /// [`min-value`][struct@crate::LevelBar#min-value] and [`max-value`][struct@crate::LevelBar#max-value]
1832 #[doc(alias = "gtk_level_bar_set_value")]
1833 #[doc(alias = "value")]
1834 fn set_value(&self, value: f64) {
1835 unsafe {
1836 ffi::gtk_level_bar_set_value(self.as_ref().to_glib_none().0, value);
1837 }
1838 }
1839
1840 /// Emitted when an offset specified on the bar changes value as an
1841 /// effect to [`add_offset_value()`][Self::add_offset_value()] being called.
1842 ///
1843 /// The signal supports detailed connections; you can connect to the
1844 /// detailed signal "changed::x" in order to only receive callbacks when
1845 /// the value of offset "x" changes.
1846 /// ## `name`
1847 /// the name of the offset that changed value
1848 #[doc(alias = "offset-changed")]
1849 fn connect_offset_changed<F: Fn(&Self, &str) + 'static>(
1850 &self,
1851 detail: Option<&str>,
1852 f: F,
1853 ) -> SignalHandlerId {
1854 unsafe extern "C" fn offset_changed_trampoline<
1855 P: IsA<LevelBar>,
1856 F: Fn(&P, &str) + 'static,
1857 >(
1858 this: *mut ffi::GtkLevelBar,
1859 name: *mut std::ffi::c_char,
1860 f: glib::ffi::gpointer,
1861 ) {
1862 unsafe {
1863 let f: &F = &*(f as *const F);
1864 f(
1865 LevelBar::from_glib_borrow(this).unsafe_cast_ref(),
1866 &glib::GString::from_glib_borrow(name),
1867 )
1868 }
1869 }
1870 unsafe {
1871 let f: Box_<F> = Box_::new(f);
1872 let detailed_signal_name = detail.map(|name| format!("offset-changed::{name}\0"));
1873 let signal_name = detailed_signal_name
1874 .as_ref()
1875 .map_or(c"offset-changed", |n| {
1876 std::ffi::CStr::from_bytes_with_nul_unchecked(n.as_bytes())
1877 });
1878 connect_raw(
1879 self.as_ptr() as *mut _,
1880 signal_name.as_ptr(),
1881 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1882 offset_changed_trampoline::<Self, F> as *const (),
1883 )),
1884 Box_::into_raw(f),
1885 )
1886 }
1887 }
1888
1889 #[doc(alias = "inverted")]
1890 fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1891 unsafe extern "C" fn notify_inverted_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
1892 this: *mut ffi::GtkLevelBar,
1893 _param_spec: glib::ffi::gpointer,
1894 f: glib::ffi::gpointer,
1895 ) {
1896 unsafe {
1897 let f: &F = &*(f as *const F);
1898 f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
1899 }
1900 }
1901 unsafe {
1902 let f: Box_<F> = Box_::new(f);
1903 connect_raw(
1904 self.as_ptr() as *mut _,
1905 c"notify::inverted".as_ptr(),
1906 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1907 notify_inverted_trampoline::<Self, F> as *const (),
1908 )),
1909 Box_::into_raw(f),
1910 )
1911 }
1912 }
1913
1914 #[doc(alias = "max-value")]
1915 fn connect_max_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1916 unsafe extern "C" fn notify_max_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
1917 this: *mut ffi::GtkLevelBar,
1918 _param_spec: glib::ffi::gpointer,
1919 f: glib::ffi::gpointer,
1920 ) {
1921 unsafe {
1922 let f: &F = &*(f as *const F);
1923 f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
1924 }
1925 }
1926 unsafe {
1927 let f: Box_<F> = Box_::new(f);
1928 connect_raw(
1929 self.as_ptr() as *mut _,
1930 c"notify::max-value".as_ptr(),
1931 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1932 notify_max_value_trampoline::<Self, F> as *const (),
1933 )),
1934 Box_::into_raw(f),
1935 )
1936 }
1937 }
1938
1939 #[doc(alias = "min-value")]
1940 fn connect_min_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1941 unsafe extern "C" fn notify_min_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
1942 this: *mut ffi::GtkLevelBar,
1943 _param_spec: glib::ffi::gpointer,
1944 f: glib::ffi::gpointer,
1945 ) {
1946 unsafe {
1947 let f: &F = &*(f as *const F);
1948 f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
1949 }
1950 }
1951 unsafe {
1952 let f: Box_<F> = Box_::new(f);
1953 connect_raw(
1954 self.as_ptr() as *mut _,
1955 c"notify::min-value".as_ptr(),
1956 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1957 notify_min_value_trampoline::<Self, F> as *const (),
1958 )),
1959 Box_::into_raw(f),
1960 )
1961 }
1962 }
1963
1964 #[doc(alias = "mode")]
1965 fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1966 unsafe extern "C" fn notify_mode_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
1967 this: *mut ffi::GtkLevelBar,
1968 _param_spec: glib::ffi::gpointer,
1969 f: glib::ffi::gpointer,
1970 ) {
1971 unsafe {
1972 let f: &F = &*(f as *const F);
1973 f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
1974 }
1975 }
1976 unsafe {
1977 let f: Box_<F> = Box_::new(f);
1978 connect_raw(
1979 self.as_ptr() as *mut _,
1980 c"notify::mode".as_ptr(),
1981 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1982 notify_mode_trampoline::<Self, F> as *const (),
1983 )),
1984 Box_::into_raw(f),
1985 )
1986 }
1987 }
1988
1989 #[doc(alias = "value")]
1990 fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1991 unsafe extern "C" fn notify_value_trampoline<P: IsA<LevelBar>, F: Fn(&P) + 'static>(
1992 this: *mut ffi::GtkLevelBar,
1993 _param_spec: glib::ffi::gpointer,
1994 f: glib::ffi::gpointer,
1995 ) {
1996 unsafe {
1997 let f: &F = &*(f as *const F);
1998 f(LevelBar::from_glib_borrow(this).unsafe_cast_ref())
1999 }
2000 }
2001 unsafe {
2002 let f: Box_<F> = Box_::new(f);
2003 connect_raw(
2004 self.as_ptr() as *mut _,
2005 c"notify::value".as_ptr(),
2006 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2007 notify_value_trampoline::<Self, F> as *const (),
2008 )),
2009 Box_::into_raw(f),
2010 )
2011 }
2012 }
2013}
2014
2015impl<O: IsA<LevelBar>> LevelBarExt for O {}