libhelium/auto/
date_picker.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "HeDatePicker")]
16    pub struct DatePicker(Object<ffi::HeDatePicker, ffi::HeDatePickerClass>) @extends gtk::Entry, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::CellEditable, gtk::Editable;
17
18    match fn {
19        type_ => || ffi::he_date_picker_get_type(),
20    }
21}
22
23impl DatePicker {
24    pub const NONE: Option<&'static DatePicker> = None;
25
26    #[doc(alias = "he_date_picker_new_with_format")]
27    pub fn with_format(format: &str) -> DatePicker {
28        assert_initialized_main_thread!();
29        unsafe { from_glib_none(ffi::he_date_picker_new_with_format(format.to_glib_none().0)) }
30    }
31
32    #[doc(alias = "he_date_picker_new")]
33    pub fn new() -> DatePicker {
34        assert_initialized_main_thread!();
35        unsafe { from_glib_none(ffi::he_date_picker_new()) }
36    }
37
38    // rustdoc-stripper-ignore-next
39    /// Creates a new builder-pattern struct instance to construct [`DatePicker`] objects.
40    ///
41    /// This method returns an instance of [`DatePickerBuilder`](crate::builders::DatePickerBuilder) which can be used to create [`DatePicker`] objects.
42    pub fn builder() -> DatePickerBuilder {
43        DatePickerBuilder::new()
44    }
45}
46
47impl Default for DatePicker {
48    fn default() -> Self {
49        Self::new()
50    }
51}
52
53// rustdoc-stripper-ignore-next
54/// A [builder-pattern] type to construct [`DatePicker`] objects.
55///
56/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
57#[must_use = "The builder must be built to be used"]
58pub struct DatePickerBuilder {
59    builder: glib::object::ObjectBuilder<'static, DatePicker>,
60}
61
62impl DatePickerBuilder {
63    fn new() -> Self {
64        Self {
65            builder: glib::object::Object::builder(),
66        }
67    }
68
69    pub fn format(self, format: impl Into<glib::GString>) -> Self {
70        Self {
71            builder: self.builder.property("format", format.into()),
72        }
73    }
74
75    pub fn date(self, date: &glib::DateTime) -> Self {
76        Self {
77            builder: self.builder.property("date", date.clone()),
78        }
79    }
80
81    pub fn activates_default(self, activates_default: bool) -> Self {
82        Self {
83            builder: self
84                .builder
85                .property("activates-default", activates_default),
86        }
87    }
88
89    //pub fn attributes(self, attributes: /*Ignored*/&pango::AttrList) -> Self {
90    //    Self { builder: self.builder.property("attributes", attributes), }
91    //}
92
93    //pub fn buffer(self, buffer: &impl IsA</*Ignored*/gtk::EntryBuffer>) -> Self {
94    //    Self { builder: self.builder.property("buffer", buffer.clone().upcast()), }
95    //}
96
97    //    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
98    //pub fn completion(self, completion: /*Ignored*/&gtk::EntryCompletion) -> Self {
99    //    Self { builder: self.builder.property("completion", completion), }
100    //}
101
102    pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
103        Self {
104            builder: self
105                .builder
106                .property("enable-emoji-completion", enable_emoji_completion),
107        }
108    }
109
110    pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
111        Self {
112            builder: self
113                .builder
114                .property("extra-menu", extra_menu.clone().upcast()),
115        }
116    }
117
118    pub fn has_frame(self, has_frame: bool) -> Self {
119        Self {
120            builder: self.builder.property("has-frame", has_frame),
121        }
122    }
123
124    pub fn im_module(self, im_module: impl Into<glib::GString>) -> Self {
125        Self {
126            builder: self.builder.property("im-module", im_module.into()),
127        }
128    }
129
130    //pub fn input_hints(self, input_hints: /*Ignored*/gtk::InputHints) -> Self {
131    //    Self { builder: self.builder.property("input-hints", input_hints), }
132    //}
133
134    //pub fn input_purpose(self, input_purpose: /*Ignored*/gtk::InputPurpose) -> Self {
135    //    Self { builder: self.builder.property("input-purpose", input_purpose), }
136    //}
137
138    pub fn invisible_char(self, invisible_char: u32) -> Self {
139        Self {
140            builder: self.builder.property("invisible-char", invisible_char),
141        }
142    }
143
144    pub fn invisible_char_set(self, invisible_char_set: bool) -> Self {
145        Self {
146            builder: self
147                .builder
148                .property("invisible-char-set", invisible_char_set),
149        }
150    }
151
152    pub fn max_length(self, max_length: i32) -> Self {
153        Self {
154            builder: self.builder.property("max-length", max_length),
155        }
156    }
157
158    pub fn overwrite_mode(self, overwrite_mode: bool) -> Self {
159        Self {
160            builder: self.builder.property("overwrite-mode", overwrite_mode),
161        }
162    }
163
164    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
165        Self {
166            builder: self
167                .builder
168                .property("placeholder-text", placeholder_text.into()),
169        }
170    }
171
172    pub fn primary_icon_activatable(self, primary_icon_activatable: bool) -> Self {
173        Self {
174            builder: self
175                .builder
176                .property("primary-icon-activatable", primary_icon_activatable),
177        }
178    }
179
180    pub fn primary_icon_gicon(self, primary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
181        Self {
182            builder: self
183                .builder
184                .property("primary-icon-gicon", primary_icon_gicon.clone().upcast()),
185        }
186    }
187
188    pub fn primary_icon_name(self, primary_icon_name: impl Into<glib::GString>) -> Self {
189        Self {
190            builder: self
191                .builder
192                .property("primary-icon-name", primary_icon_name.into()),
193        }
194    }
195
196    pub fn primary_icon_paintable(self, primary_icon_paintable: &impl IsA<gdk::Paintable>) -> Self {
197        Self {
198            builder: self.builder.property(
199                "primary-icon-paintable",
200                primary_icon_paintable.clone().upcast(),
201            ),
202        }
203    }
204
205    pub fn primary_icon_sensitive(self, primary_icon_sensitive: bool) -> Self {
206        Self {
207            builder: self
208                .builder
209                .property("primary-icon-sensitive", primary_icon_sensitive),
210        }
211    }
212
213    pub fn primary_icon_tooltip_markup(
214        self,
215        primary_icon_tooltip_markup: impl Into<glib::GString>,
216    ) -> Self {
217        Self {
218            builder: self.builder.property(
219                "primary-icon-tooltip-markup",
220                primary_icon_tooltip_markup.into(),
221            ),
222        }
223    }
224
225    pub fn primary_icon_tooltip_text(
226        self,
227        primary_icon_tooltip_text: impl Into<glib::GString>,
228    ) -> Self {
229        Self {
230            builder: self.builder.property(
231                "primary-icon-tooltip-text",
232                primary_icon_tooltip_text.into(),
233            ),
234        }
235    }
236
237    pub fn progress_fraction(self, progress_fraction: f64) -> Self {
238        Self {
239            builder: self
240                .builder
241                .property("progress-fraction", progress_fraction),
242        }
243    }
244
245    pub fn progress_pulse_step(self, progress_pulse_step: f64) -> Self {
246        Self {
247            builder: self
248                .builder
249                .property("progress-pulse-step", progress_pulse_step),
250        }
251    }
252
253    pub fn secondary_icon_activatable(self, secondary_icon_activatable: bool) -> Self {
254        Self {
255            builder: self
256                .builder
257                .property("secondary-icon-activatable", secondary_icon_activatable),
258        }
259    }
260
261    pub fn secondary_icon_gicon(self, secondary_icon_gicon: &impl IsA<gio::Icon>) -> Self {
262        Self {
263            builder: self.builder.property(
264                "secondary-icon-gicon",
265                secondary_icon_gicon.clone().upcast(),
266            ),
267        }
268    }
269
270    pub fn secondary_icon_name(self, secondary_icon_name: impl Into<glib::GString>) -> Self {
271        Self {
272            builder: self
273                .builder
274                .property("secondary-icon-name", secondary_icon_name.into()),
275        }
276    }
277
278    pub fn secondary_icon_paintable(
279        self,
280        secondary_icon_paintable: &impl IsA<gdk::Paintable>,
281    ) -> Self {
282        Self {
283            builder: self.builder.property(
284                "secondary-icon-paintable",
285                secondary_icon_paintable.clone().upcast(),
286            ),
287        }
288    }
289
290    pub fn secondary_icon_sensitive(self, secondary_icon_sensitive: bool) -> Self {
291        Self {
292            builder: self
293                .builder
294                .property("secondary-icon-sensitive", secondary_icon_sensitive),
295        }
296    }
297
298    pub fn secondary_icon_tooltip_markup(
299        self,
300        secondary_icon_tooltip_markup: impl Into<glib::GString>,
301    ) -> Self {
302        Self {
303            builder: self.builder.property(
304                "secondary-icon-tooltip-markup",
305                secondary_icon_tooltip_markup.into(),
306            ),
307        }
308    }
309
310    pub fn secondary_icon_tooltip_text(
311        self,
312        secondary_icon_tooltip_text: impl Into<glib::GString>,
313    ) -> Self {
314        Self {
315            builder: self.builder.property(
316                "secondary-icon-tooltip-text",
317                secondary_icon_tooltip_text.into(),
318            ),
319        }
320    }
321
322    pub fn show_emoji_icon(self, show_emoji_icon: bool) -> Self {
323        Self {
324            builder: self.builder.property("show-emoji-icon", show_emoji_icon),
325        }
326    }
327
328    //pub fn tabs(self, tabs: /*Ignored*/&pango::TabArray) -> Self {
329    //    Self { builder: self.builder.property("tabs", tabs), }
330    //}
331
332    pub fn truncate_multiline(self, truncate_multiline: bool) -> Self {
333        Self {
334            builder: self
335                .builder
336                .property("truncate-multiline", truncate_multiline),
337        }
338    }
339
340    pub fn visibility(self, visibility: bool) -> Self {
341        Self {
342            builder: self.builder.property("visibility", visibility),
343        }
344    }
345
346    pub fn can_focus(self, can_focus: bool) -> Self {
347        Self {
348            builder: self.builder.property("can-focus", can_focus),
349        }
350    }
351
352    pub fn can_target(self, can_target: bool) -> Self {
353        Self {
354            builder: self.builder.property("can-target", can_target),
355        }
356    }
357
358    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
359        Self {
360            builder: self.builder.property("css-classes", css_classes.into()),
361        }
362    }
363
364    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
365        Self {
366            builder: self.builder.property("css-name", css_name.into()),
367        }
368    }
369
370    //pub fn cursor(self, cursor: /*Ignored*/&gdk::Cursor) -> Self {
371    //    Self { builder: self.builder.property("cursor", cursor), }
372    //}
373
374    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
375        Self {
376            builder: self.builder.property("focus-on-click", focus_on_click),
377        }
378    }
379
380    pub fn focusable(self, focusable: bool) -> Self {
381        Self {
382            builder: self.builder.property("focusable", focusable),
383        }
384    }
385
386    pub fn halign(self, halign: gtk::Align) -> Self {
387        Self {
388            builder: self.builder.property("halign", halign),
389        }
390    }
391
392    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
393        Self {
394            builder: self.builder.property("has-tooltip", has_tooltip),
395        }
396    }
397
398    pub fn height_request(self, height_request: i32) -> Self {
399        Self {
400            builder: self.builder.property("height-request", height_request),
401        }
402    }
403
404    pub fn hexpand(self, hexpand: bool) -> Self {
405        Self {
406            builder: self.builder.property("hexpand", hexpand),
407        }
408    }
409
410    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
411        Self {
412            builder: self.builder.property("hexpand-set", hexpand_set),
413        }
414    }
415
416    //pub fn layout_manager(self, layout_manager: &impl IsA</*Ignored*/gtk::LayoutManager>) -> Self {
417    //    Self { builder: self.builder.property("layout-manager", layout_manager.clone().upcast()), }
418    //}
419
420    #[cfg(feature = "gtk_v4_18")]
421    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
422    pub fn limit_events(self, limit_events: bool) -> Self {
423        Self {
424            builder: self.builder.property("limit-events", limit_events),
425        }
426    }
427
428    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
429        Self {
430            builder: self.builder.property("margin-bottom", margin_bottom),
431        }
432    }
433
434    pub fn margin_end(self, margin_end: i32) -> Self {
435        Self {
436            builder: self.builder.property("margin-end", margin_end),
437        }
438    }
439
440    pub fn margin_start(self, margin_start: i32) -> Self {
441        Self {
442            builder: self.builder.property("margin-start", margin_start),
443        }
444    }
445
446    pub fn margin_top(self, margin_top: i32) -> Self {
447        Self {
448            builder: self.builder.property("margin-top", margin_top),
449        }
450    }
451
452    pub fn name(self, name: impl Into<glib::GString>) -> Self {
453        Self {
454            builder: self.builder.property("name", name.into()),
455        }
456    }
457
458    pub fn opacity(self, opacity: f64) -> Self {
459        Self {
460            builder: self.builder.property("opacity", opacity),
461        }
462    }
463
464    //pub fn overflow(self, overflow: /*Ignored*/gtk::Overflow) -> Self {
465    //    Self { builder: self.builder.property("overflow", overflow), }
466    //}
467
468    pub fn receives_default(self, receives_default: bool) -> Self {
469        Self {
470            builder: self.builder.property("receives-default", receives_default),
471        }
472    }
473
474    pub fn sensitive(self, sensitive: bool) -> Self {
475        Self {
476            builder: self.builder.property("sensitive", sensitive),
477        }
478    }
479
480    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
481        Self {
482            builder: self
483                .builder
484                .property("tooltip-markup", tooltip_markup.into()),
485        }
486    }
487
488    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
489        Self {
490            builder: self.builder.property("tooltip-text", tooltip_text.into()),
491        }
492    }
493
494    pub fn valign(self, valign: gtk::Align) -> Self {
495        Self {
496            builder: self.builder.property("valign", valign),
497        }
498    }
499
500    pub fn vexpand(self, vexpand: bool) -> Self {
501        Self {
502            builder: self.builder.property("vexpand", vexpand),
503        }
504    }
505
506    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
507        Self {
508            builder: self.builder.property("vexpand-set", vexpand_set),
509        }
510    }
511
512    pub fn visible(self, visible: bool) -> Self {
513        Self {
514            builder: self.builder.property("visible", visible),
515        }
516    }
517
518    pub fn width_request(self, width_request: i32) -> Self {
519        Self {
520            builder: self.builder.property("width-request", width_request),
521        }
522    }
523
524    //pub fn accessible_role(self, accessible_role: /*Ignored*/gtk::AccessibleRole) -> Self {
525    //    Self { builder: self.builder.property("accessible-role", accessible_role), }
526    //}
527
528    pub fn editing_canceled(self, editing_canceled: bool) -> Self {
529        Self {
530            builder: self.builder.property("editing-canceled", editing_canceled),
531        }
532    }
533
534    pub fn editable(self, editable: bool) -> Self {
535        Self {
536            builder: self.builder.property("editable", editable),
537        }
538    }
539
540    pub fn enable_undo(self, enable_undo: bool) -> Self {
541        Self {
542            builder: self.builder.property("enable-undo", enable_undo),
543        }
544    }
545
546    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
547        Self {
548            builder: self.builder.property("max-width-chars", max_width_chars),
549        }
550    }
551
552    pub fn text(self, text: impl Into<glib::GString>) -> Self {
553        Self {
554            builder: self.builder.property("text", text.into()),
555        }
556    }
557
558    pub fn width_chars(self, width_chars: i32) -> Self {
559        Self {
560            builder: self.builder.property("width-chars", width_chars),
561        }
562    }
563
564    pub fn xalign(self, xalign: f32) -> Self {
565        Self {
566            builder: self.builder.property("xalign", xalign),
567        }
568    }
569
570    // rustdoc-stripper-ignore-next
571    /// Build the [`DatePicker`].
572    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
573    pub fn build(self) -> DatePicker {
574        assert_initialized_main_thread!();
575        self.builder.build()
576    }
577}
578
579pub trait DatePickerExt: IsA<DatePicker> + 'static {
580    #[doc(alias = "he_date_picker_get_format")]
581    #[doc(alias = "get_format")]
582    fn format(&self) -> glib::GString {
583        unsafe {
584            from_glib_none(ffi::he_date_picker_get_format(
585                self.as_ref().to_glib_none().0,
586            ))
587        }
588    }
589
590    #[doc(alias = "he_date_picker_get_date")]
591    #[doc(alias = "get_date")]
592    fn date(&self) -> glib::DateTime {
593        unsafe { from_glib_none(ffi::he_date_picker_get_date(self.as_ref().to_glib_none().0)) }
594    }
595
596    #[doc(alias = "he_date_picker_set_date")]
597    fn set_date(&self, value: &glib::DateTime) {
598        unsafe {
599            ffi::he_date_picker_set_date(self.as_ref().to_glib_none().0, value.to_glib_none().0);
600        }
601    }
602
603    #[doc(alias = "date")]
604    fn connect_date_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
605        unsafe extern "C" fn notify_date_trampoline<P: IsA<DatePicker>, F: Fn(&P) + 'static>(
606            this: *mut ffi::HeDatePicker,
607            _param_spec: glib::ffi::gpointer,
608            f: glib::ffi::gpointer,
609        ) {
610            let f: &F = &*(f as *const F);
611            f(DatePicker::from_glib_borrow(this).unsafe_cast_ref())
612        }
613        unsafe {
614            let f: Box_<F> = Box_::new(f);
615            connect_raw(
616                self.as_ptr() as *mut _,
617                c"notify::date".as_ptr() as *const _,
618                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
619                    notify_date_trampoline::<Self, F> as *const (),
620                )),
621                Box_::into_raw(f),
622            )
623        }
624    }
625}
626
627impl<O: IsA<DatePicker>> DatePickerExt for O {}