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    ///
406    /// **⚠️ The following code is in C ⚠️**
407    ///
408    /// ```C
409    /// static void
410    /// text_editing_started (GtkCellRenderer *cell,
411    ///                       GtkCellEditable *editable,
412    ///                       const char      *path,
413    ///                       gpointer         data)
414    /// {
415    ///   if (GTK_IS_ENTRY (editable))
416    ///     {
417    ///       GtkEntry *entry = GTK_ENTRY (editable);
418    ///
419    ///       // ... create a GtkEntryCompletion
420    ///
421    ///       gtk_entry_set_completion (entry, completion);
422    ///     }
423    /// }
424    /// ```
425    ///
426    ///
427    /// </details>
428    ///
429    /// # Implements
430    ///
431    /// [`CellRendererTextExt`][trait@crate::prelude::CellRendererTextExt], [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`], [`CellRendererExtManual`][trait@crate::prelude::CellRendererExtManual]
432    #[doc(alias = "GtkCellRendererCombo")]
433    pub struct CellRendererCombo(Object<ffi::GtkCellRendererCombo>) @extends CellRendererText, CellRenderer;
434
435    match fn {
436        type_ => || ffi::gtk_cell_renderer_combo_get_type(),
437    }
438}
439
440impl CellRendererCombo {
441    /// Creates a new [`CellRendererCombo`][crate::CellRendererCombo].
442    /// Adjust how text is drawn using object properties.
443    /// Object properties can be set globally (with g_object_set()).
444    /// Also, with [`TreeViewColumn`][crate::TreeViewColumn], you can bind a property to a value
445    /// in a [`TreeModel`][crate::TreeModel]. For example, you can bind the “text” property
446    /// on the cell renderer to a string value in the model, thus rendering
447    /// a different string in each row of the [`TreeView`][crate::TreeView].
448    ///
449    /// # Deprecated since 4.10
450    ///
451    ///
452    /// # Returns
453    ///
454    /// the new cell renderer
455    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
456    #[allow(deprecated)]
457    #[doc(alias = "gtk_cell_renderer_combo_new")]
458    pub fn new() -> CellRendererCombo {
459        assert_initialized_main_thread!();
460        unsafe { CellRenderer::from_glib_none(ffi::gtk_cell_renderer_combo_new()).unsafe_cast() }
461    }
462
463    // rustdoc-stripper-ignore-next
464    /// Creates a new builder-pattern struct instance to construct [`CellRendererCombo`] objects.
465    ///
466    /// This method returns an instance of [`CellRendererComboBuilder`](crate::builders::CellRendererComboBuilder) which can be used to create [`CellRendererCombo`] objects.
467    pub fn builder() -> CellRendererComboBuilder {
468        CellRendererComboBuilder::new()
469    }
470
471    /// If [`true`], the cell renderer will include an entry and allow to enter
472    /// values other than the ones in the popup list.
473    #[doc(alias = "has-entry")]
474    pub fn has_entry(&self) -> bool {
475        ObjectExt::property(self, "has-entry")
476    }
477
478    /// If [`true`], the cell renderer will include an entry and allow to enter
479    /// values other than the ones in the popup list.
480    #[doc(alias = "has-entry")]
481    pub fn set_has_entry(&self, has_entry: bool) {
482        ObjectExt::set_property(self, "has-entry", has_entry)
483    }
484
485    /// Holds a tree model containing the possible values for the combo box.
486    /// Use the text_column property to specify the column holding the values.
487    pub fn model(&self) -> Option<TreeModel> {
488        ObjectExt::property(self, "model")
489    }
490
491    /// Holds a tree model containing the possible values for the combo box.
492    /// Use the text_column property to specify the column holding the values.
493    pub fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) {
494        ObjectExt::set_property(self, "model", model)
495    }
496
497    /// Specifies the model column which holds the possible values for the
498    /// combo box.
499    ///
500    /// Note that this refers to the model specified in the model property,
501    /// not the model backing the tree view to which
502    /// this cell renderer is attached.
503    ///
504    /// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
505    /// this column to its combo box.
506    #[doc(alias = "text-column")]
507    pub fn text_column(&self) -> i32 {
508        ObjectExt::property(self, "text-column")
509    }
510
511    /// Specifies the model column which holds the possible values for the
512    /// combo box.
513    ///
514    /// Note that this refers to the model specified in the model property,
515    /// not the model backing the tree view to which
516    /// this cell renderer is attached.
517    ///
518    /// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
519    /// this column to its combo box.
520    #[doc(alias = "text-column")]
521    pub fn set_text_column(&self, text_column: i32) {
522        ObjectExt::set_property(self, "text-column", text_column)
523    }
524
525    /// This signal is emitted each time after the user selected an item in
526    /// the combo box, either by using the mouse or the arrow keys.  Contrary
527    /// to GtkComboBox, GtkCellRendererCombo::changed is not emitted for
528    /// changes made to a selected item in the entry.  The argument @new_iter
529    /// corresponds to the newly selected item in the combo box and it is relative
530    /// to the GtkTreeModel set via the model property on GtkCellRendererCombo.
531    ///
532    /// Note that as soon as you change the model displayed in the tree view,
533    /// the tree view will immediately cease the editing operating.  This
534    /// means that you most probably want to refrain from changing the model
535    /// until the combo cell renderer emits the edited or editing_canceled signal.
536    /// ## `path_string`
537    /// a string of the path identifying the edited cell
538    ///               (relative to the tree view model)
539    /// ## `new_iter`
540    /// the new iter selected in the combo box
541    ///            (relative to the combo box model)
542    #[doc(alias = "changed")]
543    pub fn connect_changed<F: Fn(&Self, TreePath, &TreeIter) + 'static>(
544        &self,
545        f: F,
546    ) -> SignalHandlerId {
547        unsafe extern "C" fn changed_trampoline<
548            F: Fn(&CellRendererCombo, TreePath, &TreeIter) + 'static,
549        >(
550            this: *mut ffi::GtkCellRendererCombo,
551            path_string: *mut std::ffi::c_char,
552            new_iter: *mut ffi::GtkTreeIter,
553            f: glib::ffi::gpointer,
554        ) {
555            let f: &F = &*(f as *const F);
556            let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path_string));
557            f(&from_glib_borrow(this), path, &from_glib_borrow(new_iter))
558        }
559        unsafe {
560            let f: Box_<F> = Box_::new(f);
561            connect_raw(
562                self.as_ptr() as *mut _,
563                b"changed\0".as_ptr() as *const _,
564                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
565                    changed_trampoline::<F> as *const (),
566                )),
567                Box_::into_raw(f),
568            )
569        }
570    }
571
572    #[doc(alias = "has-entry")]
573    pub fn connect_has_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
574        unsafe extern "C" fn notify_has_entry_trampoline<F: Fn(&CellRendererCombo) + 'static>(
575            this: *mut ffi::GtkCellRendererCombo,
576            _param_spec: glib::ffi::gpointer,
577            f: glib::ffi::gpointer,
578        ) {
579            let f: &F = &*(f as *const F);
580            f(&from_glib_borrow(this))
581        }
582        unsafe {
583            let f: Box_<F> = Box_::new(f);
584            connect_raw(
585                self.as_ptr() as *mut _,
586                b"notify::has-entry\0".as_ptr() as *const _,
587                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
588                    notify_has_entry_trampoline::<F> as *const (),
589                )),
590                Box_::into_raw(f),
591            )
592        }
593    }
594
595    #[doc(alias = "model")]
596    pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
597        unsafe extern "C" fn notify_model_trampoline<F: Fn(&CellRendererCombo) + 'static>(
598            this: *mut ffi::GtkCellRendererCombo,
599            _param_spec: glib::ffi::gpointer,
600            f: glib::ffi::gpointer,
601        ) {
602            let f: &F = &*(f as *const F);
603            f(&from_glib_borrow(this))
604        }
605        unsafe {
606            let f: Box_<F> = Box_::new(f);
607            connect_raw(
608                self.as_ptr() as *mut _,
609                b"notify::model\0".as_ptr() as *const _,
610                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
611                    notify_model_trampoline::<F> as *const (),
612                )),
613                Box_::into_raw(f),
614            )
615        }
616    }
617
618    #[doc(alias = "text-column")]
619    pub fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
620        unsafe extern "C" fn notify_text_column_trampoline<F: Fn(&CellRendererCombo) + 'static>(
621            this: *mut ffi::GtkCellRendererCombo,
622            _param_spec: glib::ffi::gpointer,
623            f: glib::ffi::gpointer,
624        ) {
625            let f: &F = &*(f as *const F);
626            f(&from_glib_borrow(this))
627        }
628        unsafe {
629            let f: Box_<F> = Box_::new(f);
630            connect_raw(
631                self.as_ptr() as *mut _,
632                b"notify::text-column\0".as_ptr() as *const _,
633                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
634                    notify_text_column_trampoline::<F> as *const (),
635                )),
636                Box_::into_raw(f),
637            )
638        }
639    }
640}
641
642impl Default for CellRendererCombo {
643    fn default() -> Self {
644        Self::new()
645    }
646}
647
648// rustdoc-stripper-ignore-next
649/// A [builder-pattern] type to construct [`CellRendererCombo`] objects.
650///
651/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
652#[must_use = "The builder must be built to be used"]
653pub struct CellRendererComboBuilder {
654    builder: glib::object::ObjectBuilder<'static, CellRendererCombo>,
655}
656
657impl CellRendererComboBuilder {
658    fn new() -> Self {
659        Self {
660            builder: glib::object::Object::builder(),
661        }
662    }
663
664    /// If [`true`], the cell renderer will include an entry and allow to enter
665    /// values other than the ones in the popup list.
666    pub fn has_entry(self, has_entry: bool) -> Self {
667        Self {
668            builder: self.builder.property("has-entry", has_entry),
669        }
670    }
671
672    /// Holds a tree model containing the possible values for the combo box.
673    /// Use the text_column property to specify the column holding the values.
674    pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
675        Self {
676            builder: self.builder.property("model", model.clone().upcast()),
677        }
678    }
679
680    /// Specifies the model column which holds the possible values for the
681    /// combo box.
682    ///
683    /// Note that this refers to the model specified in the model property,
684    /// not the model backing the tree view to which
685    /// this cell renderer is attached.
686    ///
687    /// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
688    /// this column to its combo box.
689    pub fn text_column(self, text_column: i32) -> Self {
690        Self {
691            builder: self.builder.property("text-column", text_column),
692        }
693    }
694
695    pub fn align_set(self, align_set: bool) -> Self {
696        Self {
697            builder: self.builder.property("align-set", align_set),
698        }
699    }
700
701    /// Specifies how to align the lines of text with respect to each other.
702    ///
703    /// Note that this property describes how to align the lines of text in
704    /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
705    /// on the other hand, sets the horizontal alignment of the whole text.
706    pub fn alignment(self, alignment: pango::Alignment) -> Self {
707        Self {
708            builder: self.builder.property("alignment", alignment),
709        }
710    }
711
712    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
713        Self {
714            builder: self.builder.property("attributes", attributes.clone()),
715        }
716    }
717
718    pub fn background(self, background: impl Into<glib::GString>) -> Self {
719        Self {
720            builder: self.builder.property("background", background.into()),
721        }
722    }
723
724    /// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
725    pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
726        Self {
727            builder: self.builder.property("background-rgba", background_rgba),
728        }
729    }
730
731    pub fn background_set(self, background_set: bool) -> Self {
732        Self {
733            builder: self.builder.property("background-set", background_set),
734        }
735    }
736
737    pub fn editable(self, editable: bool) -> Self {
738        Self {
739            builder: self.builder.property("editable", editable),
740        }
741    }
742
743    pub fn editable_set(self, editable_set: bool) -> Self {
744        Self {
745            builder: self.builder.property("editable-set", editable_set),
746        }
747    }
748
749    /// Specifies the preferred place to ellipsize the string, if the cell renderer
750    /// does not have enough room to display the entire string. Setting it to
751    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
752    /// for another way of making the text fit into a given width.
753    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
754        Self {
755            builder: self.builder.property("ellipsize", ellipsize),
756        }
757    }
758
759    pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
760        Self {
761            builder: self.builder.property("ellipsize-set", ellipsize_set),
762        }
763    }
764
765    pub fn family(self, family: impl Into<glib::GString>) -> Self {
766        Self {
767            builder: self.builder.property("family", family.into()),
768        }
769    }
770
771    pub fn family_set(self, family_set: bool) -> Self {
772        Self {
773            builder: self.builder.property("family-set", family_set),
774        }
775    }
776
777    pub fn font(self, font: impl Into<glib::GString>) -> Self {
778        Self {
779            builder: self.builder.property("font", font.into()),
780        }
781    }
782
783    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
784        Self {
785            builder: self.builder.property("font-desc", font_desc),
786        }
787    }
788
789    pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
790        Self {
791            builder: self.builder.property("foreground", foreground.into()),
792        }
793    }
794
795    /// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
796    pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
797        Self {
798            builder: self.builder.property("foreground-rgba", foreground_rgba),
799        }
800    }
801
802    pub fn foreground_set(self, foreground_set: bool) -> Self {
803        Self {
804            builder: self.builder.property("foreground-set", foreground_set),
805        }
806    }
807
808    pub fn language(self, language: impl Into<glib::GString>) -> Self {
809        Self {
810            builder: self.builder.property("language", language.into()),
811        }
812    }
813
814    pub fn language_set(self, language_set: bool) -> Self {
815        Self {
816            builder: self.builder.property("language-set", language_set),
817        }
818    }
819
820    pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
821        Self {
822            builder: self.builder.property("markup", markup.into()),
823        }
824    }
825
826    /// The desired maximum width of the cell, in characters. If this property
827    /// is set to -1, the width will be calculated automatically.
828    ///
829    /// For cell renderers that ellipsize or wrap text; this property
830    /// controls the maximum reported width of the cell. The
831    /// cell should not receive any greater allocation unless it is
832    /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
833    /// have received their natural width.
834    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
835        Self {
836            builder: self.builder.property("max-width-chars", max_width_chars),
837        }
838    }
839
840    /// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
841    /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
842    pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
843        Self {
844            builder: self
845                .builder
846                .property("placeholder-text", placeholder_text.into()),
847        }
848    }
849
850    pub fn rise(self, rise: i32) -> Self {
851        Self {
852            builder: self.builder.property("rise", rise),
853        }
854    }
855
856    pub fn rise_set(self, rise_set: bool) -> Self {
857        Self {
858            builder: self.builder.property("rise-set", rise_set),
859        }
860    }
861
862    pub fn scale(self, scale: f64) -> Self {
863        Self {
864            builder: self.builder.property("scale", scale),
865        }
866    }
867
868    pub fn scale_set(self, scale_set: bool) -> Self {
869        Self {
870            builder: self.builder.property("scale-set", scale_set),
871        }
872    }
873
874    pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
875        Self {
876            builder: self
877                .builder
878                .property("single-paragraph-mode", single_paragraph_mode),
879        }
880    }
881
882    pub fn size(self, size: i32) -> Self {
883        Self {
884            builder: self.builder.property("size", size),
885        }
886    }
887
888    pub fn size_points(self, size_points: f64) -> Self {
889        Self {
890            builder: self.builder.property("size-points", size_points),
891        }
892    }
893
894    pub fn size_set(self, size_set: bool) -> Self {
895        Self {
896            builder: self.builder.property("size-set", size_set),
897        }
898    }
899
900    pub fn stretch(self, stretch: pango::Stretch) -> Self {
901        Self {
902            builder: self.builder.property("stretch", stretch),
903        }
904    }
905
906    pub fn stretch_set(self, stretch_set: bool) -> Self {
907        Self {
908            builder: self.builder.property("stretch-set", stretch_set),
909        }
910    }
911
912    pub fn strikethrough(self, strikethrough: bool) -> Self {
913        Self {
914            builder: self.builder.property("strikethrough", strikethrough),
915        }
916    }
917
918    pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
919        Self {
920            builder: self
921                .builder
922                .property("strikethrough-set", strikethrough_set),
923        }
924    }
925
926    pub fn style(self, style: pango::Style) -> Self {
927        Self {
928            builder: self.builder.property("style", style),
929        }
930    }
931
932    pub fn style_set(self, style_set: bool) -> Self {
933        Self {
934            builder: self.builder.property("style-set", style_set),
935        }
936    }
937
938    pub fn text(self, text: impl Into<glib::GString>) -> Self {
939        Self {
940            builder: self.builder.property("text", text.into()),
941        }
942    }
943
944    pub fn underline(self, underline: pango::Underline) -> Self {
945        Self {
946            builder: self.builder.property("underline", underline),
947        }
948    }
949
950    pub fn underline_set(self, underline_set: bool) -> Self {
951        Self {
952            builder: self.builder.property("underline-set", underline_set),
953        }
954    }
955
956    pub fn variant(self, variant: pango::Variant) -> Self {
957        Self {
958            builder: self.builder.property("variant", variant),
959        }
960    }
961
962    pub fn variant_set(self, variant_set: bool) -> Self {
963        Self {
964            builder: self.builder.property("variant-set", variant_set),
965        }
966    }
967
968    pub fn weight(self, weight: i32) -> Self {
969        Self {
970            builder: self.builder.property("weight", weight),
971        }
972    }
973
974    pub fn weight_set(self, weight_set: bool) -> Self {
975        Self {
976            builder: self.builder.property("weight-set", weight_set),
977        }
978    }
979
980    /// The desired width of the cell, in characters. If this property is set to
981    /// -1, the width will be calculated automatically, otherwise the cell will
982    /// request either 3 characters or the property value, whichever is greater.
983    pub fn width_chars(self, width_chars: i32) -> Self {
984        Self {
985            builder: self.builder.property("width-chars", width_chars),
986        }
987    }
988
989    /// Specifies how to break the string into multiple lines, if the cell
990    /// renderer does not have enough room to display the entire string.
991    /// This property has no effect unless the wrap-width property is set.
992    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
993        Self {
994            builder: self.builder.property("wrap-mode", wrap_mode),
995        }
996    }
997
998    /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
999    /// be used to influence at what character positions the line breaks can be placed.
1000    /// Setting wrap-width to -1 turns wrapping off.
1001    pub fn wrap_width(self, wrap_width: i32) -> Self {
1002        Self {
1003            builder: self.builder.property("wrap-width", wrap_width),
1004        }
1005    }
1006
1007    pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
1008        Self {
1009            builder: self
1010                .builder
1011                .property("cell-background", cell_background.into()),
1012        }
1013    }
1014
1015    /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
1016    pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
1017        Self {
1018            builder: self
1019                .builder
1020                .property("cell-background-rgba", cell_background_rgba),
1021        }
1022    }
1023
1024    pub fn cell_background_set(self, cell_background_set: bool) -> Self {
1025        Self {
1026            builder: self
1027                .builder
1028                .property("cell-background-set", cell_background_set),
1029        }
1030    }
1031
1032    pub fn height(self, height: i32) -> Self {
1033        Self {
1034            builder: self.builder.property("height", height),
1035        }
1036    }
1037
1038    pub fn is_expanded(self, is_expanded: bool) -> Self {
1039        Self {
1040            builder: self.builder.property("is-expanded", is_expanded),
1041        }
1042    }
1043
1044    pub fn is_expander(self, is_expander: bool) -> Self {
1045        Self {
1046            builder: self.builder.property("is-expander", is_expander),
1047        }
1048    }
1049
1050    pub fn mode(self, mode: CellRendererMode) -> Self {
1051        Self {
1052            builder: self.builder.property("mode", mode),
1053        }
1054    }
1055
1056    pub fn sensitive(self, sensitive: bool) -> Self {
1057        Self {
1058            builder: self.builder.property("sensitive", sensitive),
1059        }
1060    }
1061
1062    pub fn visible(self, visible: bool) -> Self {
1063        Self {
1064            builder: self.builder.property("visible", visible),
1065        }
1066    }
1067
1068    pub fn width(self, width: i32) -> Self {
1069        Self {
1070            builder: self.builder.property("width", width),
1071        }
1072    }
1073
1074    pub fn xalign(self, xalign: f32) -> Self {
1075        Self {
1076            builder: self.builder.property("xalign", xalign),
1077        }
1078    }
1079
1080    pub fn xpad(self, xpad: u32) -> Self {
1081        Self {
1082            builder: self.builder.property("xpad", xpad),
1083        }
1084    }
1085
1086    pub fn yalign(self, yalign: f32) -> Self {
1087        Self {
1088            builder: self.builder.property("yalign", yalign),
1089        }
1090    }
1091
1092    pub fn ypad(self, ypad: u32) -> Self {
1093        Self {
1094            builder: self.builder.property("ypad", ypad),
1095        }
1096    }
1097
1098    // rustdoc-stripper-ignore-next
1099    /// Build the [`CellRendererCombo`].
1100    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1101    pub fn build(self) -> CellRendererCombo {
1102        assert_initialized_main_thread!();
1103        self.builder.build()
1104    }
1105}