Skip to main content

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