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