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