Skip to main content

gtk4/auto/
cell_renderer_accel.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
6use crate::{
7    CellRenderer, CellRendererAccelMode, CellRendererMode, CellRendererText, TreePath, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// Applications editing keyboard accelerators should
19    ///   provide their own implementation according to platform design
20    ///   guidelines
21    /// Renders a keyboard accelerator in a cell
22    ///
23    /// [`CellRendererAccel`][crate::CellRendererAccel] displays a keyboard accelerator (i.e. a key
24    /// combination like `Control + a`). If the cell renderer is editable,
25    /// the accelerator can be changed by simply typing the new combination.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `accel-key`
31    ///  The keyval of the accelerator.
32    ///
33    /// Readable | Writable
34    ///
35    ///
36    /// #### `accel-mode`
37    ///  Determines if the edited accelerators are GTK accelerators. If
38    /// they are, consumed modifiers are suppressed, only accelerators
39    /// accepted by GTK are allowed, and the accelerators are rendered
40    /// in the same way as they are in menus.
41    ///
42    /// Readable | Writable
43    ///
44    ///
45    /// #### `accel-mods`
46    ///  The modifier mask of the accelerator.
47    ///
48    /// Readable | Writable
49    ///
50    ///
51    /// #### `keycode`
52    ///  The hardware keycode of the accelerator. Note that the hardware keycode is
53    /// only relevant if the key does not have a keyval. Normally, the keyboard
54    /// configuration should assign keyvals to all keys.
55    ///
56    /// Readable | Writable
57    /// <details><summary><h4>CellRendererText</h4></summary>
58    ///
59    ///
60    /// #### `align-set`
61    ///  Readable | Writable
62    ///
63    ///
64    /// #### `alignment`
65    ///  Specifies how to align the lines of text with respect to each other.
66    ///
67    /// Note that this property describes how to align the lines of text in
68    /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
69    /// on the other hand, sets the horizontal alignment of the whole text.
70    ///
71    /// Readable | Writable
72    ///
73    ///
74    /// #### `attributes`
75    ///  Readable | Writable
76    ///
77    ///
78    /// #### `background`
79    ///  Writable
80    ///
81    ///
82    /// #### `background-rgba`
83    ///  Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
84    ///
85    /// Readable | Writable
86    ///
87    ///
88    /// #### `background-set`
89    ///  Readable | Writable
90    ///
91    ///
92    /// #### `editable`
93    ///  Readable | Writable
94    ///
95    ///
96    /// #### `editable-set`
97    ///  Readable | Writable
98    ///
99    ///
100    /// #### `ellipsize`
101    ///  Specifies the preferred place to ellipsize the string, if the cell renderer
102    /// does not have enough room to display the entire string. Setting it to
103    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
104    /// for another way of making the text fit into a given width.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `ellipsize-set`
110    ///  Readable | Writable
111    ///
112    ///
113    /// #### `family`
114    ///  Readable | Writable
115    ///
116    ///
117    /// #### `family-set`
118    ///  Readable | Writable
119    ///
120    ///
121    /// #### `font`
122    ///  Readable | Writable
123    ///
124    ///
125    /// #### `font-desc`
126    ///  Readable | Writable
127    ///
128    ///
129    /// #### `foreground`
130    ///  Writable
131    ///
132    ///
133    /// #### `foreground-rgba`
134    ///  Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `foreground-set`
140    ///  Readable | Writable
141    ///
142    ///
143    /// #### `language`
144    ///  Readable | Writable
145    ///
146    ///
147    /// #### `language-set`
148    ///  Readable | Writable
149    ///
150    ///
151    /// #### `markup`
152    ///  Writable
153    ///
154    ///
155    /// #### `max-width-chars`
156    ///  The desired maximum width of the cell, in characters. If this property
157    /// is set to -1, the width will be calculated automatically.
158    ///
159    /// For cell renderers that ellipsize or wrap text; this property
160    /// controls the maximum reported width of the cell. The
161    /// cell should not receive any greater allocation unless it is
162    /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
163    /// have received their natural width.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `placeholder-text`
169    ///  The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
170    /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
171    ///
172    /// Readable | Writable
173    ///
174    ///
175    /// #### `rise`
176    ///  Readable | Writable
177    ///
178    ///
179    /// #### `rise-set`
180    ///  Readable | Writable
181    ///
182    ///
183    /// #### `scale`
184    ///  Readable | Writable
185    ///
186    ///
187    /// #### `scale-set`
188    ///  Readable | Writable
189    ///
190    ///
191    /// #### `single-paragraph-mode`
192    ///  Readable | Writable
193    ///
194    ///
195    /// #### `size`
196    ///  Readable | Writable
197    ///
198    ///
199    /// #### `size-points`
200    ///  Readable | Writable
201    ///
202    ///
203    /// #### `size-set`
204    ///  Readable | Writable
205    ///
206    ///
207    /// #### `stretch`
208    ///  Readable | Writable
209    ///
210    ///
211    /// #### `stretch-set`
212    ///  Readable | Writable
213    ///
214    ///
215    /// #### `strikethrough`
216    ///  Readable | Writable
217    ///
218    ///
219    /// #### `strikethrough-set`
220    ///  Readable | Writable
221    ///
222    ///
223    /// #### `style`
224    ///  Readable | Writable
225    ///
226    ///
227    /// #### `style-set`
228    ///  Readable | Writable
229    ///
230    ///
231    /// #### `text`
232    ///  Readable | Writable
233    ///
234    ///
235    /// #### `underline`
236    ///  Readable | Writable
237    ///
238    ///
239    /// #### `underline-set`
240    ///  Readable | Writable
241    ///
242    ///
243    /// #### `variant`
244    ///  Readable | Writable
245    ///
246    ///
247    /// #### `variant-set`
248    ///  Readable | Writable
249    ///
250    ///
251    /// #### `weight`
252    ///  Readable | Writable
253    ///
254    ///
255    /// #### `weight-set`
256    ///  Readable | Writable
257    ///
258    ///
259    /// #### `width-chars`
260    ///  The desired width of the cell, in characters. If this property is set to
261    /// -1, the width will be calculated automatically, otherwise the cell will
262    /// request either 3 characters or the property value, whichever is greater.
263    ///
264    /// Readable | Writable
265    ///
266    ///
267    /// #### `wrap-mode`
268    ///  Specifies how to break the string into multiple lines, if the cell
269    /// renderer does not have enough room to display the entire string.
270    /// This property has no effect unless the wrap-width property is set.
271    ///
272    /// Readable | Writable
273    ///
274    ///
275    /// #### `wrap-width`
276    ///  Specifies the minimum width at which the text is wrapped. The wrap-mode property can
277    /// be used to influence at what character positions the line breaks can be placed.
278    /// Setting wrap-width to -1 turns wrapping off.
279    ///
280    /// Readable | Writable
281    /// </details>
282    /// <details><summary><h4>CellRenderer</h4></summary>
283    ///
284    ///
285    /// #### `cell-background`
286    ///  Writable
287    ///
288    ///
289    /// #### `cell-background-rgba`
290    ///  Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
291    ///
292    /// Readable | Writable
293    ///
294    ///
295    /// #### `cell-background-set`
296    ///  Readable | Writable
297    ///
298    ///
299    /// #### `editing`
300    ///  Readable
301    ///
302    ///
303    /// #### `height`
304    ///  Readable | Writable
305    ///
306    ///
307    /// #### `is-expanded`
308    ///  Readable | Writable
309    ///
310    ///
311    /// #### `is-expander`
312    ///  Readable | Writable
313    ///
314    ///
315    /// #### `mode`
316    ///  Readable | Writable
317    ///
318    ///
319    /// #### `sensitive`
320    ///  Readable | Writable
321    ///
322    ///
323    /// #### `visible`
324    ///  Readable | Writable
325    ///
326    ///
327    /// #### `width`
328    ///  Readable | Writable
329    ///
330    ///
331    /// #### `xalign`
332    ///  Readable | Writable
333    ///
334    ///
335    /// #### `xpad`
336    ///  Readable | Writable
337    ///
338    ///
339    /// #### `yalign`
340    ///  Readable | Writable
341    ///
342    ///
343    /// #### `ypad`
344    ///  Readable | Writable
345    /// </details>
346    ///
347    /// ## Signals
348    ///
349    ///
350    /// #### `accel-cleared`
351    ///  Gets emitted when the user has removed the accelerator.
352    ///
353    ///
354    ///
355    ///
356    /// #### `accel-edited`
357    ///  Gets emitted when the user has selected a new accelerator.
358    ///
359    ///
360    /// <details><summary><h4>CellRendererText</h4></summary>
361    ///
362    ///
363    /// #### `edited`
364    ///  This signal is emitted after @renderer has been edited.
365    ///
366    /// It is the responsibility of the application to update the model
367    /// and store @new_text at the position indicated by @path.
368    ///
369    ///
370    /// </details>
371    /// <details><summary><h4>CellRenderer</h4></summary>
372    ///
373    ///
374    /// #### `editing-canceled`
375    ///  This signal gets emitted when the user cancels the process of editing a
376    /// cell.  For example, an editable cell renderer could be written to cancel
377    /// editing when the user presses Escape.
378    ///
379    /// See also: gtk_cell_renderer_stop_editing().
380    ///
381    ///
382    ///
383    ///
384    /// #### `editing-started`
385    ///  t depend on the @renderer.
386    ///
387    /// Note that GTK doesn't guarantee that cell renderers will
388    /// continue to use the same kind of widget for editing in future
389    /// releases, therefore you should check the type of @editable
390    /// before doing any specific setup, as in the following example:
391    ///
392    /// **⚠️ The following code is in c ⚠️**
393    ///
394    /// ```c
395    /// static void
396    /// text_editing_started (GtkCellRenderer *cell,
397    ///                       GtkCellEditable *editable,
398    ///                       const char      *path,
399    ///                       gpointer         data)
400    /// {
401    ///   if (GTK_IS_ENTRY (editable))
402    ///     {
403    ///       GtkEntry *entry = GTK_ENTRY (editable);
404    ///
405    ///       // ... create a GtkEntryCompletion
406    ///
407    ///       gtk_entry_set_completion (entry, completion);
408    ///     }
409    /// }
410    /// ```
411    ///
412    ///
413    /// </details>
414    ///
415    /// # Implements
416    ///
417    /// [`CellRendererTextExt`][trait@crate::prelude::CellRendererTextExt], [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`], [`CellRendererExtManual`][trait@crate::prelude::CellRendererExtManual]
418    #[doc(alias = "GtkCellRendererAccel")]
419    pub struct CellRendererAccel(Object<ffi::GtkCellRendererAccel>) @extends CellRendererText, CellRenderer;
420
421    match fn {
422        type_ => || ffi::gtk_cell_renderer_accel_get_type(),
423    }
424}
425
426impl CellRendererAccel {
427    /// Creates a new [`CellRendererAccel`][crate::CellRendererAccel].
428    ///
429    /// # Deprecated since 4.10
430    ///
431    ///
432    /// # Returns
433    ///
434    /// the new cell renderer
435    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
436    #[allow(deprecated)]
437    #[doc(alias = "gtk_cell_renderer_accel_new")]
438    pub fn new() -> CellRendererAccel {
439        assert_initialized_main_thread!();
440        unsafe { CellRenderer::from_glib_none(ffi::gtk_cell_renderer_accel_new()).unsafe_cast() }
441    }
442
443    // rustdoc-stripper-ignore-next
444    /// Creates a new builder-pattern struct instance to construct [`CellRendererAccel`] objects.
445    ///
446    /// This method returns an instance of [`CellRendererAccelBuilder`](crate::builders::CellRendererAccelBuilder) which can be used to create [`CellRendererAccel`] objects.
447    pub fn builder() -> CellRendererAccelBuilder {
448        CellRendererAccelBuilder::new()
449    }
450
451    /// The keyval of the accelerator.
452    #[doc(alias = "accel-key")]
453    pub fn accel_key(&self) -> u32 {
454        ObjectExt::property(self, "accel-key")
455    }
456
457    /// The keyval of the accelerator.
458    #[doc(alias = "accel-key")]
459    pub fn set_accel_key(&self, accel_key: u32) {
460        ObjectExt::set_property(self, "accel-key", accel_key)
461    }
462
463    /// Determines if the edited accelerators are GTK accelerators. If
464    /// they are, consumed modifiers are suppressed, only accelerators
465    /// accepted by GTK are allowed, and the accelerators are rendered
466    /// in the same way as they are in menus.
467    #[doc(alias = "accel-mode")]
468    pub fn accel_mode(&self) -> CellRendererAccelMode {
469        ObjectExt::property(self, "accel-mode")
470    }
471
472    /// Determines if the edited accelerators are GTK accelerators. If
473    /// they are, consumed modifiers are suppressed, only accelerators
474    /// accepted by GTK are allowed, and the accelerators are rendered
475    /// in the same way as they are in menus.
476    #[doc(alias = "accel-mode")]
477    pub fn set_accel_mode(&self, accel_mode: CellRendererAccelMode) {
478        ObjectExt::set_property(self, "accel-mode", accel_mode)
479    }
480
481    /// The modifier mask of the accelerator.
482    #[doc(alias = "accel-mods")]
483    pub fn accel_mods(&self) -> gdk::ModifierType {
484        ObjectExt::property(self, "accel-mods")
485    }
486
487    /// The modifier mask of the accelerator.
488    #[doc(alias = "accel-mods")]
489    pub fn set_accel_mods(&self, accel_mods: gdk::ModifierType) {
490        ObjectExt::set_property(self, "accel-mods", accel_mods)
491    }
492
493    /// The hardware keycode of the accelerator. Note that the hardware keycode is
494    /// only relevant if the key does not have a keyval. Normally, the keyboard
495    /// configuration should assign keyvals to all keys.
496    pub fn keycode(&self) -> u32 {
497        ObjectExt::property(self, "keycode")
498    }
499
500    /// The hardware keycode of the accelerator. Note that the hardware keycode is
501    /// only relevant if the key does not have a keyval. Normally, the keyboard
502    /// configuration should assign keyvals to all keys.
503    pub fn set_keycode(&self, keycode: u32) {
504        ObjectExt::set_property(self, "keycode", keycode)
505    }
506
507    /// Gets emitted when the user has removed the accelerator.
508    /// ## `path_string`
509    /// the path identifying the row of the edited cell
510    #[doc(alias = "accel-cleared")]
511    pub fn connect_accel_cleared<F: Fn(&Self, TreePath) + 'static>(&self, f: F) -> SignalHandlerId {
512        unsafe extern "C" fn accel_cleared_trampoline<
513            F: Fn(&CellRendererAccel, TreePath) + 'static,
514        >(
515            this: *mut ffi::GtkCellRendererAccel,
516            path_string: *mut std::ffi::c_char,
517            f: glib::ffi::gpointer,
518        ) {
519            unsafe {
520                let f: &F = &*(f as *const F);
521                let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path_string));
522                f(&from_glib_borrow(this), path)
523            }
524        }
525        unsafe {
526            let f: Box_<F> = Box_::new(f);
527            connect_raw(
528                self.as_ptr() as *mut _,
529                c"accel-cleared".as_ptr(),
530                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
531                    accel_cleared_trampoline::<F> as *const (),
532                )),
533                Box_::into_raw(f),
534            )
535        }
536    }
537
538    /// Gets emitted when the user has selected a new accelerator.
539    /// ## `path_string`
540    /// the path identifying the row of the edited cell
541    /// ## `accel_key`
542    /// the new accelerator keyval
543    /// ## `accel_mods`
544    /// the new accelerator modifier mask
545    /// ## `hardware_keycode`
546    /// the keycode of the new accelerator
547    #[doc(alias = "accel-edited")]
548    pub fn connect_accel_edited<F: Fn(&Self, TreePath, u32, gdk::ModifierType, u32) + 'static>(
549        &self,
550        f: F,
551    ) -> SignalHandlerId {
552        unsafe extern "C" fn accel_edited_trampoline<
553            F: Fn(&CellRendererAccel, TreePath, u32, gdk::ModifierType, u32) + 'static,
554        >(
555            this: *mut ffi::GtkCellRendererAccel,
556            path_string: *mut std::ffi::c_char,
557            accel_key: std::ffi::c_uint,
558            accel_mods: gdk::ffi::GdkModifierType,
559            hardware_keycode: std::ffi::c_uint,
560            f: glib::ffi::gpointer,
561        ) {
562            unsafe {
563                let f: &F = &*(f as *const F);
564                let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path_string));
565                f(
566                    &from_glib_borrow(this),
567                    path,
568                    accel_key,
569                    from_glib(accel_mods),
570                    hardware_keycode,
571                )
572            }
573        }
574        unsafe {
575            let f: Box_<F> = Box_::new(f);
576            connect_raw(
577                self.as_ptr() as *mut _,
578                c"accel-edited".as_ptr(),
579                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
580                    accel_edited_trampoline::<F> as *const (),
581                )),
582                Box_::into_raw(f),
583            )
584        }
585    }
586
587    #[doc(alias = "accel-key")]
588    pub fn connect_accel_key_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
589        unsafe extern "C" fn notify_accel_key_trampoline<F: Fn(&CellRendererAccel) + 'static>(
590            this: *mut ffi::GtkCellRendererAccel,
591            _param_spec: glib::ffi::gpointer,
592            f: glib::ffi::gpointer,
593        ) {
594            unsafe {
595                let f: &F = &*(f as *const F);
596                f(&from_glib_borrow(this))
597            }
598        }
599        unsafe {
600            let f: Box_<F> = Box_::new(f);
601            connect_raw(
602                self.as_ptr() as *mut _,
603                c"notify::accel-key".as_ptr(),
604                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
605                    notify_accel_key_trampoline::<F> as *const (),
606                )),
607                Box_::into_raw(f),
608            )
609        }
610    }
611
612    #[doc(alias = "accel-mode")]
613    pub fn connect_accel_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
614        unsafe extern "C" fn notify_accel_mode_trampoline<F: Fn(&CellRendererAccel) + 'static>(
615            this: *mut ffi::GtkCellRendererAccel,
616            _param_spec: glib::ffi::gpointer,
617            f: glib::ffi::gpointer,
618        ) {
619            unsafe {
620                let f: &F = &*(f as *const F);
621                f(&from_glib_borrow(this))
622            }
623        }
624        unsafe {
625            let f: Box_<F> = Box_::new(f);
626            connect_raw(
627                self.as_ptr() as *mut _,
628                c"notify::accel-mode".as_ptr(),
629                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
630                    notify_accel_mode_trampoline::<F> as *const (),
631                )),
632                Box_::into_raw(f),
633            )
634        }
635    }
636
637    #[doc(alias = "accel-mods")]
638    pub fn connect_accel_mods_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
639        unsafe extern "C" fn notify_accel_mods_trampoline<F: Fn(&CellRendererAccel) + 'static>(
640            this: *mut ffi::GtkCellRendererAccel,
641            _param_spec: glib::ffi::gpointer,
642            f: glib::ffi::gpointer,
643        ) {
644            unsafe {
645                let f: &F = &*(f as *const F);
646                f(&from_glib_borrow(this))
647            }
648        }
649        unsafe {
650            let f: Box_<F> = Box_::new(f);
651            connect_raw(
652                self.as_ptr() as *mut _,
653                c"notify::accel-mods".as_ptr(),
654                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
655                    notify_accel_mods_trampoline::<F> as *const (),
656                )),
657                Box_::into_raw(f),
658            )
659        }
660    }
661
662    #[doc(alias = "keycode")]
663    pub fn connect_keycode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
664        unsafe extern "C" fn notify_keycode_trampoline<F: Fn(&CellRendererAccel) + 'static>(
665            this: *mut ffi::GtkCellRendererAccel,
666            _param_spec: glib::ffi::gpointer,
667            f: glib::ffi::gpointer,
668        ) {
669            unsafe {
670                let f: &F = &*(f as *const F);
671                f(&from_glib_borrow(this))
672            }
673        }
674        unsafe {
675            let f: Box_<F> = Box_::new(f);
676            connect_raw(
677                self.as_ptr() as *mut _,
678                c"notify::keycode".as_ptr(),
679                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
680                    notify_keycode_trampoline::<F> as *const (),
681                )),
682                Box_::into_raw(f),
683            )
684        }
685    }
686}
687
688impl Default for CellRendererAccel {
689    fn default() -> Self {
690        Self::new()
691    }
692}
693
694// rustdoc-stripper-ignore-next
695/// A [builder-pattern] type to construct [`CellRendererAccel`] objects.
696///
697/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
698#[must_use = "The builder must be built to be used"]
699pub struct CellRendererAccelBuilder {
700    builder: glib::object::ObjectBuilder<'static, CellRendererAccel>,
701}
702
703impl CellRendererAccelBuilder {
704    fn new() -> Self {
705        Self {
706            builder: glib::object::Object::builder(),
707        }
708    }
709
710    /// The keyval of the accelerator.
711    pub fn accel_key(self, accel_key: u32) -> Self {
712        Self {
713            builder: self.builder.property("accel-key", accel_key),
714        }
715    }
716
717    /// Determines if the edited accelerators are GTK accelerators. If
718    /// they are, consumed modifiers are suppressed, only accelerators
719    /// accepted by GTK are allowed, and the accelerators are rendered
720    /// in the same way as they are in menus.
721    pub fn accel_mode(self, accel_mode: CellRendererAccelMode) -> Self {
722        Self {
723            builder: self.builder.property("accel-mode", accel_mode),
724        }
725    }
726
727    /// The modifier mask of the accelerator.
728    pub fn accel_mods(self, accel_mods: gdk::ModifierType) -> Self {
729        Self {
730            builder: self.builder.property("accel-mods", accel_mods),
731        }
732    }
733
734    /// The hardware keycode of the accelerator. Note that the hardware keycode is
735    /// only relevant if the key does not have a keyval. Normally, the keyboard
736    /// configuration should assign keyvals to all keys.
737    pub fn keycode(self, keycode: u32) -> Self {
738        Self {
739            builder: self.builder.property("keycode", keycode),
740        }
741    }
742
743    pub fn align_set(self, align_set: bool) -> Self {
744        Self {
745            builder: self.builder.property("align-set", align_set),
746        }
747    }
748
749    /// Specifies how to align the lines of text with respect to each other.
750    ///
751    /// Note that this property describes how to align the lines of text in
752    /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
753    /// on the other hand, sets the horizontal alignment of the whole text.
754    pub fn alignment(self, alignment: pango::Alignment) -> Self {
755        Self {
756            builder: self.builder.property("alignment", alignment),
757        }
758    }
759
760    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
761        Self {
762            builder: self.builder.property("attributes", attributes.clone()),
763        }
764    }
765
766    pub fn background(self, background: impl Into<glib::GString>) -> Self {
767        Self {
768            builder: self.builder.property("background", background.into()),
769        }
770    }
771
772    /// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
773    pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
774        Self {
775            builder: self.builder.property("background-rgba", background_rgba),
776        }
777    }
778
779    pub fn background_set(self, background_set: bool) -> Self {
780        Self {
781            builder: self.builder.property("background-set", background_set),
782        }
783    }
784
785    pub fn editable(self, editable: bool) -> Self {
786        Self {
787            builder: self.builder.property("editable", editable),
788        }
789    }
790
791    pub fn editable_set(self, editable_set: bool) -> Self {
792        Self {
793            builder: self.builder.property("editable-set", editable_set),
794        }
795    }
796
797    /// Specifies the preferred place to ellipsize the string, if the cell renderer
798    /// does not have enough room to display the entire string. Setting it to
799    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
800    /// for another way of making the text fit into a given width.
801    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
802        Self {
803            builder: self.builder.property("ellipsize", ellipsize),
804        }
805    }
806
807    pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
808        Self {
809            builder: self.builder.property("ellipsize-set", ellipsize_set),
810        }
811    }
812
813    pub fn family(self, family: impl Into<glib::GString>) -> Self {
814        Self {
815            builder: self.builder.property("family", family.into()),
816        }
817    }
818
819    pub fn family_set(self, family_set: bool) -> Self {
820        Self {
821            builder: self.builder.property("family-set", family_set),
822        }
823    }
824
825    pub fn font(self, font: impl Into<glib::GString>) -> Self {
826        Self {
827            builder: self.builder.property("font", font.into()),
828        }
829    }
830
831    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
832        Self {
833            builder: self.builder.property("font-desc", font_desc),
834        }
835    }
836
837    pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
838        Self {
839            builder: self.builder.property("foreground", foreground.into()),
840        }
841    }
842
843    /// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
844    pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
845        Self {
846            builder: self.builder.property("foreground-rgba", foreground_rgba),
847        }
848    }
849
850    pub fn foreground_set(self, foreground_set: bool) -> Self {
851        Self {
852            builder: self.builder.property("foreground-set", foreground_set),
853        }
854    }
855
856    pub fn language(self, language: impl Into<glib::GString>) -> Self {
857        Self {
858            builder: self.builder.property("language", language.into()),
859        }
860    }
861
862    pub fn language_set(self, language_set: bool) -> Self {
863        Self {
864            builder: self.builder.property("language-set", language_set),
865        }
866    }
867
868    pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
869        Self {
870            builder: self.builder.property("markup", markup.into()),
871        }
872    }
873
874    /// The desired maximum width of the cell, in characters. If this property
875    /// is set to -1, the width will be calculated automatically.
876    ///
877    /// For cell renderers that ellipsize or wrap text; this property
878    /// controls the maximum reported width of the cell. The
879    /// cell should not receive any greater allocation unless it is
880    /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
881    /// have received their natural width.
882    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
883        Self {
884            builder: self.builder.property("max-width-chars", max_width_chars),
885        }
886    }
887
888    /// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
889    /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
890    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
891        Self {
892            builder: self
893                .builder
894                .property("placeholder-text", placeholder_text.into()),
895        }
896    }
897
898    pub fn rise(self, rise: i32) -> Self {
899        Self {
900            builder: self.builder.property("rise", rise),
901        }
902    }
903
904    pub fn rise_set(self, rise_set: bool) -> Self {
905        Self {
906            builder: self.builder.property("rise-set", rise_set),
907        }
908    }
909
910    pub fn scale(self, scale: f64) -> Self {
911        Self {
912            builder: self.builder.property("scale", scale),
913        }
914    }
915
916    pub fn scale_set(self, scale_set: bool) -> Self {
917        Self {
918            builder: self.builder.property("scale-set", scale_set),
919        }
920    }
921
922    pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
923        Self {
924            builder: self
925                .builder
926                .property("single-paragraph-mode", single_paragraph_mode),
927        }
928    }
929
930    pub fn size(self, size: i32) -> Self {
931        Self {
932            builder: self.builder.property("size", size),
933        }
934    }
935
936    pub fn size_points(self, size_points: f64) -> Self {
937        Self {
938            builder: self.builder.property("size-points", size_points),
939        }
940    }
941
942    pub fn size_set(self, size_set: bool) -> Self {
943        Self {
944            builder: self.builder.property("size-set", size_set),
945        }
946    }
947
948    pub fn stretch(self, stretch: pango::Stretch) -> Self {
949        Self {
950            builder: self.builder.property("stretch", stretch),
951        }
952    }
953
954    pub fn stretch_set(self, stretch_set: bool) -> Self {
955        Self {
956            builder: self.builder.property("stretch-set", stretch_set),
957        }
958    }
959
960    pub fn strikethrough(self, strikethrough: bool) -> Self {
961        Self {
962            builder: self.builder.property("strikethrough", strikethrough),
963        }
964    }
965
966    pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
967        Self {
968            builder: self
969                .builder
970                .property("strikethrough-set", strikethrough_set),
971        }
972    }
973
974    pub fn style(self, style: pango::Style) -> Self {
975        Self {
976            builder: self.builder.property("style", style),
977        }
978    }
979
980    pub fn style_set(self, style_set: bool) -> Self {
981        Self {
982            builder: self.builder.property("style-set", style_set),
983        }
984    }
985
986    pub fn text(self, text: impl Into<glib::GString>) -> Self {
987        Self {
988            builder: self.builder.property("text", text.into()),
989        }
990    }
991
992    pub fn underline(self, underline: pango::Underline) -> Self {
993        Self {
994            builder: self.builder.property("underline", underline),
995        }
996    }
997
998    pub fn underline_set(self, underline_set: bool) -> Self {
999        Self {
1000            builder: self.builder.property("underline-set", underline_set),
1001        }
1002    }
1003
1004    pub fn variant(self, variant: pango::Variant) -> Self {
1005        Self {
1006            builder: self.builder.property("variant", variant),
1007        }
1008    }
1009
1010    pub fn variant_set(self, variant_set: bool) -> Self {
1011        Self {
1012            builder: self.builder.property("variant-set", variant_set),
1013        }
1014    }
1015
1016    pub fn weight(self, weight: i32) -> Self {
1017        Self {
1018            builder: self.builder.property("weight", weight),
1019        }
1020    }
1021
1022    pub fn weight_set(self, weight_set: bool) -> Self {
1023        Self {
1024            builder: self.builder.property("weight-set", weight_set),
1025        }
1026    }
1027
1028    /// The desired width of the cell, in characters. If this property is set to
1029    /// -1, the width will be calculated automatically, otherwise the cell will
1030    /// request either 3 characters or the property value, whichever is greater.
1031    pub fn width_chars(self, width_chars: i32) -> Self {
1032        Self {
1033            builder: self.builder.property("width-chars", width_chars),
1034        }
1035    }
1036
1037    /// Specifies how to break the string into multiple lines, if the cell
1038    /// renderer does not have enough room to display the entire string.
1039    /// This property has no effect unless the wrap-width property is set.
1040    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1041        Self {
1042            builder: self.builder.property("wrap-mode", wrap_mode),
1043        }
1044    }
1045
1046    /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
1047    /// be used to influence at what character positions the line breaks can be placed.
1048    /// Setting wrap-width to -1 turns wrapping off.
1049    pub fn wrap_width(self, wrap_width: i32) -> Self {
1050        Self {
1051            builder: self.builder.property("wrap-width", wrap_width),
1052        }
1053    }
1054
1055    pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
1056        Self {
1057            builder: self
1058                .builder
1059                .property("cell-background", cell_background.into()),
1060        }
1061    }
1062
1063    /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
1064    pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
1065        Self {
1066            builder: self
1067                .builder
1068                .property("cell-background-rgba", cell_background_rgba),
1069        }
1070    }
1071
1072    pub fn cell_background_set(self, cell_background_set: bool) -> Self {
1073        Self {
1074            builder: self
1075                .builder
1076                .property("cell-background-set", cell_background_set),
1077        }
1078    }
1079
1080    pub fn height(self, height: i32) -> Self {
1081        Self {
1082            builder: self.builder.property("height", height),
1083        }
1084    }
1085
1086    pub fn is_expanded(self, is_expanded: bool) -> Self {
1087        Self {
1088            builder: self.builder.property("is-expanded", is_expanded),
1089        }
1090    }
1091
1092    pub fn is_expander(self, is_expander: bool) -> Self {
1093        Self {
1094            builder: self.builder.property("is-expander", is_expander),
1095        }
1096    }
1097
1098    pub fn mode(self, mode: CellRendererMode) -> Self {
1099        Self {
1100            builder: self.builder.property("mode", mode),
1101        }
1102    }
1103
1104    pub fn sensitive(self, sensitive: bool) -> Self {
1105        Self {
1106            builder: self.builder.property("sensitive", sensitive),
1107        }
1108    }
1109
1110    pub fn visible(self, visible: bool) -> Self {
1111        Self {
1112            builder: self.builder.property("visible", visible),
1113        }
1114    }
1115
1116    pub fn width(self, width: i32) -> Self {
1117        Self {
1118            builder: self.builder.property("width", width),
1119        }
1120    }
1121
1122    pub fn xalign(self, xalign: f32) -> Self {
1123        Self {
1124            builder: self.builder.property("xalign", xalign),
1125        }
1126    }
1127
1128    pub fn xpad(self, xpad: u32) -> Self {
1129        Self {
1130            builder: self.builder.property("xpad", xpad),
1131        }
1132    }
1133
1134    pub fn yalign(self, yalign: f32) -> Self {
1135        Self {
1136            builder: self.builder.property("yalign", yalign),
1137        }
1138    }
1139
1140    pub fn ypad(self, ypad: u32) -> Self {
1141        Self {
1142            builder: self.builder.property("ypad", ypad),
1143        }
1144    }
1145
1146    // rustdoc-stripper-ignore-next
1147    /// Build the [`CellRendererAccel`].
1148    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1149    pub fn build(self) -> CellRendererAccel {
1150        assert_initialized_main_thread!();
1151        self.builder.build()
1152    }
1153}