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::{CellRenderer, CellRendererMode, CellRendererText, TreeIter, TreeModel, TreePath, ffi};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
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 unsafe {
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 }
560 unsafe {
561 let f: Box_<F> = Box_::new(f);
562 connect_raw(
563 self.as_ptr() as *mut _,
564 c"changed".as_ptr() as *const _,
565 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
566 changed_trampoline::<F> as *const (),
567 )),
568 Box_::into_raw(f),
569 )
570 }
571 }
572
573 #[doc(alias = "has-entry")]
574 pub fn connect_has_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
575 unsafe extern "C" fn notify_has_entry_trampoline<F: Fn(&CellRendererCombo) + 'static>(
576 this: *mut ffi::GtkCellRendererCombo,
577 _param_spec: glib::ffi::gpointer,
578 f: glib::ffi::gpointer,
579 ) {
580 unsafe {
581 let f: &F = &*(f as *const F);
582 f(&from_glib_borrow(this))
583 }
584 }
585 unsafe {
586 let f: Box_<F> = Box_::new(f);
587 connect_raw(
588 self.as_ptr() as *mut _,
589 c"notify::has-entry".as_ptr() as *const _,
590 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
591 notify_has_entry_trampoline::<F> as *const (),
592 )),
593 Box_::into_raw(f),
594 )
595 }
596 }
597
598 #[doc(alias = "model")]
599 pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
600 unsafe extern "C" fn notify_model_trampoline<F: Fn(&CellRendererCombo) + 'static>(
601 this: *mut ffi::GtkCellRendererCombo,
602 _param_spec: glib::ffi::gpointer,
603 f: glib::ffi::gpointer,
604 ) {
605 unsafe {
606 let f: &F = &*(f as *const F);
607 f(&from_glib_borrow(this))
608 }
609 }
610 unsafe {
611 let f: Box_<F> = Box_::new(f);
612 connect_raw(
613 self.as_ptr() as *mut _,
614 c"notify::model".as_ptr() as *const _,
615 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
616 notify_model_trampoline::<F> as *const (),
617 )),
618 Box_::into_raw(f),
619 )
620 }
621 }
622
623 #[doc(alias = "text-column")]
624 pub fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
625 unsafe extern "C" fn notify_text_column_trampoline<F: Fn(&CellRendererCombo) + 'static>(
626 this: *mut ffi::GtkCellRendererCombo,
627 _param_spec: glib::ffi::gpointer,
628 f: glib::ffi::gpointer,
629 ) {
630 unsafe {
631 let f: &F = &*(f as *const F);
632 f(&from_glib_borrow(this))
633 }
634 }
635 unsafe {
636 let f: Box_<F> = Box_::new(f);
637 connect_raw(
638 self.as_ptr() as *mut _,
639 c"notify::text-column".as_ptr() as *const _,
640 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
641 notify_text_column_trampoline::<F> as *const (),
642 )),
643 Box_::into_raw(f),
644 )
645 }
646 }
647}
648
649impl Default for CellRendererCombo {
650 fn default() -> Self {
651 Self::new()
652 }
653}
654
655// rustdoc-stripper-ignore-next
656/// A [builder-pattern] type to construct [`CellRendererCombo`] objects.
657///
658/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
659#[must_use = "The builder must be built to be used"]
660pub struct CellRendererComboBuilder {
661 builder: glib::object::ObjectBuilder<'static, CellRendererCombo>,
662}
663
664impl CellRendererComboBuilder {
665 fn new() -> Self {
666 Self {
667 builder: glib::object::Object::builder(),
668 }
669 }
670
671 /// If [`true`], the cell renderer will include an entry and allow to enter
672 /// values other than the ones in the popup list.
673 pub fn has_entry(self, has_entry: bool) -> Self {
674 Self {
675 builder: self.builder.property("has-entry", has_entry),
676 }
677 }
678
679 /// Holds a tree model containing the possible values for the combo box.
680 /// Use the text_column property to specify the column holding the values.
681 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
682 Self {
683 builder: self.builder.property("model", model.clone().upcast()),
684 }
685 }
686
687 /// Specifies the model column which holds the possible values for the
688 /// combo box.
689 ///
690 /// Note that this refers to the model specified in the model property,
691 /// not the model backing the tree view to which
692 /// this cell renderer is attached.
693 ///
694 /// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
695 /// this column to its combo box.
696 pub fn text_column(self, text_column: i32) -> Self {
697 Self {
698 builder: self.builder.property("text-column", text_column),
699 }
700 }
701
702 pub fn align_set(self, align_set: bool) -> Self {
703 Self {
704 builder: self.builder.property("align-set", align_set),
705 }
706 }
707
708 /// Specifies how to align the lines of text with respect to each other.
709 ///
710 /// Note that this property describes how to align the lines of text in
711 /// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
712 /// on the other hand, sets the horizontal alignment of the whole text.
713 pub fn alignment(self, alignment: pango::Alignment) -> Self {
714 Self {
715 builder: self.builder.property("alignment", alignment),
716 }
717 }
718
719 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
720 Self {
721 builder: self.builder.property("attributes", attributes.clone()),
722 }
723 }
724
725 pub fn background(self, background: impl Into<glib::GString>) -> Self {
726 Self {
727 builder: self.builder.property("background", background.into()),
728 }
729 }
730
731 /// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
732 pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
733 Self {
734 builder: self.builder.property("background-rgba", background_rgba),
735 }
736 }
737
738 pub fn background_set(self, background_set: bool) -> Self {
739 Self {
740 builder: self.builder.property("background-set", background_set),
741 }
742 }
743
744 pub fn editable(self, editable: bool) -> Self {
745 Self {
746 builder: self.builder.property("editable", editable),
747 }
748 }
749
750 pub fn editable_set(self, editable_set: bool) -> Self {
751 Self {
752 builder: self.builder.property("editable-set", editable_set),
753 }
754 }
755
756 /// Specifies the preferred place to ellipsize the string, if the cell renderer
757 /// does not have enough room to display the entire string. Setting it to
758 /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
759 /// for another way of making the text fit into a given width.
760 pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
761 Self {
762 builder: self.builder.property("ellipsize", ellipsize),
763 }
764 }
765
766 pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
767 Self {
768 builder: self.builder.property("ellipsize-set", ellipsize_set),
769 }
770 }
771
772 pub fn family(self, family: impl Into<glib::GString>) -> Self {
773 Self {
774 builder: self.builder.property("family", family.into()),
775 }
776 }
777
778 pub fn family_set(self, family_set: bool) -> Self {
779 Self {
780 builder: self.builder.property("family-set", family_set),
781 }
782 }
783
784 pub fn font(self, font: impl Into<glib::GString>) -> Self {
785 Self {
786 builder: self.builder.property("font", font.into()),
787 }
788 }
789
790 pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
791 Self {
792 builder: self.builder.property("font-desc", font_desc),
793 }
794 }
795
796 pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
797 Self {
798 builder: self.builder.property("foreground", foreground.into()),
799 }
800 }
801
802 /// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
803 pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
804 Self {
805 builder: self.builder.property("foreground-rgba", foreground_rgba),
806 }
807 }
808
809 pub fn foreground_set(self, foreground_set: bool) -> Self {
810 Self {
811 builder: self.builder.property("foreground-set", foreground_set),
812 }
813 }
814
815 pub fn language(self, language: impl Into<glib::GString>) -> Self {
816 Self {
817 builder: self.builder.property("language", language.into()),
818 }
819 }
820
821 pub fn language_set(self, language_set: bool) -> Self {
822 Self {
823 builder: self.builder.property("language-set", language_set),
824 }
825 }
826
827 pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
828 Self {
829 builder: self.builder.property("markup", markup.into()),
830 }
831 }
832
833 /// The desired maximum width of the cell, in characters. If this property
834 /// is set to -1, the width will be calculated automatically.
835 ///
836 /// For cell renderers that ellipsize or wrap text; this property
837 /// controls the maximum reported width of the cell. The
838 /// cell should not receive any greater allocation unless it is
839 /// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
840 /// have received their natural width.
841 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
842 Self {
843 builder: self.builder.property("max-width-chars", max_width_chars),
844 }
845 }
846
847 /// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
848 /// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
849 pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
850 Self {
851 builder: self
852 .builder
853 .property("placeholder-text", placeholder_text.into()),
854 }
855 }
856
857 pub fn rise(self, rise: i32) -> Self {
858 Self {
859 builder: self.builder.property("rise", rise),
860 }
861 }
862
863 pub fn rise_set(self, rise_set: bool) -> Self {
864 Self {
865 builder: self.builder.property("rise-set", rise_set),
866 }
867 }
868
869 pub fn scale(self, scale: f64) -> Self {
870 Self {
871 builder: self.builder.property("scale", scale),
872 }
873 }
874
875 pub fn scale_set(self, scale_set: bool) -> Self {
876 Self {
877 builder: self.builder.property("scale-set", scale_set),
878 }
879 }
880
881 pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
882 Self {
883 builder: self
884 .builder
885 .property("single-paragraph-mode", single_paragraph_mode),
886 }
887 }
888
889 pub fn size(self, size: i32) -> Self {
890 Self {
891 builder: self.builder.property("size", size),
892 }
893 }
894
895 pub fn size_points(self, size_points: f64) -> Self {
896 Self {
897 builder: self.builder.property("size-points", size_points),
898 }
899 }
900
901 pub fn size_set(self, size_set: bool) -> Self {
902 Self {
903 builder: self.builder.property("size-set", size_set),
904 }
905 }
906
907 pub fn stretch(self, stretch: pango::Stretch) -> Self {
908 Self {
909 builder: self.builder.property("stretch", stretch),
910 }
911 }
912
913 pub fn stretch_set(self, stretch_set: bool) -> Self {
914 Self {
915 builder: self.builder.property("stretch-set", stretch_set),
916 }
917 }
918
919 pub fn strikethrough(self, strikethrough: bool) -> Self {
920 Self {
921 builder: self.builder.property("strikethrough", strikethrough),
922 }
923 }
924
925 pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
926 Self {
927 builder: self
928 .builder
929 .property("strikethrough-set", strikethrough_set),
930 }
931 }
932
933 pub fn style(self, style: pango::Style) -> Self {
934 Self {
935 builder: self.builder.property("style", style),
936 }
937 }
938
939 pub fn style_set(self, style_set: bool) -> Self {
940 Self {
941 builder: self.builder.property("style-set", style_set),
942 }
943 }
944
945 pub fn text(self, text: impl Into<glib::GString>) -> Self {
946 Self {
947 builder: self.builder.property("text", text.into()),
948 }
949 }
950
951 pub fn underline(self, underline: pango::Underline) -> Self {
952 Self {
953 builder: self.builder.property("underline", underline),
954 }
955 }
956
957 pub fn underline_set(self, underline_set: bool) -> Self {
958 Self {
959 builder: self.builder.property("underline-set", underline_set),
960 }
961 }
962
963 pub fn variant(self, variant: pango::Variant) -> Self {
964 Self {
965 builder: self.builder.property("variant", variant),
966 }
967 }
968
969 pub fn variant_set(self, variant_set: bool) -> Self {
970 Self {
971 builder: self.builder.property("variant-set", variant_set),
972 }
973 }
974
975 pub fn weight(self, weight: i32) -> Self {
976 Self {
977 builder: self.builder.property("weight", weight),
978 }
979 }
980
981 pub fn weight_set(self, weight_set: bool) -> Self {
982 Self {
983 builder: self.builder.property("weight-set", weight_set),
984 }
985 }
986
987 /// The desired width of the cell, in characters. If this property is set to
988 /// -1, the width will be calculated automatically, otherwise the cell will
989 /// request either 3 characters or the property value, whichever is greater.
990 pub fn width_chars(self, width_chars: i32) -> Self {
991 Self {
992 builder: self.builder.property("width-chars", width_chars),
993 }
994 }
995
996 /// Specifies how to break the string into multiple lines, if the cell
997 /// renderer does not have enough room to display the entire string.
998 /// This property has no effect unless the wrap-width property is set.
999 pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1000 Self {
1001 builder: self.builder.property("wrap-mode", wrap_mode),
1002 }
1003 }
1004
1005 /// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
1006 /// be used to influence at what character positions the line breaks can be placed.
1007 /// Setting wrap-width to -1 turns wrapping off.
1008 pub fn wrap_width(self, wrap_width: i32) -> Self {
1009 Self {
1010 builder: self.builder.property("wrap-width", wrap_width),
1011 }
1012 }
1013
1014 pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
1015 Self {
1016 builder: self
1017 .builder
1018 .property("cell-background", cell_background.into()),
1019 }
1020 }
1021
1022 /// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
1023 pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
1024 Self {
1025 builder: self
1026 .builder
1027 .property("cell-background-rgba", cell_background_rgba),
1028 }
1029 }
1030
1031 pub fn cell_background_set(self, cell_background_set: bool) -> Self {
1032 Self {
1033 builder: self
1034 .builder
1035 .property("cell-background-set", cell_background_set),
1036 }
1037 }
1038
1039 pub fn height(self, height: i32) -> Self {
1040 Self {
1041 builder: self.builder.property("height", height),
1042 }
1043 }
1044
1045 pub fn is_expanded(self, is_expanded: bool) -> Self {
1046 Self {
1047 builder: self.builder.property("is-expanded", is_expanded),
1048 }
1049 }
1050
1051 pub fn is_expander(self, is_expander: bool) -> Self {
1052 Self {
1053 builder: self.builder.property("is-expander", is_expander),
1054 }
1055 }
1056
1057 pub fn mode(self, mode: CellRendererMode) -> Self {
1058 Self {
1059 builder: self.builder.property("mode", mode),
1060 }
1061 }
1062
1063 pub fn sensitive(self, sensitive: bool) -> Self {
1064 Self {
1065 builder: self.builder.property("sensitive", sensitive),
1066 }
1067 }
1068
1069 pub fn visible(self, visible: bool) -> Self {
1070 Self {
1071 builder: self.builder.property("visible", visible),
1072 }
1073 }
1074
1075 pub fn width(self, width: i32) -> Self {
1076 Self {
1077 builder: self.builder.property("width", width),
1078 }
1079 }
1080
1081 pub fn xalign(self, xalign: f32) -> Self {
1082 Self {
1083 builder: self.builder.property("xalign", xalign),
1084 }
1085 }
1086
1087 pub fn xpad(self, xpad: u32) -> Self {
1088 Self {
1089 builder: self.builder.property("xpad", xpad),
1090 }
1091 }
1092
1093 pub fn yalign(self, yalign: f32) -> Self {
1094 Self {
1095 builder: self.builder.property("yalign", yalign),
1096 }
1097 }
1098
1099 pub fn ypad(self, ypad: u32) -> Self {
1100 Self {
1101 builder: self.builder.property("ypad", ypad),
1102 }
1103 }
1104
1105 // rustdoc-stripper-ignore-next
1106 /// Build the [`CellRendererCombo`].
1107 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1108 pub fn build(self) -> CellRendererCombo {
1109 assert_initialized_main_thread!();
1110 self.builder.build()
1111 }
1112}