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