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