Skip to main content

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