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