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