Skip to main content

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