1use crate::ffi;
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "AdwSplitButton")]
17 pub struct SplitButton(Object<ffi::AdwSplitButton, ffi::AdwSplitButtonClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable;
18
19 match fn {
20 type_ => || ffi::adw_split_button_get_type(),
21 }
22}
23
24impl SplitButton {
25 #[doc(alias = "adw_split_button_new")]
26 pub fn new() -> SplitButton {
27 assert_initialized_main_thread!();
28 unsafe { gtk::Widget::from_glib_none(ffi::adw_split_button_new()).unsafe_cast() }
29 }
30
31 pub fn builder() -> SplitButtonBuilder {
36 SplitButtonBuilder::new()
37 }
38
39 #[cfg(feature = "v1_4")]
40 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
41 #[doc(alias = "adw_split_button_get_can_shrink")]
42 #[doc(alias = "get_can_shrink")]
43 #[doc(alias = "can-shrink")]
44 pub fn can_shrink(&self) -> bool {
45 unsafe { from_glib(ffi::adw_split_button_get_can_shrink(self.to_glib_none().0)) }
46 }
47
48 #[doc(alias = "adw_split_button_get_child")]
49 #[doc(alias = "get_child")]
50 pub fn child(&self) -> Option<gtk::Widget> {
51 unsafe { from_glib_none(ffi::adw_split_button_get_child(self.to_glib_none().0)) }
52 }
53
54 #[doc(alias = "adw_split_button_get_direction")]
55 #[doc(alias = "get_direction")]
56 pub fn direction(&self) -> gtk::ArrowType {
57 unsafe { from_glib(ffi::adw_split_button_get_direction(self.to_glib_none().0)) }
58 }
59
60 #[cfg(feature = "v1_2")]
61 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
62 #[doc(alias = "adw_split_button_get_dropdown_tooltip")]
63 #[doc(alias = "get_dropdown_tooltip")]
64 #[doc(alias = "dropdown-tooltip")]
65 pub fn dropdown_tooltip(&self) -> glib::GString {
66 unsafe {
67 from_glib_none(ffi::adw_split_button_get_dropdown_tooltip(
68 self.to_glib_none().0,
69 ))
70 }
71 }
72
73 #[doc(alias = "adw_split_button_get_icon_name")]
74 #[doc(alias = "get_icon_name")]
75 #[doc(alias = "icon-name")]
76 pub fn icon_name(&self) -> Option<glib::GString> {
77 unsafe { from_glib_none(ffi::adw_split_button_get_icon_name(self.to_glib_none().0)) }
78 }
79
80 #[doc(alias = "adw_split_button_get_label")]
81 #[doc(alias = "get_label")]
82 pub fn label(&self) -> Option<glib::GString> {
83 unsafe { from_glib_none(ffi::adw_split_button_get_label(self.to_glib_none().0)) }
84 }
85
86 #[doc(alias = "adw_split_button_get_menu_model")]
87 #[doc(alias = "get_menu_model")]
88 #[doc(alias = "menu-model")]
89 pub fn menu_model(&self) -> Option<gio::MenuModel> {
90 unsafe { from_glib_none(ffi::adw_split_button_get_menu_model(self.to_glib_none().0)) }
91 }
92
93 #[doc(alias = "adw_split_button_get_popover")]
94 #[doc(alias = "get_popover")]
95 pub fn popover(&self) -> Option<gtk::Popover> {
96 unsafe { from_glib_none(ffi::adw_split_button_get_popover(self.to_glib_none().0)) }
97 }
98
99 #[doc(alias = "adw_split_button_get_use_underline")]
100 #[doc(alias = "get_use_underline")]
101 #[doc(alias = "use-underline")]
102 pub fn uses_underline(&self) -> bool {
103 unsafe {
104 from_glib(ffi::adw_split_button_get_use_underline(
105 self.to_glib_none().0,
106 ))
107 }
108 }
109
110 #[doc(alias = "adw_split_button_popdown")]
111 pub fn popdown(&self) {
112 unsafe {
113 ffi::adw_split_button_popdown(self.to_glib_none().0);
114 }
115 }
116
117 #[doc(alias = "adw_split_button_popup")]
118 pub fn popup(&self) {
119 unsafe {
120 ffi::adw_split_button_popup(self.to_glib_none().0);
121 }
122 }
123
124 #[cfg(feature = "v1_4")]
125 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
126 #[doc(alias = "adw_split_button_set_can_shrink")]
127 #[doc(alias = "can-shrink")]
128 pub fn set_can_shrink(&self, can_shrink: bool) {
129 unsafe {
130 ffi::adw_split_button_set_can_shrink(self.to_glib_none().0, can_shrink.into_glib());
131 }
132 }
133
134 #[doc(alias = "adw_split_button_set_child")]
135 #[doc(alias = "child")]
136 pub fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
137 unsafe {
138 ffi::adw_split_button_set_child(
139 self.to_glib_none().0,
140 child.map(|p| p.as_ref()).to_glib_none().0,
141 );
142 }
143 }
144
145 #[doc(alias = "adw_split_button_set_direction")]
146 #[doc(alias = "direction")]
147 pub fn set_direction(&self, direction: gtk::ArrowType) {
148 unsafe {
149 ffi::adw_split_button_set_direction(self.to_glib_none().0, direction.into_glib());
150 }
151 }
152
153 #[cfg(feature = "v1_2")]
154 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
155 #[doc(alias = "adw_split_button_set_dropdown_tooltip")]
156 #[doc(alias = "dropdown-tooltip")]
157 pub fn set_dropdown_tooltip(&self, tooltip: &str) {
158 unsafe {
159 ffi::adw_split_button_set_dropdown_tooltip(
160 self.to_glib_none().0,
161 tooltip.to_glib_none().0,
162 );
163 }
164 }
165
166 #[doc(alias = "adw_split_button_set_icon_name")]
167 #[doc(alias = "icon-name")]
168 pub fn set_icon_name(&self, icon_name: &str) {
169 unsafe {
170 ffi::adw_split_button_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
171 }
172 }
173
174 #[doc(alias = "adw_split_button_set_label")]
175 #[doc(alias = "label")]
176 pub fn set_label(&self, label: &str) {
177 unsafe {
178 ffi::adw_split_button_set_label(self.to_glib_none().0, label.to_glib_none().0);
179 }
180 }
181
182 #[doc(alias = "adw_split_button_set_menu_model")]
183 #[doc(alias = "menu-model")]
184 pub fn set_menu_model(&self, menu_model: Option<&impl IsA<gio::MenuModel>>) {
185 unsafe {
186 ffi::adw_split_button_set_menu_model(
187 self.to_glib_none().0,
188 menu_model.map(|p| p.as_ref()).to_glib_none().0,
189 );
190 }
191 }
192
193 #[doc(alias = "adw_split_button_set_popover")]
194 #[doc(alias = "popover")]
195 pub fn set_popover(&self, popover: Option<&impl IsA<gtk::Popover>>) {
196 unsafe {
197 ffi::adw_split_button_set_popover(
198 self.to_glib_none().0,
199 popover.map(|p| p.as_ref()).to_glib_none().0,
200 );
201 }
202 }
203
204 #[doc(alias = "adw_split_button_set_use_underline")]
205 #[doc(alias = "use-underline")]
206 pub fn set_use_underline(&self, use_underline: bool) {
207 unsafe {
208 ffi::adw_split_button_set_use_underline(
209 self.to_glib_none().0,
210 use_underline.into_glib(),
211 );
212 }
213 }
214
215 #[doc(alias = "activate")]
216 pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
217 unsafe extern "C" fn activate_trampoline<F: Fn(&SplitButton) + 'static>(
218 this: *mut ffi::AdwSplitButton,
219 f: glib::ffi::gpointer,
220 ) {
221 unsafe {
222 let f: &F = &*(f as *const F);
223 f(&from_glib_borrow(this))
224 }
225 }
226 unsafe {
227 let f: Box_<F> = Box_::new(f);
228 connect_raw(
229 self.as_ptr() as *mut _,
230 c"activate".as_ptr(),
231 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
232 activate_trampoline::<F> as *const (),
233 )),
234 Box_::into_raw(f),
235 )
236 }
237 }
238
239 pub fn emit_activate(&self) {
240 self.emit_by_name::<()>("activate", &[]);
241 }
242
243 #[doc(alias = "clicked")]
244 pub fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
245 unsafe extern "C" fn clicked_trampoline<F: Fn(&SplitButton) + 'static>(
246 this: *mut ffi::AdwSplitButton,
247 f: glib::ffi::gpointer,
248 ) {
249 unsafe {
250 let f: &F = &*(f as *const F);
251 f(&from_glib_borrow(this))
252 }
253 }
254 unsafe {
255 let f: Box_<F> = Box_::new(f);
256 connect_raw(
257 self.as_ptr() as *mut _,
258 c"clicked".as_ptr(),
259 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
260 clicked_trampoline::<F> as *const (),
261 )),
262 Box_::into_raw(f),
263 )
264 }
265 }
266
267 pub fn emit_clicked(&self) {
268 self.emit_by_name::<()>("clicked", &[]);
269 }
270
271 #[cfg(feature = "v1_4")]
272 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
273 #[doc(alias = "can-shrink")]
274 pub fn connect_can_shrink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
275 unsafe extern "C" fn notify_can_shrink_trampoline<F: Fn(&SplitButton) + 'static>(
276 this: *mut ffi::AdwSplitButton,
277 _param_spec: glib::ffi::gpointer,
278 f: glib::ffi::gpointer,
279 ) {
280 unsafe {
281 let f: &F = &*(f as *const F);
282 f(&from_glib_borrow(this))
283 }
284 }
285 unsafe {
286 let f: Box_<F> = Box_::new(f);
287 connect_raw(
288 self.as_ptr() as *mut _,
289 c"notify::can-shrink".as_ptr(),
290 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
291 notify_can_shrink_trampoline::<F> as *const (),
292 )),
293 Box_::into_raw(f),
294 )
295 }
296 }
297
298 #[doc(alias = "child")]
299 pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
300 unsafe extern "C" fn notify_child_trampoline<F: Fn(&SplitButton) + 'static>(
301 this: *mut ffi::AdwSplitButton,
302 _param_spec: glib::ffi::gpointer,
303 f: glib::ffi::gpointer,
304 ) {
305 unsafe {
306 let f: &F = &*(f as *const F);
307 f(&from_glib_borrow(this))
308 }
309 }
310 unsafe {
311 let f: Box_<F> = Box_::new(f);
312 connect_raw(
313 self.as_ptr() as *mut _,
314 c"notify::child".as_ptr(),
315 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
316 notify_child_trampoline::<F> as *const (),
317 )),
318 Box_::into_raw(f),
319 )
320 }
321 }
322
323 #[doc(alias = "direction")]
324 pub fn connect_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
325 unsafe extern "C" fn notify_direction_trampoline<F: Fn(&SplitButton) + 'static>(
326 this: *mut ffi::AdwSplitButton,
327 _param_spec: glib::ffi::gpointer,
328 f: glib::ffi::gpointer,
329 ) {
330 unsafe {
331 let f: &F = &*(f as *const F);
332 f(&from_glib_borrow(this))
333 }
334 }
335 unsafe {
336 let f: Box_<F> = Box_::new(f);
337 connect_raw(
338 self.as_ptr() as *mut _,
339 c"notify::direction".as_ptr(),
340 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
341 notify_direction_trampoline::<F> as *const (),
342 )),
343 Box_::into_raw(f),
344 )
345 }
346 }
347
348 #[cfg(feature = "v1_2")]
349 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
350 #[doc(alias = "dropdown-tooltip")]
351 pub fn connect_dropdown_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
352 unsafe extern "C" fn notify_dropdown_tooltip_trampoline<F: Fn(&SplitButton) + 'static>(
353 this: *mut ffi::AdwSplitButton,
354 _param_spec: glib::ffi::gpointer,
355 f: glib::ffi::gpointer,
356 ) {
357 unsafe {
358 let f: &F = &*(f as *const F);
359 f(&from_glib_borrow(this))
360 }
361 }
362 unsafe {
363 let f: Box_<F> = Box_::new(f);
364 connect_raw(
365 self.as_ptr() as *mut _,
366 c"notify::dropdown-tooltip".as_ptr(),
367 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
368 notify_dropdown_tooltip_trampoline::<F> as *const (),
369 )),
370 Box_::into_raw(f),
371 )
372 }
373 }
374
375 #[doc(alias = "icon-name")]
376 pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
377 unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&SplitButton) + 'static>(
378 this: *mut ffi::AdwSplitButton,
379 _param_spec: glib::ffi::gpointer,
380 f: glib::ffi::gpointer,
381 ) {
382 unsafe {
383 let f: &F = &*(f as *const F);
384 f(&from_glib_borrow(this))
385 }
386 }
387 unsafe {
388 let f: Box_<F> = Box_::new(f);
389 connect_raw(
390 self.as_ptr() as *mut _,
391 c"notify::icon-name".as_ptr(),
392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
393 notify_icon_name_trampoline::<F> as *const (),
394 )),
395 Box_::into_raw(f),
396 )
397 }
398 }
399
400 #[doc(alias = "label")]
401 pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
402 unsafe extern "C" fn notify_label_trampoline<F: Fn(&SplitButton) + 'static>(
403 this: *mut ffi::AdwSplitButton,
404 _param_spec: glib::ffi::gpointer,
405 f: glib::ffi::gpointer,
406 ) {
407 unsafe {
408 let f: &F = &*(f as *const F);
409 f(&from_glib_borrow(this))
410 }
411 }
412 unsafe {
413 let f: Box_<F> = Box_::new(f);
414 connect_raw(
415 self.as_ptr() as *mut _,
416 c"notify::label".as_ptr(),
417 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
418 notify_label_trampoline::<F> as *const (),
419 )),
420 Box_::into_raw(f),
421 )
422 }
423 }
424
425 #[doc(alias = "menu-model")]
426 pub fn connect_menu_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
427 unsafe extern "C" fn notify_menu_model_trampoline<F: Fn(&SplitButton) + 'static>(
428 this: *mut ffi::AdwSplitButton,
429 _param_spec: glib::ffi::gpointer,
430 f: glib::ffi::gpointer,
431 ) {
432 unsafe {
433 let f: &F = &*(f as *const F);
434 f(&from_glib_borrow(this))
435 }
436 }
437 unsafe {
438 let f: Box_<F> = Box_::new(f);
439 connect_raw(
440 self.as_ptr() as *mut _,
441 c"notify::menu-model".as_ptr(),
442 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
443 notify_menu_model_trampoline::<F> as *const (),
444 )),
445 Box_::into_raw(f),
446 )
447 }
448 }
449
450 #[doc(alias = "popover")]
451 pub fn connect_popover_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
452 unsafe extern "C" fn notify_popover_trampoline<F: Fn(&SplitButton) + 'static>(
453 this: *mut ffi::AdwSplitButton,
454 _param_spec: glib::ffi::gpointer,
455 f: glib::ffi::gpointer,
456 ) {
457 unsafe {
458 let f: &F = &*(f as *const F);
459 f(&from_glib_borrow(this))
460 }
461 }
462 unsafe {
463 let f: Box_<F> = Box_::new(f);
464 connect_raw(
465 self.as_ptr() as *mut _,
466 c"notify::popover".as_ptr(),
467 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
468 notify_popover_trampoline::<F> as *const (),
469 )),
470 Box_::into_raw(f),
471 )
472 }
473 }
474
475 #[doc(alias = "use-underline")]
476 pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
477 unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&SplitButton) + 'static>(
478 this: *mut ffi::AdwSplitButton,
479 _param_spec: glib::ffi::gpointer,
480 f: glib::ffi::gpointer,
481 ) {
482 unsafe {
483 let f: &F = &*(f as *const F);
484 f(&from_glib_borrow(this))
485 }
486 }
487 unsafe {
488 let f: Box_<F> = Box_::new(f);
489 connect_raw(
490 self.as_ptr() as *mut _,
491 c"notify::use-underline".as_ptr(),
492 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
493 notify_use_underline_trampoline::<F> as *const (),
494 )),
495 Box_::into_raw(f),
496 )
497 }
498 }
499}
500
501impl Default for SplitButton {
502 fn default() -> Self {
503 Self::new()
504 }
505}
506
507#[must_use = "The builder must be built to be used"]
512pub struct SplitButtonBuilder {
513 builder: glib::object::ObjectBuilder<'static, SplitButton>,
514}
515
516impl SplitButtonBuilder {
517 fn new() -> Self {
518 Self {
519 builder: glib::object::Object::builder(),
520 }
521 }
522
523 #[cfg(feature = "v1_4")]
524 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
525 pub fn can_shrink(self, can_shrink: bool) -> Self {
526 Self {
527 builder: self.builder.property("can-shrink", can_shrink),
528 }
529 }
530
531 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
532 Self {
533 builder: self.builder.property("child", child.clone().upcast()),
534 }
535 }
536
537 pub fn direction(self, direction: gtk::ArrowType) -> Self {
538 Self {
539 builder: self.builder.property("direction", direction),
540 }
541 }
542
543 #[cfg(feature = "v1_2")]
544 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
545 pub fn dropdown_tooltip(self, dropdown_tooltip: impl Into<glib::GString>) -> Self {
546 Self {
547 builder: self
548 .builder
549 .property("dropdown-tooltip", dropdown_tooltip.into()),
550 }
551 }
552
553 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
554 Self {
555 builder: self.builder.property("icon-name", icon_name.into()),
556 }
557 }
558
559 pub fn label(self, label: impl Into<glib::GString>) -> Self {
560 Self {
561 builder: self.builder.property("label", label.into()),
562 }
563 }
564
565 pub fn menu_model(self, menu_model: &impl IsA<gio::MenuModel>) -> Self {
566 Self {
567 builder: self
568 .builder
569 .property("menu-model", menu_model.clone().upcast()),
570 }
571 }
572
573 pub fn popover(self, popover: &impl IsA<gtk::Popover>) -> Self {
574 Self {
575 builder: self.builder.property("popover", popover.clone().upcast()),
576 }
577 }
578
579 pub fn use_underline(self, use_underline: bool) -> Self {
580 Self {
581 builder: self.builder.property("use-underline", use_underline),
582 }
583 }
584
585 pub fn can_focus(self, can_focus: bool) -> Self {
586 Self {
587 builder: self.builder.property("can-focus", can_focus),
588 }
589 }
590
591 pub fn can_target(self, can_target: bool) -> Self {
592 Self {
593 builder: self.builder.property("can-target", can_target),
594 }
595 }
596
597 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
598 Self {
599 builder: self.builder.property("css-classes", css_classes.into()),
600 }
601 }
602
603 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
604 Self {
605 builder: self.builder.property("css-name", css_name.into()),
606 }
607 }
608
609 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
610 Self {
611 builder: self.builder.property("cursor", cursor.clone()),
612 }
613 }
614
615 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
616 Self {
617 builder: self.builder.property("focus-on-click", focus_on_click),
618 }
619 }
620
621 pub fn focusable(self, focusable: bool) -> Self {
622 Self {
623 builder: self.builder.property("focusable", focusable),
624 }
625 }
626
627 pub fn halign(self, halign: gtk::Align) -> Self {
628 Self {
629 builder: self.builder.property("halign", halign),
630 }
631 }
632
633 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
634 Self {
635 builder: self.builder.property("has-tooltip", has_tooltip),
636 }
637 }
638
639 pub fn height_request(self, height_request: i32) -> Self {
640 Self {
641 builder: self.builder.property("height-request", height_request),
642 }
643 }
644
645 pub fn hexpand(self, hexpand: bool) -> Self {
646 Self {
647 builder: self.builder.property("hexpand", hexpand),
648 }
649 }
650
651 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
652 Self {
653 builder: self.builder.property("hexpand-set", hexpand_set),
654 }
655 }
656
657 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
658 Self {
659 builder: self
660 .builder
661 .property("layout-manager", layout_manager.clone().upcast()),
662 }
663 }
664
665 #[cfg(feature = "gtk_v4_18")]
666 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
667 pub fn limit_events(self, limit_events: bool) -> Self {
668 Self {
669 builder: self.builder.property("limit-events", limit_events),
670 }
671 }
672
673 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
674 Self {
675 builder: self.builder.property("margin-bottom", margin_bottom),
676 }
677 }
678
679 pub fn margin_end(self, margin_end: i32) -> Self {
680 Self {
681 builder: self.builder.property("margin-end", margin_end),
682 }
683 }
684
685 pub fn margin_start(self, margin_start: i32) -> Self {
686 Self {
687 builder: self.builder.property("margin-start", margin_start),
688 }
689 }
690
691 pub fn margin_top(self, margin_top: i32) -> Self {
692 Self {
693 builder: self.builder.property("margin-top", margin_top),
694 }
695 }
696
697 pub fn name(self, name: impl Into<glib::GString>) -> Self {
698 Self {
699 builder: self.builder.property("name", name.into()),
700 }
701 }
702
703 pub fn opacity(self, opacity: f64) -> Self {
704 Self {
705 builder: self.builder.property("opacity", opacity),
706 }
707 }
708
709 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
710 Self {
711 builder: self.builder.property("overflow", overflow),
712 }
713 }
714
715 pub fn receives_default(self, receives_default: bool) -> Self {
716 Self {
717 builder: self.builder.property("receives-default", receives_default),
718 }
719 }
720
721 pub fn sensitive(self, sensitive: bool) -> Self {
722 Self {
723 builder: self.builder.property("sensitive", sensitive),
724 }
725 }
726
727 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
728 Self {
729 builder: self
730 .builder
731 .property("tooltip-markup", tooltip_markup.into()),
732 }
733 }
734
735 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
736 Self {
737 builder: self.builder.property("tooltip-text", tooltip_text.into()),
738 }
739 }
740
741 pub fn valign(self, valign: gtk::Align) -> Self {
742 Self {
743 builder: self.builder.property("valign", valign),
744 }
745 }
746
747 pub fn vexpand(self, vexpand: bool) -> Self {
748 Self {
749 builder: self.builder.property("vexpand", vexpand),
750 }
751 }
752
753 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
754 Self {
755 builder: self.builder.property("vexpand-set", vexpand_set),
756 }
757 }
758
759 pub fn visible(self, visible: bool) -> Self {
760 Self {
761 builder: self.builder.property("visible", visible),
762 }
763 }
764
765 pub fn width_request(self, width_request: i32) -> Self {
766 Self {
767 builder: self.builder.property("width-request", width_request),
768 }
769 }
770
771 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
772 Self {
773 builder: self.builder.property("accessible-role", accessible_role),
774 }
775 }
776
777 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
778 Self {
779 builder: self.builder.property("action-name", action_name.into()),
780 }
781 }
782
783 pub fn action_target(self, action_target: &glib::Variant) -> Self {
784 Self {
785 builder: self
786 .builder
787 .property("action-target", action_target.clone()),
788 }
789 }
790
791 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
794 pub fn build(self) -> SplitButton {
795 assert_initialized_main_thread!();
796 self.builder.build()
797 }
798}