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