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