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