1#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8#[cfg(feature = "v4_22")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
10use crate::AccessibleHypertext;
11#[cfg(feature = "v4_14")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
13use crate::AccessibleText;
14#[cfg(feature = "v4_6")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
16use crate::NaturalWrapMode;
17use crate::{
18 AccessibleRole, Align, Buildable, ConstraintTarget, Justification, LayoutManager, MovementStep,
19 Overflow, Widget, ffi,
20};
21use glib::{
22 object::ObjectType as _,
23 prelude::*,
24 signal::{SignalHandlerId, connect_raw},
25 translate::*,
26};
27use std::boxed::Box as Box_;
28
29#[cfg(all(feature = "v4_10", feature = "v4_14", feature = "v4_22"))]
30#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
31glib::wrapper! {
32 #[doc(alias = "GtkLabel")]
33 pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleHypertext, AccessibleText;
34
35 match fn {
36 type_ => || ffi::gtk_label_get_type(),
37 }
38}
39
40#[cfg(all(feature = "v4_10", feature = "v4_14", not(feature = "v4_22")))]
41glib::wrapper! {
42 #[doc(alias = "GtkLabel")]
43 pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText;
44
45 match fn {
46 type_ => || ffi::gtk_label_get_type(),
47 }
48}
49
50#[cfg(all(feature = "v4_10", not(feature = "v4_14")))]
51glib::wrapper! {
52 #[doc(alias = "GtkLabel")]
53 pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
54
55 match fn {
56 type_ => || ffi::gtk_label_get_type(),
57 }
58}
59
60#[cfg(not(any(feature = "v4_10", feature = "v4_14", feature = "v4_22")))]
61glib::wrapper! {
62 #[doc(alias = "GtkLabel")]
63 pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Buildable, ConstraintTarget;
64
65 match fn {
66 type_ => || ffi::gtk_label_get_type(),
67 }
68}
69
70impl Label {
71 #[doc(alias = "gtk_label_new")]
72 pub fn new(str: Option<&str>) -> Label {
73 assert_initialized_main_thread!();
74 unsafe { Widget::from_glib_none(ffi::gtk_label_new(str.to_glib_none().0)).unsafe_cast() }
75 }
76
77 #[doc(alias = "gtk_label_new_with_mnemonic")]
78 #[doc(alias = "new_with_mnemonic")]
79 pub fn with_mnemonic(str: &str) -> Label {
80 assert_initialized_main_thread!();
81 unsafe {
82 Widget::from_glib_none(ffi::gtk_label_new_with_mnemonic(str.to_glib_none().0))
83 .unsafe_cast()
84 }
85 }
86
87 pub fn builder() -> LabelBuilder {
92 LabelBuilder::new()
93 }
94
95 #[doc(alias = "gtk_label_get_attributes")]
96 #[doc(alias = "get_attributes")]
97 pub fn attributes(&self) -> Option<pango::AttrList> {
98 unsafe { from_glib_none(ffi::gtk_label_get_attributes(self.to_glib_none().0)) }
99 }
100
101 #[doc(alias = "gtk_label_get_current_uri")]
102 #[doc(alias = "get_current_uri")]
103 pub fn current_uri(&self) -> Option<glib::GString> {
104 unsafe { from_glib_none(ffi::gtk_label_get_current_uri(self.to_glib_none().0)) }
105 }
106
107 #[doc(alias = "gtk_label_get_ellipsize")]
108 #[doc(alias = "get_ellipsize")]
109 pub fn ellipsize(&self) -> pango::EllipsizeMode {
110 unsafe { from_glib(ffi::gtk_label_get_ellipsize(self.to_glib_none().0)) }
111 }
112
113 #[doc(alias = "gtk_label_get_extra_menu")]
114 #[doc(alias = "get_extra_menu")]
115 #[doc(alias = "extra-menu")]
116 pub fn extra_menu(&self) -> Option<gio::MenuModel> {
117 unsafe { from_glib_none(ffi::gtk_label_get_extra_menu(self.to_glib_none().0)) }
118 }
119
120 #[doc(alias = "gtk_label_get_justify")]
121 #[doc(alias = "get_justify")]
122 pub fn justify(&self) -> Justification {
123 unsafe { from_glib(ffi::gtk_label_get_justify(self.to_glib_none().0)) }
124 }
125
126 #[doc(alias = "gtk_label_get_label")]
127 #[doc(alias = "get_label")]
128 pub fn label(&self) -> glib::GString {
129 unsafe { from_glib_none(ffi::gtk_label_get_label(self.to_glib_none().0)) }
130 }
131
132 #[doc(alias = "gtk_label_get_layout")]
133 #[doc(alias = "get_layout")]
134 pub fn layout(&self) -> pango::Layout {
135 unsafe { from_glib_none(ffi::gtk_label_get_layout(self.to_glib_none().0)) }
136 }
137
138 #[doc(alias = "gtk_label_get_layout_offsets")]
139 #[doc(alias = "get_layout_offsets")]
140 pub fn layout_offsets(&self) -> (i32, i32) {
141 unsafe {
142 let mut x = std::mem::MaybeUninit::uninit();
143 let mut y = std::mem::MaybeUninit::uninit();
144 ffi::gtk_label_get_layout_offsets(
145 self.to_glib_none().0,
146 x.as_mut_ptr(),
147 y.as_mut_ptr(),
148 );
149 (x.assume_init(), y.assume_init())
150 }
151 }
152
153 #[doc(alias = "gtk_label_get_lines")]
154 #[doc(alias = "get_lines")]
155 pub fn lines(&self) -> i32 {
156 unsafe { ffi::gtk_label_get_lines(self.to_glib_none().0) }
157 }
158
159 #[doc(alias = "gtk_label_get_max_width_chars")]
160 #[doc(alias = "get_max_width_chars")]
161 #[doc(alias = "max-width-chars")]
162 pub fn max_width_chars(&self) -> i32 {
163 unsafe { ffi::gtk_label_get_max_width_chars(self.to_glib_none().0) }
164 }
165
166 #[doc(alias = "gtk_label_get_mnemonic_widget")]
167 #[doc(alias = "get_mnemonic_widget")]
168 #[doc(alias = "mnemonic-widget")]
169 pub fn mnemonic_widget(&self) -> Option<Widget> {
170 unsafe { from_glib_none(ffi::gtk_label_get_mnemonic_widget(self.to_glib_none().0)) }
171 }
172
173 #[cfg(feature = "v4_6")]
174 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
175 #[doc(alias = "gtk_label_get_natural_wrap_mode")]
176 #[doc(alias = "get_natural_wrap_mode")]
177 #[doc(alias = "natural-wrap-mode")]
178 pub fn natural_wrap_mode(&self) -> NaturalWrapMode {
179 unsafe { from_glib(ffi::gtk_label_get_natural_wrap_mode(self.to_glib_none().0)) }
180 }
181
182 #[doc(alias = "gtk_label_get_selectable")]
183 #[doc(alias = "get_selectable")]
184 #[doc(alias = "selectable")]
185 pub fn is_selectable(&self) -> bool {
186 unsafe { from_glib(ffi::gtk_label_get_selectable(self.to_glib_none().0)) }
187 }
188
189 #[doc(alias = "gtk_label_get_selection_bounds")]
190 #[doc(alias = "get_selection_bounds")]
191 pub fn selection_bounds(&self) -> Option<(i32, i32)> {
192 unsafe {
193 let mut start = std::mem::MaybeUninit::uninit();
194 let mut end = std::mem::MaybeUninit::uninit();
195 let ret = from_glib(ffi::gtk_label_get_selection_bounds(
196 self.to_glib_none().0,
197 start.as_mut_ptr(),
198 end.as_mut_ptr(),
199 ));
200 if ret {
201 Some((start.assume_init(), end.assume_init()))
202 } else {
203 None
204 }
205 }
206 }
207
208 #[doc(alias = "gtk_label_get_single_line_mode")]
209 #[doc(alias = "get_single_line_mode")]
210 #[doc(alias = "single-line-mode")]
211 pub fn is_single_line_mode(&self) -> bool {
212 unsafe { from_glib(ffi::gtk_label_get_single_line_mode(self.to_glib_none().0)) }
213 }
214
215 #[cfg(feature = "v4_8")]
216 #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
217 #[doc(alias = "gtk_label_get_tabs")]
218 #[doc(alias = "get_tabs")]
219 pub fn tabs(&self) -> Option<pango::TabArray> {
220 unsafe { from_glib_full(ffi::gtk_label_get_tabs(self.to_glib_none().0)) }
221 }
222
223 #[doc(alias = "gtk_label_get_text")]
224 #[doc(alias = "get_text")]
225 pub fn text(&self) -> glib::GString {
226 unsafe { from_glib_none(ffi::gtk_label_get_text(self.to_glib_none().0)) }
227 }
228
229 #[doc(alias = "gtk_label_get_use_markup")]
230 #[doc(alias = "get_use_markup")]
231 #[doc(alias = "use-markup")]
232 pub fn uses_markup(&self) -> bool {
233 unsafe { from_glib(ffi::gtk_label_get_use_markup(self.to_glib_none().0)) }
234 }
235
236 #[doc(alias = "gtk_label_get_use_underline")]
237 #[doc(alias = "get_use_underline")]
238 #[doc(alias = "use-underline")]
239 pub fn uses_underline(&self) -> bool {
240 unsafe { from_glib(ffi::gtk_label_get_use_underline(self.to_glib_none().0)) }
241 }
242
243 #[doc(alias = "gtk_label_get_width_chars")]
244 #[doc(alias = "get_width_chars")]
245 #[doc(alias = "width-chars")]
246 pub fn width_chars(&self) -> i32 {
247 unsafe { ffi::gtk_label_get_width_chars(self.to_glib_none().0) }
248 }
249
250 #[doc(alias = "gtk_label_get_wrap")]
251 #[doc(alias = "get_wrap")]
252 #[doc(alias = "wrap")]
253 pub fn wraps(&self) -> bool {
254 unsafe { from_glib(ffi::gtk_label_get_wrap(self.to_glib_none().0)) }
255 }
256
257 #[doc(alias = "gtk_label_get_wrap_mode")]
258 #[doc(alias = "get_wrap_mode")]
259 #[doc(alias = "wrap-mode")]
260 pub fn wrap_mode(&self) -> pango::WrapMode {
261 unsafe { from_glib(ffi::gtk_label_get_wrap_mode(self.to_glib_none().0)) }
262 }
263
264 #[doc(alias = "gtk_label_get_xalign")]
265 #[doc(alias = "get_xalign")]
266 pub fn xalign(&self) -> f32 {
267 unsafe { ffi::gtk_label_get_xalign(self.to_glib_none().0) }
268 }
269
270 #[doc(alias = "gtk_label_get_yalign")]
271 #[doc(alias = "get_yalign")]
272 pub fn yalign(&self) -> f32 {
273 unsafe { ffi::gtk_label_get_yalign(self.to_glib_none().0) }
274 }
275
276 #[doc(alias = "gtk_label_select_region")]
277 pub fn select_region(&self, start_offset: i32, end_offset: i32) {
278 unsafe {
279 ffi::gtk_label_select_region(self.to_glib_none().0, start_offset, end_offset);
280 }
281 }
282
283 #[doc(alias = "gtk_label_set_attributes")]
284 #[doc(alias = "attributes")]
285 pub fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
286 unsafe {
287 ffi::gtk_label_set_attributes(self.to_glib_none().0, attrs.to_glib_none().0);
288 }
289 }
290
291 #[doc(alias = "gtk_label_set_ellipsize")]
292 #[doc(alias = "ellipsize")]
293 pub fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
294 unsafe {
295 ffi::gtk_label_set_ellipsize(self.to_glib_none().0, mode.into_glib());
296 }
297 }
298
299 #[doc(alias = "gtk_label_set_extra_menu")]
300 #[doc(alias = "extra-menu")]
301 pub fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
302 unsafe {
303 ffi::gtk_label_set_extra_menu(
304 self.to_glib_none().0,
305 model.map(|p| p.as_ref()).to_glib_none().0,
306 );
307 }
308 }
309
310 #[doc(alias = "gtk_label_set_justify")]
311 #[doc(alias = "justify")]
312 pub fn set_justify(&self, jtype: Justification) {
313 unsafe {
314 ffi::gtk_label_set_justify(self.to_glib_none().0, jtype.into_glib());
315 }
316 }
317
318 #[doc(alias = "gtk_label_set_label")]
319 #[doc(alias = "label")]
320 pub fn set_label(&self, str: &str) {
321 unsafe {
322 ffi::gtk_label_set_label(self.to_glib_none().0, str.to_glib_none().0);
323 }
324 }
325
326 #[doc(alias = "gtk_label_set_lines")]
327 #[doc(alias = "lines")]
328 pub fn set_lines(&self, lines: i32) {
329 unsafe {
330 ffi::gtk_label_set_lines(self.to_glib_none().0, lines);
331 }
332 }
333
334 #[doc(alias = "gtk_label_set_markup")]
335 pub fn set_markup(&self, str: &str) {
336 unsafe {
337 ffi::gtk_label_set_markup(self.to_glib_none().0, str.to_glib_none().0);
338 }
339 }
340
341 #[doc(alias = "gtk_label_set_markup_with_mnemonic")]
342 pub fn set_markup_with_mnemonic(&self, str: &str) {
343 unsafe {
344 ffi::gtk_label_set_markup_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
345 }
346 }
347
348 #[doc(alias = "gtk_label_set_max_width_chars")]
349 #[doc(alias = "max-width-chars")]
350 pub fn set_max_width_chars(&self, n_chars: i32) {
351 unsafe {
352 ffi::gtk_label_set_max_width_chars(self.to_glib_none().0, n_chars);
353 }
354 }
355
356 #[doc(alias = "gtk_label_set_mnemonic_widget")]
357 #[doc(alias = "mnemonic-widget")]
358 pub fn set_mnemonic_widget(&self, widget: Option<&impl IsA<Widget>>) {
359 unsafe {
360 ffi::gtk_label_set_mnemonic_widget(
361 self.to_glib_none().0,
362 widget.map(|p| p.as_ref()).to_glib_none().0,
363 );
364 }
365 }
366
367 #[cfg(feature = "v4_6")]
368 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
369 #[doc(alias = "gtk_label_set_natural_wrap_mode")]
370 #[doc(alias = "natural-wrap-mode")]
371 pub fn set_natural_wrap_mode(&self, wrap_mode: NaturalWrapMode) {
372 unsafe {
373 ffi::gtk_label_set_natural_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
374 }
375 }
376
377 #[doc(alias = "gtk_label_set_selectable")]
378 #[doc(alias = "selectable")]
379 pub fn set_selectable(&self, setting: bool) {
380 unsafe {
381 ffi::gtk_label_set_selectable(self.to_glib_none().0, setting.into_glib());
382 }
383 }
384
385 #[doc(alias = "gtk_label_set_single_line_mode")]
386 #[doc(alias = "single-line-mode")]
387 pub fn set_single_line_mode(&self, single_line_mode: bool) {
388 unsafe {
389 ffi::gtk_label_set_single_line_mode(
390 self.to_glib_none().0,
391 single_line_mode.into_glib(),
392 );
393 }
394 }
395
396 #[cfg(feature = "v4_8")]
397 #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
398 #[doc(alias = "gtk_label_set_tabs")]
399 #[doc(alias = "tabs")]
400 pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) {
401 unsafe {
402 ffi::gtk_label_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0));
403 }
404 }
405
406 #[doc(alias = "gtk_label_set_text")]
407 pub fn set_text(&self, str: &str) {
408 unsafe {
409 ffi::gtk_label_set_text(self.to_glib_none().0, str.to_glib_none().0);
410 }
411 }
412
413 #[doc(alias = "gtk_label_set_text_with_mnemonic")]
414 pub fn set_text_with_mnemonic(&self, str: &str) {
415 unsafe {
416 ffi::gtk_label_set_text_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
417 }
418 }
419
420 #[doc(alias = "gtk_label_set_use_markup")]
421 #[doc(alias = "use-markup")]
422 pub fn set_use_markup(&self, setting: bool) {
423 unsafe {
424 ffi::gtk_label_set_use_markup(self.to_glib_none().0, setting.into_glib());
425 }
426 }
427
428 #[doc(alias = "gtk_label_set_use_underline")]
429 #[doc(alias = "use-underline")]
430 pub fn set_use_underline(&self, setting: bool) {
431 unsafe {
432 ffi::gtk_label_set_use_underline(self.to_glib_none().0, setting.into_glib());
433 }
434 }
435
436 #[doc(alias = "gtk_label_set_width_chars")]
437 #[doc(alias = "width-chars")]
438 pub fn set_width_chars(&self, n_chars: i32) {
439 unsafe {
440 ffi::gtk_label_set_width_chars(self.to_glib_none().0, n_chars);
441 }
442 }
443
444 #[doc(alias = "gtk_label_set_wrap")]
445 #[doc(alias = "wrap")]
446 pub fn set_wrap(&self, wrap: bool) {
447 unsafe {
448 ffi::gtk_label_set_wrap(self.to_glib_none().0, wrap.into_glib());
449 }
450 }
451
452 #[doc(alias = "gtk_label_set_wrap_mode")]
453 #[doc(alias = "wrap-mode")]
454 pub fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
455 unsafe {
456 ffi::gtk_label_set_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
457 }
458 }
459
460 #[doc(alias = "gtk_label_set_xalign")]
461 #[doc(alias = "xalign")]
462 pub fn set_xalign(&self, xalign: f32) {
463 unsafe {
464 ffi::gtk_label_set_xalign(self.to_glib_none().0, xalign);
465 }
466 }
467
468 #[doc(alias = "gtk_label_set_yalign")]
469 #[doc(alias = "yalign")]
470 pub fn set_yalign(&self, yalign: f32) {
471 unsafe {
472 ffi::gtk_label_set_yalign(self.to_glib_none().0, yalign);
473 }
474 }
475
476 #[doc(alias = "activate-current-link")]
477 pub fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
478 unsafe extern "C" fn activate_current_link_trampoline<F: Fn(&Label) + 'static>(
479 this: *mut ffi::GtkLabel,
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"activate-current-link".as_ptr(),
492 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
493 activate_current_link_trampoline::<F> as *const (),
494 )),
495 Box_::into_raw(f),
496 )
497 }
498 }
499
500 pub fn emit_activate_current_link(&self) {
501 self.emit_by_name::<()>("activate-current-link", &[]);
502 }
503
504 #[doc(alias = "activate-link")]
505 pub fn connect_activate_link<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
506 &self,
507 f: F,
508 ) -> SignalHandlerId {
509 unsafe extern "C" fn activate_link_trampoline<
510 F: Fn(&Label, &str) -> glib::Propagation + 'static,
511 >(
512 this: *mut ffi::GtkLabel,
513 uri: *mut std::ffi::c_char,
514 f: glib::ffi::gpointer,
515 ) -> glib::ffi::gboolean {
516 unsafe {
517 let f: &F = &*(f as *const F);
518 f(
519 &from_glib_borrow(this),
520 &glib::GString::from_glib_borrow(uri),
521 )
522 .into_glib()
523 }
524 }
525 unsafe {
526 let f: Box_<F> = Box_::new(f);
527 connect_raw(
528 self.as_ptr() as *mut _,
529 c"activate-link".as_ptr(),
530 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
531 activate_link_trampoline::<F> as *const (),
532 )),
533 Box_::into_raw(f),
534 )
535 }
536 }
537
538 #[doc(alias = "copy-clipboard")]
539 pub fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
540 unsafe extern "C" fn copy_clipboard_trampoline<F: Fn(&Label) + 'static>(
541 this: *mut ffi::GtkLabel,
542 f: glib::ffi::gpointer,
543 ) {
544 unsafe {
545 let f: &F = &*(f as *const F);
546 f(&from_glib_borrow(this))
547 }
548 }
549 unsafe {
550 let f: Box_<F> = Box_::new(f);
551 connect_raw(
552 self.as_ptr() as *mut _,
553 c"copy-clipboard".as_ptr(),
554 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
555 copy_clipboard_trampoline::<F> as *const (),
556 )),
557 Box_::into_raw(f),
558 )
559 }
560 }
561
562 pub fn emit_copy_clipboard(&self) {
563 self.emit_by_name::<()>("copy-clipboard", &[]);
564 }
565
566 #[doc(alias = "move-cursor")]
567 pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
568 &self,
569 f: F,
570 ) -> SignalHandlerId {
571 unsafe extern "C" fn move_cursor_trampoline<
572 F: Fn(&Label, MovementStep, i32, bool) + 'static,
573 >(
574 this: *mut ffi::GtkLabel,
575 step: ffi::GtkMovementStep,
576 count: std::ffi::c_int,
577 extend_selection: glib::ffi::gboolean,
578 f: glib::ffi::gpointer,
579 ) {
580 unsafe {
581 let f: &F = &*(f as *const F);
582 f(
583 &from_glib_borrow(this),
584 from_glib(step),
585 count,
586 from_glib(extend_selection),
587 )
588 }
589 }
590 unsafe {
591 let f: Box_<F> = Box_::new(f);
592 connect_raw(
593 self.as_ptr() as *mut _,
594 c"move-cursor".as_ptr(),
595 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
596 move_cursor_trampoline::<F> as *const (),
597 )),
598 Box_::into_raw(f),
599 )
600 }
601 }
602
603 pub fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
604 self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
605 }
606
607 #[doc(alias = "attributes")]
608 pub fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
609 unsafe extern "C" fn notify_attributes_trampoline<F: Fn(&Label) + 'static>(
610 this: *mut ffi::GtkLabel,
611 _param_spec: glib::ffi::gpointer,
612 f: glib::ffi::gpointer,
613 ) {
614 unsafe {
615 let f: &F = &*(f as *const F);
616 f(&from_glib_borrow(this))
617 }
618 }
619 unsafe {
620 let f: Box_<F> = Box_::new(f);
621 connect_raw(
622 self.as_ptr() as *mut _,
623 c"notify::attributes".as_ptr(),
624 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
625 notify_attributes_trampoline::<F> as *const (),
626 )),
627 Box_::into_raw(f),
628 )
629 }
630 }
631
632 #[doc(alias = "ellipsize")]
633 pub fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
634 unsafe extern "C" fn notify_ellipsize_trampoline<F: Fn(&Label) + 'static>(
635 this: *mut ffi::GtkLabel,
636 _param_spec: glib::ffi::gpointer,
637 f: glib::ffi::gpointer,
638 ) {
639 unsafe {
640 let f: &F = &*(f as *const F);
641 f(&from_glib_borrow(this))
642 }
643 }
644 unsafe {
645 let f: Box_<F> = Box_::new(f);
646 connect_raw(
647 self.as_ptr() as *mut _,
648 c"notify::ellipsize".as_ptr(),
649 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
650 notify_ellipsize_trampoline::<F> as *const (),
651 )),
652 Box_::into_raw(f),
653 )
654 }
655 }
656
657 #[doc(alias = "extra-menu")]
658 pub fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
659 unsafe extern "C" fn notify_extra_menu_trampoline<F: Fn(&Label) + 'static>(
660 this: *mut ffi::GtkLabel,
661 _param_spec: glib::ffi::gpointer,
662 f: glib::ffi::gpointer,
663 ) {
664 unsafe {
665 let f: &F = &*(f as *const F);
666 f(&from_glib_borrow(this))
667 }
668 }
669 unsafe {
670 let f: Box_<F> = Box_::new(f);
671 connect_raw(
672 self.as_ptr() as *mut _,
673 c"notify::extra-menu".as_ptr(),
674 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
675 notify_extra_menu_trampoline::<F> as *const (),
676 )),
677 Box_::into_raw(f),
678 )
679 }
680 }
681
682 #[doc(alias = "justify")]
683 pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684 unsafe extern "C" fn notify_justify_trampoline<F: Fn(&Label) + 'static>(
685 this: *mut ffi::GtkLabel,
686 _param_spec: glib::ffi::gpointer,
687 f: glib::ffi::gpointer,
688 ) {
689 unsafe {
690 let f: &F = &*(f as *const F);
691 f(&from_glib_borrow(this))
692 }
693 }
694 unsafe {
695 let f: Box_<F> = Box_::new(f);
696 connect_raw(
697 self.as_ptr() as *mut _,
698 c"notify::justify".as_ptr(),
699 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
700 notify_justify_trampoline::<F> as *const (),
701 )),
702 Box_::into_raw(f),
703 )
704 }
705 }
706
707 #[doc(alias = "label")]
708 pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
709 unsafe extern "C" fn notify_label_trampoline<F: Fn(&Label) + 'static>(
710 this: *mut ffi::GtkLabel,
711 _param_spec: glib::ffi::gpointer,
712 f: glib::ffi::gpointer,
713 ) {
714 unsafe {
715 let f: &F = &*(f as *const F);
716 f(&from_glib_borrow(this))
717 }
718 }
719 unsafe {
720 let f: Box_<F> = Box_::new(f);
721 connect_raw(
722 self.as_ptr() as *mut _,
723 c"notify::label".as_ptr(),
724 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
725 notify_label_trampoline::<F> as *const (),
726 )),
727 Box_::into_raw(f),
728 )
729 }
730 }
731
732 #[doc(alias = "lines")]
733 pub fn connect_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
734 unsafe extern "C" fn notify_lines_trampoline<F: Fn(&Label) + 'static>(
735 this: *mut ffi::GtkLabel,
736 _param_spec: glib::ffi::gpointer,
737 f: glib::ffi::gpointer,
738 ) {
739 unsafe {
740 let f: &F = &*(f as *const F);
741 f(&from_glib_borrow(this))
742 }
743 }
744 unsafe {
745 let f: Box_<F> = Box_::new(f);
746 connect_raw(
747 self.as_ptr() as *mut _,
748 c"notify::lines".as_ptr(),
749 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
750 notify_lines_trampoline::<F> as *const (),
751 )),
752 Box_::into_raw(f),
753 )
754 }
755 }
756
757 #[doc(alias = "max-width-chars")]
758 pub fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
759 unsafe extern "C" fn notify_max_width_chars_trampoline<F: Fn(&Label) + 'static>(
760 this: *mut ffi::GtkLabel,
761 _param_spec: glib::ffi::gpointer,
762 f: glib::ffi::gpointer,
763 ) {
764 unsafe {
765 let f: &F = &*(f as *const F);
766 f(&from_glib_borrow(this))
767 }
768 }
769 unsafe {
770 let f: Box_<F> = Box_::new(f);
771 connect_raw(
772 self.as_ptr() as *mut _,
773 c"notify::max-width-chars".as_ptr(),
774 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
775 notify_max_width_chars_trampoline::<F> as *const (),
776 )),
777 Box_::into_raw(f),
778 )
779 }
780 }
781
782 #[doc(alias = "mnemonic-keyval")]
783 pub fn connect_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
784 unsafe extern "C" fn notify_mnemonic_keyval_trampoline<F: Fn(&Label) + 'static>(
785 this: *mut ffi::GtkLabel,
786 _param_spec: glib::ffi::gpointer,
787 f: glib::ffi::gpointer,
788 ) {
789 unsafe {
790 let f: &F = &*(f as *const F);
791 f(&from_glib_borrow(this))
792 }
793 }
794 unsafe {
795 let f: Box_<F> = Box_::new(f);
796 connect_raw(
797 self.as_ptr() as *mut _,
798 c"notify::mnemonic-keyval".as_ptr(),
799 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
800 notify_mnemonic_keyval_trampoline::<F> as *const (),
801 )),
802 Box_::into_raw(f),
803 )
804 }
805 }
806
807 #[doc(alias = "mnemonic-widget")]
808 pub fn connect_mnemonic_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
809 unsafe extern "C" fn notify_mnemonic_widget_trampoline<F: Fn(&Label) + 'static>(
810 this: *mut ffi::GtkLabel,
811 _param_spec: glib::ffi::gpointer,
812 f: glib::ffi::gpointer,
813 ) {
814 unsafe {
815 let f: &F = &*(f as *const F);
816 f(&from_glib_borrow(this))
817 }
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 c"notify::mnemonic-widget".as_ptr(),
824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
825 notify_mnemonic_widget_trampoline::<F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[cfg(feature = "v4_6")]
833 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
834 #[doc(alias = "natural-wrap-mode")]
835 pub fn connect_natural_wrap_mode_notify<F: Fn(&Self) + 'static>(
836 &self,
837 f: F,
838 ) -> SignalHandlerId {
839 unsafe extern "C" fn notify_natural_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
840 this: *mut ffi::GtkLabel,
841 _param_spec: glib::ffi::gpointer,
842 f: glib::ffi::gpointer,
843 ) {
844 unsafe {
845 let f: &F = &*(f as *const F);
846 f(&from_glib_borrow(this))
847 }
848 }
849 unsafe {
850 let f: Box_<F> = Box_::new(f);
851 connect_raw(
852 self.as_ptr() as *mut _,
853 c"notify::natural-wrap-mode".as_ptr(),
854 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
855 notify_natural_wrap_mode_trampoline::<F> as *const (),
856 )),
857 Box_::into_raw(f),
858 )
859 }
860 }
861
862 #[doc(alias = "selectable")]
863 pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
864 unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&Label) + 'static>(
865 this: *mut ffi::GtkLabel,
866 _param_spec: glib::ffi::gpointer,
867 f: glib::ffi::gpointer,
868 ) {
869 unsafe {
870 let f: &F = &*(f as *const F);
871 f(&from_glib_borrow(this))
872 }
873 }
874 unsafe {
875 let f: Box_<F> = Box_::new(f);
876 connect_raw(
877 self.as_ptr() as *mut _,
878 c"notify::selectable".as_ptr(),
879 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
880 notify_selectable_trampoline::<F> as *const (),
881 )),
882 Box_::into_raw(f),
883 )
884 }
885 }
886
887 #[doc(alias = "single-line-mode")]
888 pub fn connect_single_line_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
889 unsafe extern "C" fn notify_single_line_mode_trampoline<F: Fn(&Label) + 'static>(
890 this: *mut ffi::GtkLabel,
891 _param_spec: glib::ffi::gpointer,
892 f: glib::ffi::gpointer,
893 ) {
894 unsafe {
895 let f: &F = &*(f as *const F);
896 f(&from_glib_borrow(this))
897 }
898 }
899 unsafe {
900 let f: Box_<F> = Box_::new(f);
901 connect_raw(
902 self.as_ptr() as *mut _,
903 c"notify::single-line-mode".as_ptr(),
904 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
905 notify_single_line_mode_trampoline::<F> as *const (),
906 )),
907 Box_::into_raw(f),
908 )
909 }
910 }
911
912 #[cfg(feature = "v4_8")]
913 #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
914 #[doc(alias = "tabs")]
915 pub fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
916 unsafe extern "C" fn notify_tabs_trampoline<F: Fn(&Label) + 'static>(
917 this: *mut ffi::GtkLabel,
918 _param_spec: glib::ffi::gpointer,
919 f: glib::ffi::gpointer,
920 ) {
921 unsafe {
922 let f: &F = &*(f as *const F);
923 f(&from_glib_borrow(this))
924 }
925 }
926 unsafe {
927 let f: Box_<F> = Box_::new(f);
928 connect_raw(
929 self.as_ptr() as *mut _,
930 c"notify::tabs".as_ptr(),
931 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
932 notify_tabs_trampoline::<F> as *const (),
933 )),
934 Box_::into_raw(f),
935 )
936 }
937 }
938
939 #[doc(alias = "use-markup")]
940 pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
941 unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Label) + 'static>(
942 this: *mut ffi::GtkLabel,
943 _param_spec: glib::ffi::gpointer,
944 f: glib::ffi::gpointer,
945 ) {
946 unsafe {
947 let f: &F = &*(f as *const F);
948 f(&from_glib_borrow(this))
949 }
950 }
951 unsafe {
952 let f: Box_<F> = Box_::new(f);
953 connect_raw(
954 self.as_ptr() as *mut _,
955 c"notify::use-markup".as_ptr(),
956 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
957 notify_use_markup_trampoline::<F> as *const (),
958 )),
959 Box_::into_raw(f),
960 )
961 }
962 }
963
964 #[doc(alias = "use-underline")]
965 pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
966 unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Label) + 'static>(
967 this: *mut ffi::GtkLabel,
968 _param_spec: glib::ffi::gpointer,
969 f: glib::ffi::gpointer,
970 ) {
971 unsafe {
972 let f: &F = &*(f as *const F);
973 f(&from_glib_borrow(this))
974 }
975 }
976 unsafe {
977 let f: Box_<F> = Box_::new(f);
978 connect_raw(
979 self.as_ptr() as *mut _,
980 c"notify::use-underline".as_ptr(),
981 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
982 notify_use_underline_trampoline::<F> as *const (),
983 )),
984 Box_::into_raw(f),
985 )
986 }
987 }
988
989 #[doc(alias = "width-chars")]
990 pub fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
991 unsafe extern "C" fn notify_width_chars_trampoline<F: Fn(&Label) + 'static>(
992 this: *mut ffi::GtkLabel,
993 _param_spec: glib::ffi::gpointer,
994 f: glib::ffi::gpointer,
995 ) {
996 unsafe {
997 let f: &F = &*(f as *const F);
998 f(&from_glib_borrow(this))
999 }
1000 }
1001 unsafe {
1002 let f: Box_<F> = Box_::new(f);
1003 connect_raw(
1004 self.as_ptr() as *mut _,
1005 c"notify::width-chars".as_ptr(),
1006 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1007 notify_width_chars_trampoline::<F> as *const (),
1008 )),
1009 Box_::into_raw(f),
1010 )
1011 }
1012 }
1013
1014 #[doc(alias = "wrap")]
1015 pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1016 unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&Label) + 'static>(
1017 this: *mut ffi::GtkLabel,
1018 _param_spec: glib::ffi::gpointer,
1019 f: glib::ffi::gpointer,
1020 ) {
1021 unsafe {
1022 let f: &F = &*(f as *const F);
1023 f(&from_glib_borrow(this))
1024 }
1025 }
1026 unsafe {
1027 let f: Box_<F> = Box_::new(f);
1028 connect_raw(
1029 self.as_ptr() as *mut _,
1030 c"notify::wrap".as_ptr(),
1031 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1032 notify_wrap_trampoline::<F> as *const (),
1033 )),
1034 Box_::into_raw(f),
1035 )
1036 }
1037 }
1038
1039 #[doc(alias = "wrap-mode")]
1040 pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1041 unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
1042 this: *mut ffi::GtkLabel,
1043 _param_spec: glib::ffi::gpointer,
1044 f: glib::ffi::gpointer,
1045 ) {
1046 unsafe {
1047 let f: &F = &*(f as *const F);
1048 f(&from_glib_borrow(this))
1049 }
1050 }
1051 unsafe {
1052 let f: Box_<F> = Box_::new(f);
1053 connect_raw(
1054 self.as_ptr() as *mut _,
1055 c"notify::wrap-mode".as_ptr(),
1056 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1057 notify_wrap_mode_trampoline::<F> as *const (),
1058 )),
1059 Box_::into_raw(f),
1060 )
1061 }
1062 }
1063
1064 #[doc(alias = "xalign")]
1065 pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1066 unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Label) + 'static>(
1067 this: *mut ffi::GtkLabel,
1068 _param_spec: glib::ffi::gpointer,
1069 f: glib::ffi::gpointer,
1070 ) {
1071 unsafe {
1072 let f: &F = &*(f as *const F);
1073 f(&from_glib_borrow(this))
1074 }
1075 }
1076 unsafe {
1077 let f: Box_<F> = Box_::new(f);
1078 connect_raw(
1079 self.as_ptr() as *mut _,
1080 c"notify::xalign".as_ptr(),
1081 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1082 notify_xalign_trampoline::<F> as *const (),
1083 )),
1084 Box_::into_raw(f),
1085 )
1086 }
1087 }
1088
1089 #[doc(alias = "yalign")]
1090 pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1091 unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Label) + 'static>(
1092 this: *mut ffi::GtkLabel,
1093 _param_spec: glib::ffi::gpointer,
1094 f: glib::ffi::gpointer,
1095 ) {
1096 unsafe {
1097 let f: &F = &*(f as *const F);
1098 f(&from_glib_borrow(this))
1099 }
1100 }
1101 unsafe {
1102 let f: Box_<F> = Box_::new(f);
1103 connect_raw(
1104 self.as_ptr() as *mut _,
1105 c"notify::yalign".as_ptr(),
1106 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1107 notify_yalign_trampoline::<F> as *const (),
1108 )),
1109 Box_::into_raw(f),
1110 )
1111 }
1112 }
1113}
1114
1115impl Default for Label {
1116 fn default() -> Self {
1117 glib::object::Object::new::<Self>()
1118 }
1119}
1120
1121#[must_use = "The builder must be built to be used"]
1126pub struct LabelBuilder {
1127 builder: glib::object::ObjectBuilder<'static, Label>,
1128}
1129
1130impl LabelBuilder {
1131 fn new() -> Self {
1132 Self {
1133 builder: glib::object::Object::builder(),
1134 }
1135 }
1136
1137 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1138 Self {
1139 builder: self.builder.property("attributes", attributes.clone()),
1140 }
1141 }
1142
1143 pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
1144 Self {
1145 builder: self.builder.property("ellipsize", ellipsize),
1146 }
1147 }
1148
1149 pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
1150 Self {
1151 builder: self
1152 .builder
1153 .property("extra-menu", extra_menu.clone().upcast()),
1154 }
1155 }
1156
1157 pub fn justify(self, justify: Justification) -> Self {
1158 Self {
1159 builder: self.builder.property("justify", justify),
1160 }
1161 }
1162
1163 pub fn label(self, label: impl Into<glib::GString>) -> Self {
1164 Self {
1165 builder: self.builder.property("label", label.into()),
1166 }
1167 }
1168
1169 pub fn lines(self, lines: i32) -> Self {
1170 Self {
1171 builder: self.builder.property("lines", lines),
1172 }
1173 }
1174
1175 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1176 Self {
1177 builder: self.builder.property("max-width-chars", max_width_chars),
1178 }
1179 }
1180
1181 pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
1182 Self {
1183 builder: self
1184 .builder
1185 .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
1186 }
1187 }
1188
1189 #[cfg(feature = "v4_6")]
1190 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1191 pub fn natural_wrap_mode(self, natural_wrap_mode: NaturalWrapMode) -> Self {
1192 Self {
1193 builder: self
1194 .builder
1195 .property("natural-wrap-mode", natural_wrap_mode),
1196 }
1197 }
1198
1199 pub fn selectable(self, selectable: bool) -> Self {
1200 Self {
1201 builder: self.builder.property("selectable", selectable),
1202 }
1203 }
1204
1205 pub fn single_line_mode(self, single_line_mode: bool) -> Self {
1206 Self {
1207 builder: self.builder.property("single-line-mode", single_line_mode),
1208 }
1209 }
1210
1211 #[cfg(feature = "v4_8")]
1212 #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1213 pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1214 Self {
1215 builder: self.builder.property("tabs", tabs),
1216 }
1217 }
1218
1219 pub fn use_markup(self, use_markup: bool) -> Self {
1220 Self {
1221 builder: self.builder.property("use-markup", use_markup),
1222 }
1223 }
1224
1225 pub fn use_underline(self, use_underline: bool) -> Self {
1226 Self {
1227 builder: self.builder.property("use-underline", use_underline),
1228 }
1229 }
1230
1231 pub fn width_chars(self, width_chars: i32) -> Self {
1232 Self {
1233 builder: self.builder.property("width-chars", width_chars),
1234 }
1235 }
1236
1237 pub fn wrap(self, wrap: bool) -> Self {
1238 Self {
1239 builder: self.builder.property("wrap", wrap),
1240 }
1241 }
1242
1243 pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1244 Self {
1245 builder: self.builder.property("wrap-mode", wrap_mode),
1246 }
1247 }
1248
1249 pub fn xalign(self, xalign: f32) -> Self {
1250 Self {
1251 builder: self.builder.property("xalign", xalign),
1252 }
1253 }
1254
1255 pub fn yalign(self, yalign: f32) -> Self {
1256 Self {
1257 builder: self.builder.property("yalign", yalign),
1258 }
1259 }
1260
1261 pub fn can_focus(self, can_focus: bool) -> Self {
1262 Self {
1263 builder: self.builder.property("can-focus", can_focus),
1264 }
1265 }
1266
1267 pub fn can_target(self, can_target: bool) -> Self {
1268 Self {
1269 builder: self.builder.property("can-target", can_target),
1270 }
1271 }
1272
1273 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1274 Self {
1275 builder: self.builder.property("css-classes", css_classes.into()),
1276 }
1277 }
1278
1279 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1280 Self {
1281 builder: self.builder.property("css-name", css_name.into()),
1282 }
1283 }
1284
1285 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1286 Self {
1287 builder: self.builder.property("cursor", cursor.clone()),
1288 }
1289 }
1290
1291 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1292 Self {
1293 builder: self.builder.property("focus-on-click", focus_on_click),
1294 }
1295 }
1296
1297 pub fn focusable(self, focusable: bool) -> Self {
1298 Self {
1299 builder: self.builder.property("focusable", focusable),
1300 }
1301 }
1302
1303 pub fn halign(self, halign: Align) -> Self {
1304 Self {
1305 builder: self.builder.property("halign", halign),
1306 }
1307 }
1308
1309 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1310 Self {
1311 builder: self.builder.property("has-tooltip", has_tooltip),
1312 }
1313 }
1314
1315 pub fn height_request(self, height_request: i32) -> Self {
1316 Self {
1317 builder: self.builder.property("height-request", height_request),
1318 }
1319 }
1320
1321 pub fn hexpand(self, hexpand: bool) -> Self {
1322 Self {
1323 builder: self.builder.property("hexpand", hexpand),
1324 }
1325 }
1326
1327 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1328 Self {
1329 builder: self.builder.property("hexpand-set", hexpand_set),
1330 }
1331 }
1332
1333 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1334 Self {
1335 builder: self
1336 .builder
1337 .property("layout-manager", layout_manager.clone().upcast()),
1338 }
1339 }
1340
1341 #[cfg(feature = "v4_18")]
1342 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1343 pub fn limit_events(self, limit_events: bool) -> Self {
1344 Self {
1345 builder: self.builder.property("limit-events", limit_events),
1346 }
1347 }
1348
1349 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1350 Self {
1351 builder: self.builder.property("margin-bottom", margin_bottom),
1352 }
1353 }
1354
1355 pub fn margin_end(self, margin_end: i32) -> Self {
1356 Self {
1357 builder: self.builder.property("margin-end", margin_end),
1358 }
1359 }
1360
1361 pub fn margin_start(self, margin_start: i32) -> Self {
1362 Self {
1363 builder: self.builder.property("margin-start", margin_start),
1364 }
1365 }
1366
1367 pub fn margin_top(self, margin_top: i32) -> Self {
1368 Self {
1369 builder: self.builder.property("margin-top", margin_top),
1370 }
1371 }
1372
1373 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1374 Self {
1375 builder: self.builder.property("name", name.into()),
1376 }
1377 }
1378
1379 pub fn opacity(self, opacity: f64) -> Self {
1380 Self {
1381 builder: self.builder.property("opacity", opacity),
1382 }
1383 }
1384
1385 pub fn overflow(self, overflow: Overflow) -> Self {
1386 Self {
1387 builder: self.builder.property("overflow", overflow),
1388 }
1389 }
1390
1391 pub fn receives_default(self, receives_default: bool) -> Self {
1392 Self {
1393 builder: self.builder.property("receives-default", receives_default),
1394 }
1395 }
1396
1397 pub fn sensitive(self, sensitive: bool) -> Self {
1398 Self {
1399 builder: self.builder.property("sensitive", sensitive),
1400 }
1401 }
1402
1403 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1404 Self {
1405 builder: self
1406 .builder
1407 .property("tooltip-markup", tooltip_markup.into()),
1408 }
1409 }
1410
1411 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1412 Self {
1413 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1414 }
1415 }
1416
1417 pub fn valign(self, valign: Align) -> Self {
1418 Self {
1419 builder: self.builder.property("valign", valign),
1420 }
1421 }
1422
1423 pub fn vexpand(self, vexpand: bool) -> Self {
1424 Self {
1425 builder: self.builder.property("vexpand", vexpand),
1426 }
1427 }
1428
1429 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1430 Self {
1431 builder: self.builder.property("vexpand-set", vexpand_set),
1432 }
1433 }
1434
1435 pub fn visible(self, visible: bool) -> Self {
1436 Self {
1437 builder: self.builder.property("visible", visible),
1438 }
1439 }
1440
1441 pub fn width_request(self, width_request: i32) -> Self {
1442 Self {
1443 builder: self.builder.property("width-request", width_request),
1444 }
1445 }
1446
1447 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1448 Self {
1449 builder: self.builder.property("accessible-role", accessible_role),
1450 }
1451 }
1452
1453 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1456 pub fn build(self) -> Label {
1457 assert_initialized_main_thread!();
1458 self.builder.build()
1459 }
1460}