Skip to main content

gtk4/auto/
color_chooser_dialog.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#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9#[cfg(feature = "v4_20")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
11use crate::WindowGravity;
12use crate::{
13    AccessibleRole, Align, Application, Buildable, ColorChooser, ConstraintTarget, Dialog,
14    LayoutManager, Native, Overflow, Root, ShortcutManager, Widget, Window, ffi,
15};
16use glib::{
17    prelude::*,
18    signal::{SignalHandlerId, connect_raw},
19    translate::*,
20};
21use std::boxed::Box as Box_;
22
23#[cfg(feature = "v4_10")]
24#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
25glib::wrapper! {
26    /// Use [`ColorDialog`][crate::ColorDialog] instead
27    ///
28    ///
29    /// [`ColorChooserDialog`][crate::ColorChooserDialog] implements the [`ColorChooser`][crate::ColorChooser] interface
30    /// and does not provide much API of its own.
31    ///
32    /// To create a [`ColorChooserDialog`][crate::ColorChooserDialog], use [`new()`][Self::new()].
33    ///
34    /// To change the initially selected color, use
35    /// [`ColorChooserExt::set_rgba()`][crate::prelude::ColorChooserExt::set_rgba()]. To get the selected color use
36    /// [`ColorChooserExt::rgba()`][crate::prelude::ColorChooserExt::rgba()].
37    ///
38    /// [`ColorChooserDialog`][crate::ColorChooserDialog] has been deprecated in favor of [`ColorDialog`][crate::ColorDialog].
39    ///
40    /// ## CSS nodes
41    ///
42    /// [`ColorChooserDialog`][crate::ColorChooserDialog] has a single CSS node with the name `window` and style
43    /// class `.colorchooser`.
44    ///
45    /// ## Properties
46    ///
47    ///
48    /// #### `show-editor`
49    ///  Whether the color chooser dialog is showing the single-color editor.
50    ///
51    /// It can be set to switch the color chooser into single-color editing mode.
52    ///
53    /// Readable | Writable
54    /// <details><summary><h4>Dialog</h4></summary>
55    ///
56    ///
57    /// #### `use-header-bar`
58    ///  header, NULL);
59    /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
60    /// ```text
61    ///
62    ///
63    /// Readable | Writable | Construct Only
64    /// </details>
65    /// <details><summary><h4>Window</h4></summary>
66    ///
67    ///
68    /// #### `application`
69    ///  The [`Application`][crate::Application] associated with the window.
70    ///
71    /// The application will be kept alive for at least as long as it
72    /// has any windows associated with it (see g_application_hold()
73    /// for a way to keep it alive without windows).
74    ///
75    /// Normally, the connection between the application and the window
76    /// will remain until the window is destroyed, but you can explicitly
77    /// remove it by setting the this property to `NULL`.
78    ///
79    /// Readable | Writable
80    ///
81    ///
82    /// #### `child`
83    ///  The child widget.
84    ///
85    /// Readable | Writable
86    ///
87    ///
88    /// #### `decorated`
89    ///  Whether the window should have a frame (also known as *decorations*).
90    ///
91    /// Readable | Writable
92    ///
93    ///
94    /// #### `default-height`
95    ///  The default height of the window.
96    ///
97    /// Readable | Writable
98    ///
99    ///
100    /// #### `default-widget`
101    ///  The default widget.
102    ///
103    /// Readable | Writable
104    ///
105    ///
106    /// #### `default-width`
107    ///  The default width of the window.
108    ///
109    /// Readable | Writable
110    ///
111    ///
112    /// #### `deletable`
113    ///  Whether the window frame should have a close button.
114    ///
115    /// Readable | Writable
116    ///
117    ///
118    /// #### `destroy-with-parent`
119    ///  If this window should be destroyed when the parent is destroyed.
120    ///
121    /// Readable | Writable
122    ///
123    ///
124    /// #### `display`
125    ///  The display that will display this window.
126    ///
127    /// Readable | Writable
128    ///
129    ///
130    /// #### `focus-visible`
131    ///  Whether 'focus rectangles' are currently visible in this window.
132    ///
133    /// This property is maintained by GTK based on user input
134    /// and should not be set by applications.
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `focus-widget`
140    ///  The focus widget.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `fullscreened`
146    ///  Whether the window is fullscreen.
147    ///
148    /// Setting this property is the equivalent of calling
149    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
150    /// either operation is asynchronous, which means you will need to
151    /// connect to the ::notify signal in order to know whether the
152    /// operation was successful.
153    ///
154    /// Readable | Writable
155    ///
156    ///
157    /// #### `gravity`
158    ///  The gravity to use when resizing the window programmatically.
159    ///
160    /// Gravity describes which point of the window we want to keep
161    /// fixed (meaning that the window will grow in the opposite direction).
162    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
163    /// want the to fix top right corner of the window.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `handle-menubar-accel`
169    ///   for activating
170    /// menubars.
171    ///
172    /// Readable | Writable
173    ///
174    ///
175    /// #### `hide-on-close`
176    ///  If this window should be hidden instead of destroyed when the user clicks
177    /// the close button.
178    ///
179    /// Readable | Writable
180    ///
181    ///
182    /// #### `icon-name`
183    ///  Specifies the name of the themed icon to use as the window icon.
184    ///
185    /// See [`IconTheme`][crate::IconTheme] for more details.
186    ///
187    /// Readable | Writable
188    ///
189    ///
190    /// #### `is-active`
191    ///  Whether the toplevel is the currently active window.
192    ///
193    /// Readable
194    ///
195    ///
196    /// #### `maximized`
197    ///  Whether the window is maximized.
198    ///
199    /// Setting this property is the equivalent of calling
200    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
201    /// either operation is asynchronous, which means you will need to
202    /// connect to the ::notify signal in order to know whether the
203    /// operation was successful.
204    ///
205    /// Readable | Writable
206    ///
207    ///
208    /// #### `mnemonics-visible`
209    ///  Whether mnemonics are currently visible in this window.
210    ///
211    /// This property is maintained by GTK based on user input,
212    /// and should not be set by applications.
213    ///
214    /// Readable | Writable
215    ///
216    ///
217    /// #### `modal`
218    ///  If true, the window is modal.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `resizable`
224    ///  If true, users can resize the window.
225    ///
226    /// Readable | Writable
227    ///
228    ///
229    /// #### `startup-id`
230    ///  A write-only property for setting window's startup notification identifier.
231    ///
232    /// Writable
233    ///
234    ///
235    /// #### `suspended`
236    ///  Whether the window is suspended.
237    ///
238    /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
239    ///
240    /// Readable
241    ///
242    ///
243    /// #### `title`
244    ///  The title of the window.
245    ///
246    /// Readable | Writable
247    ///
248    ///
249    /// #### `titlebar`
250    ///  The titlebar widget.
251    ///
252    /// Readable | Writable
253    ///
254    ///
255    /// #### `transient-for`
256    ///  The transient parent of the window.
257    ///
258    /// Readable | Writable | Construct
259    /// </details>
260    /// <details><summary><h4>Widget</h4></summary>
261    ///
262    ///
263    /// #### `can-focus`
264    ///  Whether the widget or any of its descendents can accept
265    /// the input focus.
266    ///
267    /// This property is meant to be set by widget implementations,
268    /// typically in their instance init function.
269    ///
270    /// Readable | Writable
271    ///
272    ///
273    /// #### `can-target`
274    ///  Whether the widget can receive pointer events.
275    ///
276    /// Readable | Writable
277    ///
278    ///
279    /// #### `css-classes`
280    ///  A list of css classes applied to this widget.
281    ///
282    /// Readable | Writable
283    ///
284    ///
285    /// #### `css-name`
286    ///  The name of this widget in the CSS tree.
287    ///
288    /// This property is meant to be set by widget implementations,
289    /// typically in their instance init function.
290    ///
291    /// Readable | Writable | Construct Only
292    ///
293    ///
294    /// #### `cursor`
295    ///  The cursor used by @widget.
296    ///
297    /// Readable | Writable
298    ///
299    ///
300    /// #### `focus-on-click`
301    ///  Whether the widget should grab focus when it is clicked with the mouse.
302    ///
303    /// This property is only relevant for widgets that can take focus.
304    ///
305    /// Readable | Writable
306    ///
307    ///
308    /// #### `focusable`
309    ///  Whether this widget itself will accept the input focus.
310    ///
311    /// Readable | Writable
312    ///
313    ///
314    /// #### `halign`
315    ///  How to distribute horizontal space if widget gets extra space.
316    ///
317    /// Readable | Writable
318    ///
319    ///
320    /// #### `has-default`
321    ///  Whether the widget is the default widget.
322    ///
323    /// Readable
324    ///
325    ///
326    /// #### `has-focus`
327    ///  Whether the widget has the input focus.
328    ///
329    /// Readable
330    ///
331    ///
332    /// #### `has-tooltip`
333    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
334    /// signal on @widget.
335    ///
336    /// A true value indicates that @widget can have a tooltip, in this case
337    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
338    /// determine whether it will provide a tooltip or not.
339    ///
340    /// Readable | Writable
341    ///
342    ///
343    /// #### `height-request`
344    ///  Overrides for height request of the widget.
345    ///
346    /// If this is -1, the natural request will be used.
347    ///
348    /// Readable | Writable
349    ///
350    ///
351    /// #### `hexpand`
352    ///  Whether to expand horizontally.
353    ///
354    /// Readable | Writable
355    ///
356    ///
357    /// #### `hexpand-set`
358    ///  Whether to use the `hexpand` property.
359    ///
360    /// Readable | Writable
361    ///
362    ///
363    /// #### `layout-manager`
364    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
365    /// the preferred size of the widget, and allocate its children.
366    ///
367    /// This property is meant to be set by widget implementations,
368    /// typically in their instance init function.
369    ///
370    /// Readable | Writable
371    ///
372    ///
373    /// #### `limit-events`
374    ///  Makes this widget act like a modal dialog, with respect to
375    /// event delivery.
376    ///
377    /// Global event controllers will not handle events with targets
378    /// inside the widget, unless they are set up to ignore propagation
379    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
380    ///
381    /// Readable | Writable
382    ///
383    ///
384    /// #### `margin-bottom`
385    ///  Margin on bottom side of widget.
386    ///
387    /// This property adds margin outside of the widget's normal size
388    /// request, the margin will be added in addition to the size from
389    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
390    ///
391    /// Readable | Writable
392    ///
393    ///
394    /// #### `margin-end`
395    ///  Margin on end of widget, horizontally.
396    ///
397    /// This property supports left-to-right and right-to-left text
398    /// directions.
399    ///
400    /// This property adds margin outside of the widget's normal size
401    /// request, the margin will be added in addition to the size from
402    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
403    ///
404    /// Readable | Writable
405    ///
406    ///
407    /// #### `margin-start`
408    ///  Margin on start of widget, horizontally.
409    ///
410    /// This property supports left-to-right and right-to-left text
411    /// directions.
412    ///
413    /// This property adds margin outside of the widget's normal size
414    /// request, the margin will be added in addition to the size from
415    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
416    ///
417    /// Readable | Writable
418    ///
419    ///
420    /// #### `margin-top`
421    ///  Margin on top side of widget.
422    ///
423    /// This property adds margin outside of the widget's normal size
424    /// request, the margin will be added in addition to the size from
425    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
426    ///
427    /// Readable | Writable
428    ///
429    ///
430    /// #### `name`
431    ///  The name of the widget.
432    ///
433    /// Readable | Writable
434    ///
435    ///
436    /// #### `opacity`
437    ///  The requested opacity of the widget.
438    ///
439    /// Readable | Writable
440    ///
441    ///
442    /// #### `overflow`
443    ///  How content outside the widget's content area is treated.
444    ///
445    /// This property is meant to be set by widget implementations,
446    /// typically in their instance init function.
447    ///
448    /// Readable | Writable
449    ///
450    ///
451    /// #### `parent`
452    ///  The parent widget of this widget.
453    ///
454    /// Readable
455    ///
456    ///
457    /// #### `receives-default`
458    ///  Whether the widget will receive the default action when it is focused.
459    ///
460    /// Readable | Writable
461    ///
462    ///
463    /// #### `root`
464    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
465    ///
466    /// This will be `NULL` if the widget is not contained in a root widget.
467    ///
468    /// Readable
469    ///
470    ///
471    /// #### `scale-factor`
472    ///  The scale factor of the widget.
473    ///
474    /// Readable
475    ///
476    ///
477    /// #### `sensitive`
478    ///  Whether the widget responds to input.
479    ///
480    /// Readable | Writable
481    ///
482    ///
483    /// #### `tooltip-markup`
484    ///  Sets the text of tooltip to be the given string, which is marked up
485    /// with Pango markup.
486    ///
487    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
488    ///
489    /// This is a convenience property which will take care of getting the
490    /// tooltip shown if the given string is not `NULL`:
491    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
492    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
493    /// the default signal handler.
494    ///
495    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
496    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
497    ///
498    /// Readable | Writable
499    ///
500    ///
501    /// #### `tooltip-text`
502    ///  Sets the text of tooltip to be the given string.
503    ///
504    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
505    ///
506    /// This is a convenience property which will take care of getting the
507    /// tooltip shown if the given string is not `NULL`:
508    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
509    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
510    /// the default signal handler.
511    ///
512    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
513    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
514    ///
515    /// Readable | Writable
516    ///
517    ///
518    /// #### `valign`
519    ///  How to distribute vertical space if widget gets extra space.
520    ///
521    /// Readable | Writable
522    ///
523    ///
524    /// #### `vexpand`
525    ///  Whether to expand vertically.
526    ///
527    /// Readable | Writable
528    ///
529    ///
530    /// #### `vexpand-set`
531    ///  Whether to use the `vexpand` property.
532    ///
533    /// Readable | Writable
534    ///
535    ///
536    /// #### `visible`
537    ///  Whether the widget is visible.
538    ///
539    /// Readable | Writable
540    ///
541    ///
542    /// #### `width-request`
543    ///  Overrides for width request of the widget.
544    ///
545    /// If this is -1, the natural request will be used.
546    ///
547    /// Readable | Writable
548    /// </details>
549    /// <details><summary><h4>Accessible</h4></summary>
550    ///
551    ///
552    /// #### `accessible-role`
553    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
554    ///
555    /// The accessible role cannot be changed once set.
556    ///
557    /// Readable | Writable
558    /// </details>
559    /// <details><summary><h4>ColorChooser</h4></summary>
560    ///
561    ///
562    /// #### `rgba`
563    ///  The currently selected color, as a [`gdk::RGBA`][crate::gdk::RGBA] struct.
564    ///
565    /// The property can be set to change the current selection
566    /// programmatically.
567    ///
568    /// Readable | Writable
569    ///
570    ///
571    /// #### `use-alpha`
572    ///  Whether colors may have alpha (translucency).
573    ///
574    /// When ::use-alpha is [`false`], the [`gdk::RGBA`][crate::gdk::RGBA] struct obtained
575    /// via the [`rgba`][struct@crate::ColorChooser#rgba] property will be
576    /// forced to have alpha == 1.
577    ///
578    /// Implementations are expected to show alpha by rendering the color
579    /// over a non-uniform background (like a checkerboard pattern).
580    ///
581    /// Readable | Writable
582    /// </details>
583    ///
584    /// # Implements
585    ///
586    /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`ColorChooserExt`][trait@crate::prelude::ColorChooserExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`ColorChooserExtManual`][trait@crate::prelude::ColorChooserExtManual]
587    #[doc(alias = "GtkColorChooserDialog")]
588    pub struct ColorChooserDialog(Object<ffi::GtkColorChooserDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, ColorChooser;
589
590    match fn {
591        type_ => || ffi::gtk_color_chooser_dialog_get_type(),
592    }
593}
594
595#[cfg(not(feature = "v4_10"))]
596glib::wrapper! {
597    #[doc(alias = "GtkColorChooserDialog")]
598    pub struct ColorChooserDialog(Object<ffi::GtkColorChooserDialog>) @extends Dialog, Window, Widget, @implements Buildable, ConstraintTarget, Native, Root, ShortcutManager, ColorChooser;
599
600    match fn {
601        type_ => || ffi::gtk_color_chooser_dialog_get_type(),
602    }
603}
604
605impl ColorChooserDialog {
606    /// Creates a new [`ColorChooserDialog`][crate::ColorChooserDialog].
607    ///
608    /// # Deprecated since 4.10
609    ///
610    /// Use [`ColorDialog`][crate::ColorDialog] instead
611    /// ## `title`
612    /// Title of the dialog
613    /// ## `parent`
614    /// Transient parent of the dialog
615    ///
616    /// # Returns
617    ///
618    /// a new [`ColorChooserDialog`][crate::ColorChooserDialog]
619    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
620    #[allow(deprecated)]
621    #[doc(alias = "gtk_color_chooser_dialog_new")]
622    pub fn new(title: Option<&str>, parent: Option<&impl IsA<Window>>) -> ColorChooserDialog {
623        assert_initialized_main_thread!();
624        unsafe {
625            Widget::from_glib_none(ffi::gtk_color_chooser_dialog_new(
626                title.to_glib_none().0,
627                parent.map(|p| p.as_ref()).to_glib_none().0,
628            ))
629            .unsafe_cast()
630        }
631    }
632
633    // rustdoc-stripper-ignore-next
634    /// Creates a new builder-pattern struct instance to construct [`ColorChooserDialog`] objects.
635    ///
636    /// This method returns an instance of [`ColorChooserDialogBuilder`](crate::builders::ColorChooserDialogBuilder) which can be used to create [`ColorChooserDialog`] objects.
637    pub fn builder() -> ColorChooserDialogBuilder {
638        ColorChooserDialogBuilder::new()
639    }
640
641    /// Whether the color chooser dialog is showing the single-color editor.
642    ///
643    /// It can be set to switch the color chooser into single-color editing mode.
644    #[doc(alias = "show-editor")]
645    pub fn shows_editor(&self) -> bool {
646        ObjectExt::property(self, "show-editor")
647    }
648
649    /// Whether the color chooser dialog is showing the single-color editor.
650    ///
651    /// It can be set to switch the color chooser into single-color editing mode.
652    #[doc(alias = "show-editor")]
653    pub fn set_show_editor(&self, show_editor: bool) {
654        ObjectExt::set_property(self, "show-editor", show_editor)
655    }
656
657    #[doc(alias = "show-editor")]
658    pub fn connect_show_editor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
659        unsafe extern "C" fn notify_show_editor_trampoline<F: Fn(&ColorChooserDialog) + 'static>(
660            this: *mut ffi::GtkColorChooserDialog,
661            _param_spec: glib::ffi::gpointer,
662            f: glib::ffi::gpointer,
663        ) {
664            unsafe {
665                let f: &F = &*(f as *const F);
666                f(&from_glib_borrow(this))
667            }
668        }
669        unsafe {
670            let f: Box_<F> = Box_::new(f);
671            connect_raw(
672                self.as_ptr() as *mut _,
673                c"notify::show-editor".as_ptr(),
674                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
675                    notify_show_editor_trampoline::<F> as *const (),
676                )),
677                Box_::into_raw(f),
678            )
679        }
680    }
681}
682
683impl Default for ColorChooserDialog {
684    fn default() -> Self {
685        glib::object::Object::new::<Self>()
686    }
687}
688
689// rustdoc-stripper-ignore-next
690/// A [builder-pattern] type to construct [`ColorChooserDialog`] objects.
691///
692/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
693#[must_use = "The builder must be built to be used"]
694pub struct ColorChooserDialogBuilder {
695    builder: glib::object::ObjectBuilder<'static, ColorChooserDialog>,
696}
697
698impl ColorChooserDialogBuilder {
699    fn new() -> Self {
700        Self {
701            builder: glib::object::Object::builder(),
702        }
703    }
704
705    /// Whether the color chooser dialog is showing the single-color editor.
706    ///
707    /// It can be set to switch the color chooser into single-color editing mode.
708    pub fn show_editor(self, show_editor: bool) -> Self {
709        Self {
710            builder: self.builder.property("show-editor", show_editor),
711        }
712    }
713
714    /// header, NULL);
715    /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
716    /// ```text
717    ///
718    /// Use [`Window`][crate::Window] instead
719    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
720    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
721        Self {
722            builder: self.builder.property("use-header-bar", use_header_bar),
723        }
724    }
725
726    /// The [`Application`][crate::Application] associated with the window.
727    ///
728    /// The application will be kept alive for at least as long as it
729    /// has any windows associated with it (see g_application_hold()
730    /// for a way to keep it alive without windows).
731    ///
732    /// Normally, the connection between the application and the window
733    /// will remain until the window is destroyed, but you can explicitly
734    /// remove it by setting the this property to `NULL`.
735    pub fn application(self, application: &impl IsA<Application>) -> Self {
736        Self {
737            builder: self
738                .builder
739                .property("application", application.clone().upcast()),
740        }
741    }
742
743    /// The child widget.
744    pub fn child(self, child: &impl IsA<Widget>) -> Self {
745        Self {
746            builder: self.builder.property("child", child.clone().upcast()),
747        }
748    }
749
750    /// Whether the window should have a frame (also known as *decorations*).
751    pub fn decorated(self, decorated: bool) -> Self {
752        Self {
753            builder: self.builder.property("decorated", decorated),
754        }
755    }
756
757    /// The default height of the window.
758    pub fn default_height(self, default_height: i32) -> Self {
759        Self {
760            builder: self.builder.property("default-height", default_height),
761        }
762    }
763
764    /// The default widget.
765    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
766        Self {
767            builder: self
768                .builder
769                .property("default-widget", default_widget.clone().upcast()),
770        }
771    }
772
773    /// The default width of the window.
774    pub fn default_width(self, default_width: i32) -> Self {
775        Self {
776            builder: self.builder.property("default-width", default_width),
777        }
778    }
779
780    /// Whether the window frame should have a close button.
781    pub fn deletable(self, deletable: bool) -> Self {
782        Self {
783            builder: self.builder.property("deletable", deletable),
784        }
785    }
786
787    /// If this window should be destroyed when the parent is destroyed.
788    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
789        Self {
790            builder: self
791                .builder
792                .property("destroy-with-parent", destroy_with_parent),
793        }
794    }
795
796    /// The display that will display this window.
797    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
798        Self {
799            builder: self.builder.property("display", display.clone().upcast()),
800        }
801    }
802
803    /// Whether 'focus rectangles' are currently visible in this window.
804    ///
805    /// This property is maintained by GTK based on user input
806    /// and should not be set by applications.
807    pub fn focus_visible(self, focus_visible: bool) -> Self {
808        Self {
809            builder: self.builder.property("focus-visible", focus_visible),
810        }
811    }
812
813    /// The focus widget.
814    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
815        Self {
816            builder: self
817                .builder
818                .property("focus-widget", focus_widget.clone().upcast()),
819        }
820    }
821
822    /// Whether the window is fullscreen.
823    ///
824    /// Setting this property is the equivalent of calling
825    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
826    /// either operation is asynchronous, which means you will need to
827    /// connect to the ::notify signal in order to know whether the
828    /// operation was successful.
829    pub fn fullscreened(self, fullscreened: bool) -> Self {
830        Self {
831            builder: self.builder.property("fullscreened", fullscreened),
832        }
833    }
834
835    /// The gravity to use when resizing the window programmatically.
836    ///
837    /// Gravity describes which point of the window we want to keep
838    /// fixed (meaning that the window will grow in the opposite direction).
839    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
840    /// want the to fix top right corner of the window.
841    #[cfg(feature = "v4_20")]
842    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
843    pub fn gravity(self, gravity: WindowGravity) -> Self {
844        Self {
845            builder: self.builder.property("gravity", gravity),
846        }
847    }
848
849    ///  for activating
850    /// menubars.
851    #[cfg(feature = "v4_2")]
852    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
853    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
854        Self {
855            builder: self
856                .builder
857                .property("handle-menubar-accel", handle_menubar_accel),
858        }
859    }
860
861    /// If this window should be hidden instead of destroyed when the user clicks
862    /// the close button.
863    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
864        Self {
865            builder: self.builder.property("hide-on-close", hide_on_close),
866        }
867    }
868
869    /// Specifies the name of the themed icon to use as the window icon.
870    ///
871    /// See [`IconTheme`][crate::IconTheme] for more details.
872    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
873        Self {
874            builder: self.builder.property("icon-name", icon_name.into()),
875        }
876    }
877
878    /// Whether the window is maximized.
879    ///
880    /// Setting this property is the equivalent of calling
881    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
882    /// either operation is asynchronous, which means you will need to
883    /// connect to the ::notify signal in order to know whether the
884    /// operation was successful.
885    pub fn maximized(self, maximized: bool) -> Self {
886        Self {
887            builder: self.builder.property("maximized", maximized),
888        }
889    }
890
891    /// Whether mnemonics are currently visible in this window.
892    ///
893    /// This property is maintained by GTK based on user input,
894    /// and should not be set by applications.
895    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
896        Self {
897            builder: self
898                .builder
899                .property("mnemonics-visible", mnemonics_visible),
900        }
901    }
902
903    /// If true, the window is modal.
904    pub fn modal(self, modal: bool) -> Self {
905        Self {
906            builder: self.builder.property("modal", modal),
907        }
908    }
909
910    /// If true, users can resize the window.
911    pub fn resizable(self, resizable: bool) -> Self {
912        Self {
913            builder: self.builder.property("resizable", resizable),
914        }
915    }
916
917    /// A write-only property for setting window's startup notification identifier.
918    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
919        Self {
920            builder: self.builder.property("startup-id", startup_id.into()),
921        }
922    }
923
924    /// The title of the window.
925    pub fn title(self, title: impl Into<glib::GString>) -> Self {
926        Self {
927            builder: self.builder.property("title", title.into()),
928        }
929    }
930
931    /// The titlebar widget.
932    #[cfg(feature = "v4_6")]
933    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
934    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
935        Self {
936            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
937        }
938    }
939
940    /// The transient parent of the window.
941    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
942        Self {
943            builder: self
944                .builder
945                .property("transient-for", transient_for.clone().upcast()),
946        }
947    }
948
949    /// Whether the widget or any of its descendents can accept
950    /// the input focus.
951    ///
952    /// This property is meant to be set by widget implementations,
953    /// typically in their instance init function.
954    pub fn can_focus(self, can_focus: bool) -> Self {
955        Self {
956            builder: self.builder.property("can-focus", can_focus),
957        }
958    }
959
960    /// Whether the widget can receive pointer events.
961    pub fn can_target(self, can_target: bool) -> Self {
962        Self {
963            builder: self.builder.property("can-target", can_target),
964        }
965    }
966
967    /// A list of css classes applied to this widget.
968    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
969        Self {
970            builder: self.builder.property("css-classes", css_classes.into()),
971        }
972    }
973
974    /// The name of this widget in the CSS tree.
975    ///
976    /// This property is meant to be set by widget implementations,
977    /// typically in their instance init function.
978    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
979        Self {
980            builder: self.builder.property("css-name", css_name.into()),
981        }
982    }
983
984    /// The cursor used by @widget.
985    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
986        Self {
987            builder: self.builder.property("cursor", cursor.clone()),
988        }
989    }
990
991    /// Whether the widget should grab focus when it is clicked with the mouse.
992    ///
993    /// This property is only relevant for widgets that can take focus.
994    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
995        Self {
996            builder: self.builder.property("focus-on-click", focus_on_click),
997        }
998    }
999
1000    /// Whether this widget itself will accept the input focus.
1001    pub fn focusable(self, focusable: bool) -> Self {
1002        Self {
1003            builder: self.builder.property("focusable", focusable),
1004        }
1005    }
1006
1007    /// How to distribute horizontal space if widget gets extra space.
1008    pub fn halign(self, halign: Align) -> Self {
1009        Self {
1010            builder: self.builder.property("halign", halign),
1011        }
1012    }
1013
1014    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1015    /// signal on @widget.
1016    ///
1017    /// A true value indicates that @widget can have a tooltip, in this case
1018    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1019    /// determine whether it will provide a tooltip or not.
1020    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1021        Self {
1022            builder: self.builder.property("has-tooltip", has_tooltip),
1023        }
1024    }
1025
1026    /// Overrides for height request of the widget.
1027    ///
1028    /// If this is -1, the natural request will be used.
1029    pub fn height_request(self, height_request: i32) -> Self {
1030        Self {
1031            builder: self.builder.property("height-request", height_request),
1032        }
1033    }
1034
1035    /// Whether to expand horizontally.
1036    pub fn hexpand(self, hexpand: bool) -> Self {
1037        Self {
1038            builder: self.builder.property("hexpand", hexpand),
1039        }
1040    }
1041
1042    /// Whether to use the `hexpand` property.
1043    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1044        Self {
1045            builder: self.builder.property("hexpand-set", hexpand_set),
1046        }
1047    }
1048
1049    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1050    /// the preferred size of the widget, and allocate its children.
1051    ///
1052    /// This property is meant to be set by widget implementations,
1053    /// typically in their instance init function.
1054    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1055        Self {
1056            builder: self
1057                .builder
1058                .property("layout-manager", layout_manager.clone().upcast()),
1059        }
1060    }
1061
1062    /// Makes this widget act like a modal dialog, with respect to
1063    /// event delivery.
1064    ///
1065    /// Global event controllers will not handle events with targets
1066    /// inside the widget, unless they are set up to ignore propagation
1067    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1068    #[cfg(feature = "v4_18")]
1069    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1070    pub fn limit_events(self, limit_events: bool) -> Self {
1071        Self {
1072            builder: self.builder.property("limit-events", limit_events),
1073        }
1074    }
1075
1076    /// Margin on bottom side of widget.
1077    ///
1078    /// This property adds margin outside of the widget's normal size
1079    /// request, the margin will be added in addition to the size from
1080    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1081    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1082        Self {
1083            builder: self.builder.property("margin-bottom", margin_bottom),
1084        }
1085    }
1086
1087    /// Margin on end of widget, horizontally.
1088    ///
1089    /// This property supports left-to-right and right-to-left text
1090    /// directions.
1091    ///
1092    /// This property adds margin outside of the widget's normal size
1093    /// request, the margin will be added in addition to the size from
1094    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1095    pub fn margin_end(self, margin_end: i32) -> Self {
1096        Self {
1097            builder: self.builder.property("margin-end", margin_end),
1098        }
1099    }
1100
1101    /// Margin on start of widget, horizontally.
1102    ///
1103    /// This property supports left-to-right and right-to-left text
1104    /// directions.
1105    ///
1106    /// This property adds margin outside of the widget's normal size
1107    /// request, the margin will be added in addition to the size from
1108    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1109    pub fn margin_start(self, margin_start: i32) -> Self {
1110        Self {
1111            builder: self.builder.property("margin-start", margin_start),
1112        }
1113    }
1114
1115    /// Margin on top side of widget.
1116    ///
1117    /// This property adds margin outside of the widget's normal size
1118    /// request, the margin will be added in addition to the size from
1119    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1120    pub fn margin_top(self, margin_top: i32) -> Self {
1121        Self {
1122            builder: self.builder.property("margin-top", margin_top),
1123        }
1124    }
1125
1126    /// The name of the widget.
1127    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1128        Self {
1129            builder: self.builder.property("name", name.into()),
1130        }
1131    }
1132
1133    /// The requested opacity of the widget.
1134    pub fn opacity(self, opacity: f64) -> Self {
1135        Self {
1136            builder: self.builder.property("opacity", opacity),
1137        }
1138    }
1139
1140    /// How content outside the widget's content area is treated.
1141    ///
1142    /// This property is meant to be set by widget implementations,
1143    /// typically in their instance init function.
1144    pub fn overflow(self, overflow: Overflow) -> Self {
1145        Self {
1146            builder: self.builder.property("overflow", overflow),
1147        }
1148    }
1149
1150    /// Whether the widget will receive the default action when it is focused.
1151    pub fn receives_default(self, receives_default: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("receives-default", receives_default),
1154        }
1155    }
1156
1157    /// Whether the widget responds to input.
1158    pub fn sensitive(self, sensitive: bool) -> Self {
1159        Self {
1160            builder: self.builder.property("sensitive", sensitive),
1161        }
1162    }
1163
1164    /// Sets the text of tooltip to be the given string, which is marked up
1165    /// with Pango markup.
1166    ///
1167    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1168    ///
1169    /// This is a convenience property which will take care of getting the
1170    /// tooltip shown if the given string is not `NULL`:
1171    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1172    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1173    /// the default signal handler.
1174    ///
1175    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1176    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1177    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1178        Self {
1179            builder: self
1180                .builder
1181                .property("tooltip-markup", tooltip_markup.into()),
1182        }
1183    }
1184
1185    /// Sets the text of tooltip to be the given string.
1186    ///
1187    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1188    ///
1189    /// This is a convenience property which will take care of getting the
1190    /// tooltip shown if the given string is not `NULL`:
1191    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1192    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1193    /// the default signal handler.
1194    ///
1195    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1196    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1197    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1198        Self {
1199            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1200        }
1201    }
1202
1203    /// How to distribute vertical space if widget gets extra space.
1204    pub fn valign(self, valign: Align) -> Self {
1205        Self {
1206            builder: self.builder.property("valign", valign),
1207        }
1208    }
1209
1210    /// Whether to expand vertically.
1211    pub fn vexpand(self, vexpand: bool) -> Self {
1212        Self {
1213            builder: self.builder.property("vexpand", vexpand),
1214        }
1215    }
1216
1217    /// Whether to use the `vexpand` property.
1218    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1219        Self {
1220            builder: self.builder.property("vexpand-set", vexpand_set),
1221        }
1222    }
1223
1224    /// Whether the widget is visible.
1225    pub fn visible(self, visible: bool) -> Self {
1226        Self {
1227            builder: self.builder.property("visible", visible),
1228        }
1229    }
1230
1231    /// Overrides for width request of the widget.
1232    ///
1233    /// If this is -1, the natural request will be used.
1234    pub fn width_request(self, width_request: i32) -> Self {
1235        Self {
1236            builder: self.builder.property("width-request", width_request),
1237        }
1238    }
1239
1240    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1241    ///
1242    /// The accessible role cannot be changed once set.
1243    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1244        Self {
1245            builder: self.builder.property("accessible-role", accessible_role),
1246        }
1247    }
1248
1249    /// The currently selected color, as a [`gdk::RGBA`][crate::gdk::RGBA] struct.
1250    ///
1251    /// The property can be set to change the current selection
1252    /// programmatically.
1253    /// Use [`ColorDialog`][crate::ColorDialog] and [`ColorDialogButton`][crate::ColorDialogButton]
1254    ///   instead of widgets implementing [`ColorChooser`][crate::ColorChooser]
1255    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1256    pub fn rgba(self, rgba: &gdk::RGBA) -> Self {
1257        Self {
1258            builder: self.builder.property("rgba", rgba),
1259        }
1260    }
1261
1262    /// Whether colors may have alpha (translucency).
1263    ///
1264    /// When ::use-alpha is [`false`], the [`gdk::RGBA`][crate::gdk::RGBA] struct obtained
1265    /// via the [`rgba`][struct@crate::ColorChooser#rgba] property will be
1266    /// forced to have alpha == 1.
1267    ///
1268    /// Implementations are expected to show alpha by rendering the color
1269    /// over a non-uniform background (like a checkerboard pattern).
1270    /// Use [`ColorDialog`][crate::ColorDialog] and [`ColorDialogButton`][crate::ColorDialogButton]
1271    ///   instead of widgets implementing [`ColorChooser`][crate::ColorChooser]
1272    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1273    pub fn use_alpha(self, use_alpha: bool) -> Self {
1274        Self {
1275            builder: self.builder.property("use-alpha", use_alpha),
1276        }
1277    }
1278
1279    // rustdoc-stripper-ignore-next
1280    /// Build the [`ColorChooserDialog`].
1281    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1282    pub fn build(self) -> ColorChooserDialog {
1283        assert_initialized_main_thread!();
1284        self.builder.build()
1285    }
1286}