1use gdk;
6use glib;
7use glib::object::Cast;
8use glib::object::IsA;
9use glib::object::ObjectExt;
10use glib::signal::connect_raw;
11use glib::signal::SignalHandlerId;
12use glib::translate::*;
13use glib::GString;
14use glib::StaticType;
15use glib::ToValue;
16use glib::Value;
17use glib_sys;
18use gobject_sys;
19use gtk_sys;
20use libc;
21use pango;
22use signal::Inhibit;
23use std::boxed::Box as Box_;
24use std::fmt;
25use std::mem;
26use std::mem::transmute;
27use Align;
28use Buildable;
29use Container;
30use Justification;
31use Menu;
32use Misc;
33use MovementStep;
34use Widget;
35
36glib_wrapper! {
37 pub struct Label(Object<gtk_sys::GtkLabel, gtk_sys::GtkLabelClass, LabelClass>) @extends Misc, Widget, @implements Buildable;
38
39 match fn {
40 get_type => || gtk_sys::gtk_label_get_type(),
41 }
42}
43
44impl Label {
45 pub fn new(str: Option<&str>) -> Label {
46 assert_initialized_main_thread!();
47 unsafe {
48 Widget::from_glib_none(gtk_sys::gtk_label_new(str.to_glib_none().0)).unsafe_cast()
49 }
50 }
51
52 pub fn new_with_mnemonic(str: Option<&str>) -> Label {
53 assert_initialized_main_thread!();
54 unsafe {
55 Widget::from_glib_none(gtk_sys::gtk_label_new_with_mnemonic(str.to_glib_none().0))
56 .unsafe_cast()
57 }
58 }
59}
60
61pub struct LabelBuilder {
62 angle: Option<f64>,
63 attributes: Option<pango::AttrList>,
64 ellipsize: Option<pango::EllipsizeMode>,
65 justify: Option<Justification>,
66 label: Option<String>,
67 lines: Option<i32>,
68 max_width_chars: Option<i32>,
69 mnemonic_widget: Option<Widget>,
70 pattern: Option<String>,
71 selectable: Option<bool>,
72 single_line_mode: Option<bool>,
73 track_visited_links: Option<bool>,
74 use_markup: Option<bool>,
75 use_underline: Option<bool>,
76 width_chars: Option<i32>,
77 wrap: Option<bool>,
78 wrap_mode: Option<pango::WrapMode>,
79 #[cfg(any(feature = "v3_16", feature = "dox"))]
80 xalign: Option<f32>,
81 #[cfg(any(feature = "v3_16", feature = "dox"))]
82 yalign: Option<f32>,
83 app_paintable: Option<bool>,
84 can_default: Option<bool>,
85 can_focus: Option<bool>,
86 events: Option<gdk::EventMask>,
87 expand: Option<bool>,
88 #[cfg(any(feature = "v3_20", feature = "dox"))]
89 focus_on_click: Option<bool>,
90 halign: Option<Align>,
91 has_default: Option<bool>,
92 has_focus: Option<bool>,
93 has_tooltip: Option<bool>,
94 height_request: Option<i32>,
95 hexpand: Option<bool>,
96 hexpand_set: Option<bool>,
97 is_focus: Option<bool>,
98 margin: Option<i32>,
99 margin_bottom: Option<i32>,
100 margin_end: Option<i32>,
101 margin_start: Option<i32>,
102 margin_top: Option<i32>,
103 name: Option<String>,
104 no_show_all: Option<bool>,
105 opacity: Option<f64>,
106 parent: Option<Container>,
107 receives_default: Option<bool>,
108 sensitive: Option<bool>,
109 tooltip_markup: Option<String>,
111 tooltip_text: Option<String>,
112 valign: Option<Align>,
113 vexpand: Option<bool>,
114 vexpand_set: Option<bool>,
115 visible: Option<bool>,
116 width_request: Option<i32>,
117}
118
119impl LabelBuilder {
120 pub fn new() -> Self {
121 Self {
122 angle: None,
123 attributes: None,
124 ellipsize: None,
125 justify: None,
126 label: None,
127 lines: None,
128 max_width_chars: None,
129 mnemonic_widget: None,
130 pattern: None,
131 selectable: None,
132 single_line_mode: None,
133 track_visited_links: None,
134 use_markup: None,
135 use_underline: None,
136 width_chars: None,
137 wrap: None,
138 wrap_mode: None,
139 #[cfg(any(feature = "v3_16", feature = "dox"))]
140 xalign: None,
141 #[cfg(any(feature = "v3_16", feature = "dox"))]
142 yalign: None,
143 app_paintable: None,
144 can_default: None,
145 can_focus: None,
146 events: None,
147 expand: None,
148 #[cfg(any(feature = "v3_20", feature = "dox"))]
149 focus_on_click: None,
150 halign: None,
151 has_default: None,
152 has_focus: None,
153 has_tooltip: None,
154 height_request: None,
155 hexpand: None,
156 hexpand_set: None,
157 is_focus: None,
158 margin: None,
159 margin_bottom: None,
160 margin_end: None,
161 margin_start: None,
162 margin_top: None,
163 name: None,
164 no_show_all: None,
165 opacity: None,
166 parent: None,
167 receives_default: None,
168 sensitive: None,
169 tooltip_markup: None,
170 tooltip_text: None,
171 valign: None,
172 vexpand: None,
173 vexpand_set: None,
174 visible: None,
175 width_request: None,
176 }
177 }
178
179 pub fn build(self) -> Label {
180 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
181 if let Some(ref angle) = self.angle {
182 properties.push(("angle", angle));
183 }
184 if let Some(ref attributes) = self.attributes {
185 properties.push(("attributes", attributes));
186 }
187 if let Some(ref ellipsize) = self.ellipsize {
188 properties.push(("ellipsize", ellipsize));
189 }
190 if let Some(ref justify) = self.justify {
191 properties.push(("justify", justify));
192 }
193 if let Some(ref label) = self.label {
194 properties.push(("label", label));
195 }
196 if let Some(ref lines) = self.lines {
197 properties.push(("lines", lines));
198 }
199 if let Some(ref max_width_chars) = self.max_width_chars {
200 properties.push(("max-width-chars", max_width_chars));
201 }
202 if let Some(ref mnemonic_widget) = self.mnemonic_widget {
203 properties.push(("mnemonic-widget", mnemonic_widget));
204 }
205 if let Some(ref pattern) = self.pattern {
206 properties.push(("pattern", pattern));
207 }
208 if let Some(ref selectable) = self.selectable {
209 properties.push(("selectable", selectable));
210 }
211 if let Some(ref single_line_mode) = self.single_line_mode {
212 properties.push(("single-line-mode", single_line_mode));
213 }
214 if let Some(ref track_visited_links) = self.track_visited_links {
215 properties.push(("track-visited-links", track_visited_links));
216 }
217 if let Some(ref use_markup) = self.use_markup {
218 properties.push(("use-markup", use_markup));
219 }
220 if let Some(ref use_underline) = self.use_underline {
221 properties.push(("use-underline", use_underline));
222 }
223 if let Some(ref width_chars) = self.width_chars {
224 properties.push(("width-chars", width_chars));
225 }
226 if let Some(ref wrap) = self.wrap {
227 properties.push(("wrap", wrap));
228 }
229 if let Some(ref wrap_mode) = self.wrap_mode {
230 properties.push(("wrap-mode", wrap_mode));
231 }
232 #[cfg(any(feature = "v3_16", feature = "dox"))]
233 {
234 if let Some(ref xalign) = self.xalign {
235 properties.push(("xalign", xalign));
236 }
237 }
238 #[cfg(any(feature = "v3_16", feature = "dox"))]
239 {
240 if let Some(ref yalign) = self.yalign {
241 properties.push(("yalign", yalign));
242 }
243 }
244 if let Some(ref app_paintable) = self.app_paintable {
245 properties.push(("app-paintable", app_paintable));
246 }
247 if let Some(ref can_default) = self.can_default {
248 properties.push(("can-default", can_default));
249 }
250 if let Some(ref can_focus) = self.can_focus {
251 properties.push(("can-focus", can_focus));
252 }
253 if let Some(ref events) = self.events {
254 properties.push(("events", events));
255 }
256 if let Some(ref expand) = self.expand {
257 properties.push(("expand", expand));
258 }
259 #[cfg(any(feature = "v3_20", feature = "dox"))]
260 {
261 if let Some(ref focus_on_click) = self.focus_on_click {
262 properties.push(("focus-on-click", focus_on_click));
263 }
264 }
265 if let Some(ref halign) = self.halign {
266 properties.push(("halign", halign));
267 }
268 if let Some(ref has_default) = self.has_default {
269 properties.push(("has-default", has_default));
270 }
271 if let Some(ref has_focus) = self.has_focus {
272 properties.push(("has-focus", has_focus));
273 }
274 if let Some(ref has_tooltip) = self.has_tooltip {
275 properties.push(("has-tooltip", has_tooltip));
276 }
277 if let Some(ref height_request) = self.height_request {
278 properties.push(("height-request", height_request));
279 }
280 if let Some(ref hexpand) = self.hexpand {
281 properties.push(("hexpand", hexpand));
282 }
283 if let Some(ref hexpand_set) = self.hexpand_set {
284 properties.push(("hexpand-set", hexpand_set));
285 }
286 if let Some(ref is_focus) = self.is_focus {
287 properties.push(("is-focus", is_focus));
288 }
289 if let Some(ref margin) = self.margin {
290 properties.push(("margin", margin));
291 }
292 if let Some(ref margin_bottom) = self.margin_bottom {
293 properties.push(("margin-bottom", margin_bottom));
294 }
295 if let Some(ref margin_end) = self.margin_end {
296 properties.push(("margin-end", margin_end));
297 }
298 if let Some(ref margin_start) = self.margin_start {
299 properties.push(("margin-start", margin_start));
300 }
301 if let Some(ref margin_top) = self.margin_top {
302 properties.push(("margin-top", margin_top));
303 }
304 if let Some(ref name) = self.name {
305 properties.push(("name", name));
306 }
307 if let Some(ref no_show_all) = self.no_show_all {
308 properties.push(("no-show-all", no_show_all));
309 }
310 if let Some(ref opacity) = self.opacity {
311 properties.push(("opacity", opacity));
312 }
313 if let Some(ref parent) = self.parent {
314 properties.push(("parent", parent));
315 }
316 if let Some(ref receives_default) = self.receives_default {
317 properties.push(("receives-default", receives_default));
318 }
319 if let Some(ref sensitive) = self.sensitive {
320 properties.push(("sensitive", sensitive));
321 }
322 if let Some(ref tooltip_markup) = self.tooltip_markup {
323 properties.push(("tooltip-markup", tooltip_markup));
324 }
325 if let Some(ref tooltip_text) = self.tooltip_text {
326 properties.push(("tooltip-text", tooltip_text));
327 }
328 if let Some(ref valign) = self.valign {
329 properties.push(("valign", valign));
330 }
331 if let Some(ref vexpand) = self.vexpand {
332 properties.push(("vexpand", vexpand));
333 }
334 if let Some(ref vexpand_set) = self.vexpand_set {
335 properties.push(("vexpand-set", vexpand_set));
336 }
337 if let Some(ref visible) = self.visible {
338 properties.push(("visible", visible));
339 }
340 if let Some(ref width_request) = self.width_request {
341 properties.push(("width-request", width_request));
342 }
343 glib::Object::new(Label::static_type(), &properties)
344 .expect("object new")
345 .downcast()
346 .expect("downcast")
347 }
348
349 pub fn angle(mut self, angle: f64) -> Self {
350 self.angle = Some(angle);
351 self
352 }
353
354 pub fn attributes(mut self, attributes: &pango::AttrList) -> Self {
355 self.attributes = Some(attributes.clone());
356 self
357 }
358
359 pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self {
360 self.ellipsize = Some(ellipsize);
361 self
362 }
363
364 pub fn justify(mut self, justify: Justification) -> Self {
365 self.justify = Some(justify);
366 self
367 }
368
369 pub fn label(mut self, label: &str) -> Self {
370 self.label = Some(label.to_string());
371 self
372 }
373
374 pub fn lines(mut self, lines: i32) -> Self {
375 self.lines = Some(lines);
376 self
377 }
378
379 pub fn max_width_chars(mut self, max_width_chars: i32) -> Self {
380 self.max_width_chars = Some(max_width_chars);
381 self
382 }
383
384 pub fn mnemonic_widget(mut self, mnemonic_widget: &Widget) -> Self {
385 self.mnemonic_widget = Some(mnemonic_widget.clone());
386 self
387 }
388
389 pub fn pattern(mut self, pattern: &str) -> Self {
390 self.pattern = Some(pattern.to_string());
391 self
392 }
393
394 pub fn selectable(mut self, selectable: bool) -> Self {
395 self.selectable = Some(selectable);
396 self
397 }
398
399 pub fn single_line_mode(mut self, single_line_mode: bool) -> Self {
400 self.single_line_mode = Some(single_line_mode);
401 self
402 }
403
404 pub fn track_visited_links(mut self, track_visited_links: bool) -> Self {
405 self.track_visited_links = Some(track_visited_links);
406 self
407 }
408
409 pub fn use_markup(mut self, use_markup: bool) -> Self {
410 self.use_markup = Some(use_markup);
411 self
412 }
413
414 pub fn use_underline(mut self, use_underline: bool) -> Self {
415 self.use_underline = Some(use_underline);
416 self
417 }
418
419 pub fn width_chars(mut self, width_chars: i32) -> Self {
420 self.width_chars = Some(width_chars);
421 self
422 }
423
424 pub fn wrap(mut self, wrap: bool) -> Self {
425 self.wrap = Some(wrap);
426 self
427 }
428
429 pub fn wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self {
430 self.wrap_mode = Some(wrap_mode);
431 self
432 }
433
434 #[cfg(any(feature = "v3_16", feature = "dox"))]
435 pub fn xalign(mut self, xalign: f32) -> Self {
436 self.xalign = Some(xalign);
437 self
438 }
439
440 #[cfg(any(feature = "v3_16", feature = "dox"))]
441 pub fn yalign(mut self, yalign: f32) -> Self {
442 self.yalign = Some(yalign);
443 self
444 }
445
446 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
447 self.app_paintable = Some(app_paintable);
448 self
449 }
450
451 pub fn can_default(mut self, can_default: bool) -> Self {
452 self.can_default = Some(can_default);
453 self
454 }
455
456 pub fn can_focus(mut self, can_focus: bool) -> Self {
457 self.can_focus = Some(can_focus);
458 self
459 }
460
461 pub fn events(mut self, events: gdk::EventMask) -> Self {
462 self.events = Some(events);
463 self
464 }
465
466 pub fn expand(mut self, expand: bool) -> Self {
467 self.expand = Some(expand);
468 self
469 }
470
471 #[cfg(any(feature = "v3_20", feature = "dox"))]
472 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
473 self.focus_on_click = Some(focus_on_click);
474 self
475 }
476
477 pub fn halign(mut self, halign: Align) -> Self {
478 self.halign = Some(halign);
479 self
480 }
481
482 pub fn has_default(mut self, has_default: bool) -> Self {
483 self.has_default = Some(has_default);
484 self
485 }
486
487 pub fn has_focus(mut self, has_focus: bool) -> Self {
488 self.has_focus = Some(has_focus);
489 self
490 }
491
492 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
493 self.has_tooltip = Some(has_tooltip);
494 self
495 }
496
497 pub fn height_request(mut self, height_request: i32) -> Self {
498 self.height_request = Some(height_request);
499 self
500 }
501
502 pub fn hexpand(mut self, hexpand: bool) -> Self {
503 self.hexpand = Some(hexpand);
504 self
505 }
506
507 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
508 self.hexpand_set = Some(hexpand_set);
509 self
510 }
511
512 pub fn is_focus(mut self, is_focus: bool) -> Self {
513 self.is_focus = Some(is_focus);
514 self
515 }
516
517 pub fn margin(mut self, margin: i32) -> Self {
518 self.margin = Some(margin);
519 self
520 }
521
522 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
523 self.margin_bottom = Some(margin_bottom);
524 self
525 }
526
527 pub fn margin_end(mut self, margin_end: i32) -> Self {
528 self.margin_end = Some(margin_end);
529 self
530 }
531
532 pub fn margin_start(mut self, margin_start: i32) -> Self {
533 self.margin_start = Some(margin_start);
534 self
535 }
536
537 pub fn margin_top(mut self, margin_top: i32) -> Self {
538 self.margin_top = Some(margin_top);
539 self
540 }
541
542 pub fn name(mut self, name: &str) -> Self {
543 self.name = Some(name.to_string());
544 self
545 }
546
547 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
548 self.no_show_all = Some(no_show_all);
549 self
550 }
551
552 pub fn opacity(mut self, opacity: f64) -> Self {
553 self.opacity = Some(opacity);
554 self
555 }
556
557 pub fn parent(mut self, parent: &Container) -> Self {
558 self.parent = Some(parent.clone());
559 self
560 }
561
562 pub fn receives_default(mut self, receives_default: bool) -> Self {
563 self.receives_default = Some(receives_default);
564 self
565 }
566
567 pub fn sensitive(mut self, sensitive: bool) -> Self {
568 self.sensitive = Some(sensitive);
569 self
570 }
571
572 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
573 self.tooltip_markup = Some(tooltip_markup.to_string());
574 self
575 }
576
577 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
578 self.tooltip_text = Some(tooltip_text.to_string());
579 self
580 }
581
582 pub fn valign(mut self, valign: Align) -> Self {
583 self.valign = Some(valign);
584 self
585 }
586
587 pub fn vexpand(mut self, vexpand: bool) -> Self {
588 self.vexpand = Some(vexpand);
589 self
590 }
591
592 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
593 self.vexpand_set = Some(vexpand_set);
594 self
595 }
596
597 pub fn visible(mut self, visible: bool) -> Self {
598 self.visible = Some(visible);
599 self
600 }
601
602 pub fn width_request(mut self, width_request: i32) -> Self {
603 self.width_request = Some(width_request);
604 self
605 }
606}
607
608pub const NONE_LABEL: Option<&Label> = None;
609
610pub trait LabelExt: 'static {
611 fn get_angle(&self) -> f64;
612
613 fn get_attributes(&self) -> Option<pango::AttrList>;
614
615 fn get_current_uri(&self) -> Option<GString>;
616
617 fn get_ellipsize(&self) -> pango::EllipsizeMode;
618
619 fn get_justify(&self) -> Justification;
620
621 fn get_label(&self) -> Option<GString>;
622
623 fn get_layout(&self) -> Option<pango::Layout>;
624
625 fn get_layout_offsets(&self) -> (i32, i32);
626
627 fn get_line_wrap(&self) -> bool;
628
629 fn get_line_wrap_mode(&self) -> pango::WrapMode;
630
631 fn get_lines(&self) -> i32;
632
633 fn get_max_width_chars(&self) -> i32;
634
635 fn get_mnemonic_keyval(&self) -> u32;
636
637 fn get_mnemonic_widget(&self) -> Option<Widget>;
638
639 fn get_selectable(&self) -> bool;
640
641 fn get_selection_bounds(&self) -> Option<(i32, i32)>;
642
643 fn get_single_line_mode(&self) -> bool;
644
645 fn get_text(&self) -> Option<GString>;
646
647 fn get_track_visited_links(&self) -> bool;
648
649 fn get_use_markup(&self) -> bool;
650
651 fn get_use_underline(&self) -> bool;
652
653 fn get_width_chars(&self) -> i32;
654
655 #[cfg(any(feature = "v3_16", feature = "dox"))]
656 fn get_xalign(&self) -> f32;
657
658 #[cfg(any(feature = "v3_16", feature = "dox"))]
659 fn get_yalign(&self) -> f32;
660
661 fn select_region(&self, start_offset: i32, end_offset: i32);
662
663 fn set_angle(&self, angle: f64);
664
665 fn set_attributes(&self, attrs: Option<&pango::AttrList>);
666
667 fn set_ellipsize(&self, mode: pango::EllipsizeMode);
668
669 fn set_justify(&self, jtype: Justification);
670
671 fn set_label(&self, str: &str);
672
673 fn set_line_wrap(&self, wrap: bool);
674
675 fn set_line_wrap_mode(&self, wrap_mode: pango::WrapMode);
676
677 fn set_lines(&self, lines: i32);
678
679 fn set_markup(&self, str: &str);
680
681 fn set_markup_with_mnemonic(&self, str: &str);
682
683 fn set_max_width_chars(&self, n_chars: i32);
684
685 fn set_mnemonic_widget<P: IsA<Widget>>(&self, widget: Option<&P>);
686
687 fn set_pattern(&self, pattern: &str);
688
689 fn set_selectable(&self, setting: bool);
690
691 fn set_single_line_mode(&self, single_line_mode: bool);
692
693 fn set_text(&self, str: &str);
694
695 fn set_text_with_mnemonic(&self, str: &str);
696
697 fn set_track_visited_links(&self, track_links: bool);
698
699 fn set_use_markup(&self, setting: bool);
700
701 fn set_use_underline(&self, setting: bool);
702
703 fn set_width_chars(&self, n_chars: i32);
704
705 #[cfg(any(feature = "v3_16", feature = "dox"))]
706 fn set_xalign(&self, xalign: f32);
707
708 #[cfg(any(feature = "v3_16", feature = "dox"))]
709 fn set_yalign(&self, yalign: f32);
710
711 fn get_property_cursor_position(&self) -> i32;
712
713 fn get_property_selection_bound(&self) -> i32;
714
715 fn get_property_wrap(&self) -> bool;
716
717 fn set_property_wrap(&self, wrap: bool);
718
719 fn get_property_wrap_mode(&self) -> pango::WrapMode;
720
721 fn set_property_wrap_mode(&self, wrap_mode: pango::WrapMode);
722
723 fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
724
725 fn emit_activate_current_link(&self);
726
727 fn connect_activate_link<F: Fn(&Self, &str) -> Inhibit + 'static>(
728 &self,
729 f: F,
730 ) -> SignalHandlerId;
731
732 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
733
734 fn emit_copy_clipboard(&self);
735
736 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
737 &self,
738 f: F,
739 ) -> SignalHandlerId;
740
741 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool);
742
743 fn connect_populate_popup<F: Fn(&Self, &Menu) + 'static>(&self, f: F) -> SignalHandlerId;
744
745 fn connect_property_angle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
746
747 fn connect_property_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
748
749 fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
750 &self,
751 f: F,
752 ) -> SignalHandlerId;
753
754 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
755
756 fn connect_property_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
757
758 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
759
760 fn connect_property_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
761
762 fn connect_property_max_width_chars_notify<F: Fn(&Self) + 'static>(
763 &self,
764 f: F,
765 ) -> SignalHandlerId;
766
767 fn connect_property_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(
768 &self,
769 f: F,
770 ) -> SignalHandlerId;
771
772 fn connect_property_mnemonic_widget_notify<F: Fn(&Self) + 'static>(
773 &self,
774 f: F,
775 ) -> SignalHandlerId;
776
777 fn connect_property_pattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
778
779 fn connect_property_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
780
781 fn connect_property_selection_bound_notify<F: Fn(&Self) + 'static>(
782 &self,
783 f: F,
784 ) -> SignalHandlerId;
785
786 fn connect_property_single_line_mode_notify<F: Fn(&Self) + 'static>(
787 &self,
788 f: F,
789 ) -> SignalHandlerId;
790
791 fn connect_property_track_visited_links_notify<F: Fn(&Self) + 'static>(
792 &self,
793 f: F,
794 ) -> SignalHandlerId;
795
796 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
797
798 fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>(
799 &self,
800 f: F,
801 ) -> SignalHandlerId;
802
803 fn connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
804
805 fn connect_property_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
806
807 fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
808
809 #[cfg(any(feature = "v3_16", feature = "dox"))]
810 fn connect_property_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
811
812 #[cfg(any(feature = "v3_16", feature = "dox"))]
813 fn connect_property_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
814}
815
816impl<O: IsA<Label>> LabelExt for O {
817 fn get_angle(&self) -> f64 {
818 unsafe { gtk_sys::gtk_label_get_angle(self.as_ref().to_glib_none().0) }
819 }
820
821 fn get_attributes(&self) -> Option<pango::AttrList> {
822 unsafe {
823 from_glib_none(gtk_sys::gtk_label_get_attributes(
824 self.as_ref().to_glib_none().0,
825 ))
826 }
827 }
828
829 fn get_current_uri(&self) -> Option<GString> {
830 unsafe {
831 from_glib_none(gtk_sys::gtk_label_get_current_uri(
832 self.as_ref().to_glib_none().0,
833 ))
834 }
835 }
836
837 fn get_ellipsize(&self) -> pango::EllipsizeMode {
838 unsafe {
839 from_glib(gtk_sys::gtk_label_get_ellipsize(
840 self.as_ref().to_glib_none().0,
841 ))
842 }
843 }
844
845 fn get_justify(&self) -> Justification {
846 unsafe {
847 from_glib(gtk_sys::gtk_label_get_justify(
848 self.as_ref().to_glib_none().0,
849 ))
850 }
851 }
852
853 fn get_label(&self) -> Option<GString> {
854 unsafe { from_glib_none(gtk_sys::gtk_label_get_label(self.as_ref().to_glib_none().0)) }
855 }
856
857 fn get_layout(&self) -> Option<pango::Layout> {
858 unsafe {
859 from_glib_none(gtk_sys::gtk_label_get_layout(
860 self.as_ref().to_glib_none().0,
861 ))
862 }
863 }
864
865 fn get_layout_offsets(&self) -> (i32, i32) {
866 unsafe {
867 let mut x = mem::uninitialized();
868 let mut y = mem::uninitialized();
869 gtk_sys::gtk_label_get_layout_offsets(self.as_ref().to_glib_none().0, &mut x, &mut y);
870 (x, y)
871 }
872 }
873
874 fn get_line_wrap(&self) -> bool {
875 unsafe {
876 from_glib(gtk_sys::gtk_label_get_line_wrap(
877 self.as_ref().to_glib_none().0,
878 ))
879 }
880 }
881
882 fn get_line_wrap_mode(&self) -> pango::WrapMode {
883 unsafe {
884 from_glib(gtk_sys::gtk_label_get_line_wrap_mode(
885 self.as_ref().to_glib_none().0,
886 ))
887 }
888 }
889
890 fn get_lines(&self) -> i32 {
891 unsafe { gtk_sys::gtk_label_get_lines(self.as_ref().to_glib_none().0) }
892 }
893
894 fn get_max_width_chars(&self) -> i32 {
895 unsafe { gtk_sys::gtk_label_get_max_width_chars(self.as_ref().to_glib_none().0) }
896 }
897
898 fn get_mnemonic_keyval(&self) -> u32 {
899 unsafe { gtk_sys::gtk_label_get_mnemonic_keyval(self.as_ref().to_glib_none().0) }
900 }
901
902 fn get_mnemonic_widget(&self) -> Option<Widget> {
903 unsafe {
904 from_glib_none(gtk_sys::gtk_label_get_mnemonic_widget(
905 self.as_ref().to_glib_none().0,
906 ))
907 }
908 }
909
910 fn get_selectable(&self) -> bool {
911 unsafe {
912 from_glib(gtk_sys::gtk_label_get_selectable(
913 self.as_ref().to_glib_none().0,
914 ))
915 }
916 }
917
918 fn get_selection_bounds(&self) -> Option<(i32, i32)> {
919 unsafe {
920 let mut start = mem::uninitialized();
921 let mut end = mem::uninitialized();
922 let ret = from_glib(gtk_sys::gtk_label_get_selection_bounds(
923 self.as_ref().to_glib_none().0,
924 &mut start,
925 &mut end,
926 ));
927 if ret {
928 Some((start, end))
929 } else {
930 None
931 }
932 }
933 }
934
935 fn get_single_line_mode(&self) -> bool {
936 unsafe {
937 from_glib(gtk_sys::gtk_label_get_single_line_mode(
938 self.as_ref().to_glib_none().0,
939 ))
940 }
941 }
942
943 fn get_text(&self) -> Option<GString> {
944 unsafe { from_glib_none(gtk_sys::gtk_label_get_text(self.as_ref().to_glib_none().0)) }
945 }
946
947 fn get_track_visited_links(&self) -> bool {
948 unsafe {
949 from_glib(gtk_sys::gtk_label_get_track_visited_links(
950 self.as_ref().to_glib_none().0,
951 ))
952 }
953 }
954
955 fn get_use_markup(&self) -> bool {
956 unsafe {
957 from_glib(gtk_sys::gtk_label_get_use_markup(
958 self.as_ref().to_glib_none().0,
959 ))
960 }
961 }
962
963 fn get_use_underline(&self) -> bool {
964 unsafe {
965 from_glib(gtk_sys::gtk_label_get_use_underline(
966 self.as_ref().to_glib_none().0,
967 ))
968 }
969 }
970
971 fn get_width_chars(&self) -> i32 {
972 unsafe { gtk_sys::gtk_label_get_width_chars(self.as_ref().to_glib_none().0) }
973 }
974
975 #[cfg(any(feature = "v3_16", feature = "dox"))]
976 fn get_xalign(&self) -> f32 {
977 unsafe { gtk_sys::gtk_label_get_xalign(self.as_ref().to_glib_none().0) }
978 }
979
980 #[cfg(any(feature = "v3_16", feature = "dox"))]
981 fn get_yalign(&self) -> f32 {
982 unsafe { gtk_sys::gtk_label_get_yalign(self.as_ref().to_glib_none().0) }
983 }
984
985 fn select_region(&self, start_offset: i32, end_offset: i32) {
986 unsafe {
987 gtk_sys::gtk_label_select_region(
988 self.as_ref().to_glib_none().0,
989 start_offset,
990 end_offset,
991 );
992 }
993 }
994
995 fn set_angle(&self, angle: f64) {
996 unsafe {
997 gtk_sys::gtk_label_set_angle(self.as_ref().to_glib_none().0, angle);
998 }
999 }
1000
1001 fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
1002 unsafe {
1003 gtk_sys::gtk_label_set_attributes(
1004 self.as_ref().to_glib_none().0,
1005 attrs.to_glib_none().0,
1006 );
1007 }
1008 }
1009
1010 fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
1011 unsafe {
1012 gtk_sys::gtk_label_set_ellipsize(self.as_ref().to_glib_none().0, mode.to_glib());
1013 }
1014 }
1015
1016 fn set_justify(&self, jtype: Justification) {
1017 unsafe {
1018 gtk_sys::gtk_label_set_justify(self.as_ref().to_glib_none().0, jtype.to_glib());
1019 }
1020 }
1021
1022 fn set_label(&self, str: &str) {
1023 unsafe {
1024 gtk_sys::gtk_label_set_label(self.as_ref().to_glib_none().0, str.to_glib_none().0);
1025 }
1026 }
1027
1028 fn set_line_wrap(&self, wrap: bool) {
1029 unsafe {
1030 gtk_sys::gtk_label_set_line_wrap(self.as_ref().to_glib_none().0, wrap.to_glib());
1031 }
1032 }
1033
1034 fn set_line_wrap_mode(&self, wrap_mode: pango::WrapMode) {
1035 unsafe {
1036 gtk_sys::gtk_label_set_line_wrap_mode(
1037 self.as_ref().to_glib_none().0,
1038 wrap_mode.to_glib(),
1039 );
1040 }
1041 }
1042
1043 fn set_lines(&self, lines: i32) {
1044 unsafe {
1045 gtk_sys::gtk_label_set_lines(self.as_ref().to_glib_none().0, lines);
1046 }
1047 }
1048
1049 fn set_markup(&self, str: &str) {
1050 unsafe {
1051 gtk_sys::gtk_label_set_markup(self.as_ref().to_glib_none().0, str.to_glib_none().0);
1052 }
1053 }
1054
1055 fn set_markup_with_mnemonic(&self, str: &str) {
1056 unsafe {
1057 gtk_sys::gtk_label_set_markup_with_mnemonic(
1058 self.as_ref().to_glib_none().0,
1059 str.to_glib_none().0,
1060 );
1061 }
1062 }
1063
1064 fn set_max_width_chars(&self, n_chars: i32) {
1065 unsafe {
1066 gtk_sys::gtk_label_set_max_width_chars(self.as_ref().to_glib_none().0, n_chars);
1067 }
1068 }
1069
1070 fn set_mnemonic_widget<P: IsA<Widget>>(&self, widget: Option<&P>) {
1071 unsafe {
1072 gtk_sys::gtk_label_set_mnemonic_widget(
1073 self.as_ref().to_glib_none().0,
1074 widget.map(|p| p.as_ref()).to_glib_none().0,
1075 );
1076 }
1077 }
1078
1079 fn set_pattern(&self, pattern: &str) {
1080 unsafe {
1081 gtk_sys::gtk_label_set_pattern(
1082 self.as_ref().to_glib_none().0,
1083 pattern.to_glib_none().0,
1084 );
1085 }
1086 }
1087
1088 fn set_selectable(&self, setting: bool) {
1089 unsafe {
1090 gtk_sys::gtk_label_set_selectable(self.as_ref().to_glib_none().0, setting.to_glib());
1091 }
1092 }
1093
1094 fn set_single_line_mode(&self, single_line_mode: bool) {
1095 unsafe {
1096 gtk_sys::gtk_label_set_single_line_mode(
1097 self.as_ref().to_glib_none().0,
1098 single_line_mode.to_glib(),
1099 );
1100 }
1101 }
1102
1103 fn set_text(&self, str: &str) {
1104 unsafe {
1105 gtk_sys::gtk_label_set_text(self.as_ref().to_glib_none().0, str.to_glib_none().0);
1106 }
1107 }
1108
1109 fn set_text_with_mnemonic(&self, str: &str) {
1110 unsafe {
1111 gtk_sys::gtk_label_set_text_with_mnemonic(
1112 self.as_ref().to_glib_none().0,
1113 str.to_glib_none().0,
1114 );
1115 }
1116 }
1117
1118 fn set_track_visited_links(&self, track_links: bool) {
1119 unsafe {
1120 gtk_sys::gtk_label_set_track_visited_links(
1121 self.as_ref().to_glib_none().0,
1122 track_links.to_glib(),
1123 );
1124 }
1125 }
1126
1127 fn set_use_markup(&self, setting: bool) {
1128 unsafe {
1129 gtk_sys::gtk_label_set_use_markup(self.as_ref().to_glib_none().0, setting.to_glib());
1130 }
1131 }
1132
1133 fn set_use_underline(&self, setting: bool) {
1134 unsafe {
1135 gtk_sys::gtk_label_set_use_underline(self.as_ref().to_glib_none().0, setting.to_glib());
1136 }
1137 }
1138
1139 fn set_width_chars(&self, n_chars: i32) {
1140 unsafe {
1141 gtk_sys::gtk_label_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
1142 }
1143 }
1144
1145 #[cfg(any(feature = "v3_16", feature = "dox"))]
1146 fn set_xalign(&self, xalign: f32) {
1147 unsafe {
1148 gtk_sys::gtk_label_set_xalign(self.as_ref().to_glib_none().0, xalign);
1149 }
1150 }
1151
1152 #[cfg(any(feature = "v3_16", feature = "dox"))]
1153 fn set_yalign(&self, yalign: f32) {
1154 unsafe {
1155 gtk_sys::gtk_label_set_yalign(self.as_ref().to_glib_none().0, yalign);
1156 }
1157 }
1158
1159 fn get_property_cursor_position(&self) -> i32 {
1160 unsafe {
1161 let mut value = Value::from_type(<i32 as StaticType>::static_type());
1162 gobject_sys::g_object_get_property(
1163 self.to_glib_none().0 as *mut gobject_sys::GObject,
1164 b"cursor-position\0".as_ptr() as *const _,
1165 value.to_glib_none_mut().0,
1166 );
1167 value.get().unwrap()
1168 }
1169 }
1170
1171 fn get_property_selection_bound(&self) -> i32 {
1172 unsafe {
1173 let mut value = Value::from_type(<i32 as StaticType>::static_type());
1174 gobject_sys::g_object_get_property(
1175 self.to_glib_none().0 as *mut gobject_sys::GObject,
1176 b"selection-bound\0".as_ptr() as *const _,
1177 value.to_glib_none_mut().0,
1178 );
1179 value.get().unwrap()
1180 }
1181 }
1182
1183 fn get_property_wrap(&self) -> bool {
1184 unsafe {
1185 let mut value = Value::from_type(<bool as StaticType>::static_type());
1186 gobject_sys::g_object_get_property(
1187 self.to_glib_none().0 as *mut gobject_sys::GObject,
1188 b"wrap\0".as_ptr() as *const _,
1189 value.to_glib_none_mut().0,
1190 );
1191 value.get().unwrap()
1192 }
1193 }
1194
1195 fn set_property_wrap(&self, wrap: bool) {
1196 unsafe {
1197 gobject_sys::g_object_set_property(
1198 self.to_glib_none().0 as *mut gobject_sys::GObject,
1199 b"wrap\0".as_ptr() as *const _,
1200 Value::from(&wrap).to_glib_none().0,
1201 );
1202 }
1203 }
1204
1205 fn get_property_wrap_mode(&self) -> pango::WrapMode {
1206 unsafe {
1207 let mut value = Value::from_type(<pango::WrapMode as StaticType>::static_type());
1208 gobject_sys::g_object_get_property(
1209 self.to_glib_none().0 as *mut gobject_sys::GObject,
1210 b"wrap-mode\0".as_ptr() as *const _,
1211 value.to_glib_none_mut().0,
1212 );
1213 value.get().unwrap()
1214 }
1215 }
1216
1217 fn set_property_wrap_mode(&self, wrap_mode: pango::WrapMode) {
1218 unsafe {
1219 gobject_sys::g_object_set_property(
1220 self.to_glib_none().0 as *mut gobject_sys::GObject,
1221 b"wrap-mode\0".as_ptr() as *const _,
1222 Value::from(&wrap_mode).to_glib_none().0,
1223 );
1224 }
1225 }
1226
1227 fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1228 unsafe extern "C" fn activate_current_link_trampoline<P, F: Fn(&P) + 'static>(
1229 this: *mut gtk_sys::GtkLabel,
1230 f: glib_sys::gpointer,
1231 ) where
1232 P: IsA<Label>,
1233 {
1234 let f: &F = &*(f as *const F);
1235 f(&Label::from_glib_borrow(this).unsafe_cast())
1236 }
1237 unsafe {
1238 let f: Box_<F> = Box_::new(f);
1239 connect_raw(
1240 self.as_ptr() as *mut _,
1241 b"activate-current-link\0".as_ptr() as *const _,
1242 Some(transmute(
1243 activate_current_link_trampoline::<Self, F> as usize,
1244 )),
1245 Box_::into_raw(f),
1246 )
1247 }
1248 }
1249
1250 fn emit_activate_current_link(&self) {
1251 let _ = unsafe {
1252 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1253 .emit("activate-current-link", &[])
1254 .unwrap()
1255 };
1256 }
1257
1258 fn connect_activate_link<F: Fn(&Self, &str) -> Inhibit + 'static>(
1259 &self,
1260 f: F,
1261 ) -> SignalHandlerId {
1262 unsafe extern "C" fn activate_link_trampoline<P, F: Fn(&P, &str) -> Inhibit + 'static>(
1263 this: *mut gtk_sys::GtkLabel,
1264 uri: *mut libc::c_char,
1265 f: glib_sys::gpointer,
1266 ) -> glib_sys::gboolean
1267 where
1268 P: IsA<Label>,
1269 {
1270 let f: &F = &*(f as *const F);
1271 f(
1272 &Label::from_glib_borrow(this).unsafe_cast(),
1273 &GString::from_glib_borrow(uri),
1274 )
1275 .to_glib()
1276 }
1277 unsafe {
1278 let f: Box_<F> = Box_::new(f);
1279 connect_raw(
1280 self.as_ptr() as *mut _,
1281 b"activate-link\0".as_ptr() as *const _,
1282 Some(transmute(activate_link_trampoline::<Self, F> as usize)),
1283 Box_::into_raw(f),
1284 )
1285 }
1286 }
1287
1288 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1289 unsafe extern "C" fn copy_clipboard_trampoline<P, F: Fn(&P) + 'static>(
1290 this: *mut gtk_sys::GtkLabel,
1291 f: glib_sys::gpointer,
1292 ) where
1293 P: IsA<Label>,
1294 {
1295 let f: &F = &*(f as *const F);
1296 f(&Label::from_glib_borrow(this).unsafe_cast())
1297 }
1298 unsafe {
1299 let f: Box_<F> = Box_::new(f);
1300 connect_raw(
1301 self.as_ptr() as *mut _,
1302 b"copy-clipboard\0".as_ptr() as *const _,
1303 Some(transmute(copy_clipboard_trampoline::<Self, F> as usize)),
1304 Box_::into_raw(f),
1305 )
1306 }
1307 }
1308
1309 fn emit_copy_clipboard(&self) {
1310 let _ = unsafe {
1311 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1312 .emit("copy-clipboard", &[])
1313 .unwrap()
1314 };
1315 }
1316
1317 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
1318 &self,
1319 f: F,
1320 ) -> SignalHandlerId {
1321 unsafe extern "C" fn move_cursor_trampoline<
1322 P,
1323 F: Fn(&P, MovementStep, i32, bool) + 'static,
1324 >(
1325 this: *mut gtk_sys::GtkLabel,
1326 step: gtk_sys::GtkMovementStep,
1327 count: libc::c_int,
1328 extend_selection: glib_sys::gboolean,
1329 f: glib_sys::gpointer,
1330 ) where
1331 P: IsA<Label>,
1332 {
1333 let f: &F = &*(f as *const F);
1334 f(
1335 &Label::from_glib_borrow(this).unsafe_cast(),
1336 from_glib(step),
1337 count,
1338 from_glib(extend_selection),
1339 )
1340 }
1341 unsafe {
1342 let f: Box_<F> = Box_::new(f);
1343 connect_raw(
1344 self.as_ptr() as *mut _,
1345 b"move-cursor\0".as_ptr() as *const _,
1346 Some(transmute(move_cursor_trampoline::<Self, F> as usize)),
1347 Box_::into_raw(f),
1348 )
1349 }
1350 }
1351
1352 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
1353 let _ = unsafe {
1354 glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1355 .emit("move-cursor", &[&step, &count, &extend_selection])
1356 .unwrap()
1357 };
1358 }
1359
1360 fn connect_populate_popup<F: Fn(&Self, &Menu) + 'static>(&self, f: F) -> SignalHandlerId {
1361 unsafe extern "C" fn populate_popup_trampoline<P, F: Fn(&P, &Menu) + 'static>(
1362 this: *mut gtk_sys::GtkLabel,
1363 menu: *mut gtk_sys::GtkMenu,
1364 f: glib_sys::gpointer,
1365 ) where
1366 P: IsA<Label>,
1367 {
1368 let f: &F = &*(f as *const F);
1369 f(
1370 &Label::from_glib_borrow(this).unsafe_cast(),
1371 &from_glib_borrow(menu),
1372 )
1373 }
1374 unsafe {
1375 let f: Box_<F> = Box_::new(f);
1376 connect_raw(
1377 self.as_ptr() as *mut _,
1378 b"populate-popup\0".as_ptr() as *const _,
1379 Some(transmute(populate_popup_trampoline::<Self, F> as usize)),
1380 Box_::into_raw(f),
1381 )
1382 }
1383 }
1384
1385 fn connect_property_angle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1386 unsafe extern "C" fn notify_angle_trampoline<P, F: Fn(&P) + 'static>(
1387 this: *mut gtk_sys::GtkLabel,
1388 _param_spec: glib_sys::gpointer,
1389 f: glib_sys::gpointer,
1390 ) where
1391 P: IsA<Label>,
1392 {
1393 let f: &F = &*(f as *const F);
1394 f(&Label::from_glib_borrow(this).unsafe_cast())
1395 }
1396 unsafe {
1397 let f: Box_<F> = Box_::new(f);
1398 connect_raw(
1399 self.as_ptr() as *mut _,
1400 b"notify::angle\0".as_ptr() as *const _,
1401 Some(transmute(notify_angle_trampoline::<Self, F> as usize)),
1402 Box_::into_raw(f),
1403 )
1404 }
1405 }
1406
1407 fn connect_property_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1408 unsafe extern "C" fn notify_attributes_trampoline<P, F: Fn(&P) + 'static>(
1409 this: *mut gtk_sys::GtkLabel,
1410 _param_spec: glib_sys::gpointer,
1411 f: glib_sys::gpointer,
1412 ) where
1413 P: IsA<Label>,
1414 {
1415 let f: &F = &*(f as *const F);
1416 f(&Label::from_glib_borrow(this).unsafe_cast())
1417 }
1418 unsafe {
1419 let f: Box_<F> = Box_::new(f);
1420 connect_raw(
1421 self.as_ptr() as *mut _,
1422 b"notify::attributes\0".as_ptr() as *const _,
1423 Some(transmute(notify_attributes_trampoline::<Self, F> as usize)),
1424 Box_::into_raw(f),
1425 )
1426 }
1427 }
1428
1429 fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
1430 &self,
1431 f: F,
1432 ) -> SignalHandlerId {
1433 unsafe extern "C" fn notify_cursor_position_trampoline<P, F: Fn(&P) + 'static>(
1434 this: *mut gtk_sys::GtkLabel,
1435 _param_spec: glib_sys::gpointer,
1436 f: glib_sys::gpointer,
1437 ) where
1438 P: IsA<Label>,
1439 {
1440 let f: &F = &*(f as *const F);
1441 f(&Label::from_glib_borrow(this).unsafe_cast())
1442 }
1443 unsafe {
1444 let f: Box_<F> = Box_::new(f);
1445 connect_raw(
1446 self.as_ptr() as *mut _,
1447 b"notify::cursor-position\0".as_ptr() as *const _,
1448 Some(transmute(
1449 notify_cursor_position_trampoline::<Self, F> as usize,
1450 )),
1451 Box_::into_raw(f),
1452 )
1453 }
1454 }
1455
1456 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1457 unsafe extern "C" fn notify_ellipsize_trampoline<P, F: Fn(&P) + 'static>(
1458 this: *mut gtk_sys::GtkLabel,
1459 _param_spec: glib_sys::gpointer,
1460 f: glib_sys::gpointer,
1461 ) where
1462 P: IsA<Label>,
1463 {
1464 let f: &F = &*(f as *const F);
1465 f(&Label::from_glib_borrow(this).unsafe_cast())
1466 }
1467 unsafe {
1468 let f: Box_<F> = Box_::new(f);
1469 connect_raw(
1470 self.as_ptr() as *mut _,
1471 b"notify::ellipsize\0".as_ptr() as *const _,
1472 Some(transmute(notify_ellipsize_trampoline::<Self, F> as usize)),
1473 Box_::into_raw(f),
1474 )
1475 }
1476 }
1477
1478 fn connect_property_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1479 unsafe extern "C" fn notify_justify_trampoline<P, F: Fn(&P) + 'static>(
1480 this: *mut gtk_sys::GtkLabel,
1481 _param_spec: glib_sys::gpointer,
1482 f: glib_sys::gpointer,
1483 ) where
1484 P: IsA<Label>,
1485 {
1486 let f: &F = &*(f as *const F);
1487 f(&Label::from_glib_borrow(this).unsafe_cast())
1488 }
1489 unsafe {
1490 let f: Box_<F> = Box_::new(f);
1491 connect_raw(
1492 self.as_ptr() as *mut _,
1493 b"notify::justify\0".as_ptr() as *const _,
1494 Some(transmute(notify_justify_trampoline::<Self, F> as usize)),
1495 Box_::into_raw(f),
1496 )
1497 }
1498 }
1499
1500 fn connect_property_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1501 unsafe extern "C" fn notify_label_trampoline<P, F: Fn(&P) + 'static>(
1502 this: *mut gtk_sys::GtkLabel,
1503 _param_spec: glib_sys::gpointer,
1504 f: glib_sys::gpointer,
1505 ) where
1506 P: IsA<Label>,
1507 {
1508 let f: &F = &*(f as *const F);
1509 f(&Label::from_glib_borrow(this).unsafe_cast())
1510 }
1511 unsafe {
1512 let f: Box_<F> = Box_::new(f);
1513 connect_raw(
1514 self.as_ptr() as *mut _,
1515 b"notify::label\0".as_ptr() as *const _,
1516 Some(transmute(notify_label_trampoline::<Self, F> as usize)),
1517 Box_::into_raw(f),
1518 )
1519 }
1520 }
1521
1522 fn connect_property_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1523 unsafe extern "C" fn notify_lines_trampoline<P, F: Fn(&P) + 'static>(
1524 this: *mut gtk_sys::GtkLabel,
1525 _param_spec: glib_sys::gpointer,
1526 f: glib_sys::gpointer,
1527 ) where
1528 P: IsA<Label>,
1529 {
1530 let f: &F = &*(f as *const F);
1531 f(&Label::from_glib_borrow(this).unsafe_cast())
1532 }
1533 unsafe {
1534 let f: Box_<F> = Box_::new(f);
1535 connect_raw(
1536 self.as_ptr() as *mut _,
1537 b"notify::lines\0".as_ptr() as *const _,
1538 Some(transmute(notify_lines_trampoline::<Self, F> as usize)),
1539 Box_::into_raw(f),
1540 )
1541 }
1542 }
1543
1544 fn connect_property_max_width_chars_notify<F: Fn(&Self) + 'static>(
1545 &self,
1546 f: F,
1547 ) -> SignalHandlerId {
1548 unsafe extern "C" fn notify_max_width_chars_trampoline<P, F: Fn(&P) + 'static>(
1549 this: *mut gtk_sys::GtkLabel,
1550 _param_spec: glib_sys::gpointer,
1551 f: glib_sys::gpointer,
1552 ) where
1553 P: IsA<Label>,
1554 {
1555 let f: &F = &*(f as *const F);
1556 f(&Label::from_glib_borrow(this).unsafe_cast())
1557 }
1558 unsafe {
1559 let f: Box_<F> = Box_::new(f);
1560 connect_raw(
1561 self.as_ptr() as *mut _,
1562 b"notify::max-width-chars\0".as_ptr() as *const _,
1563 Some(transmute(
1564 notify_max_width_chars_trampoline::<Self, F> as usize,
1565 )),
1566 Box_::into_raw(f),
1567 )
1568 }
1569 }
1570
1571 fn connect_property_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(
1572 &self,
1573 f: F,
1574 ) -> SignalHandlerId {
1575 unsafe extern "C" fn notify_mnemonic_keyval_trampoline<P, F: Fn(&P) + 'static>(
1576 this: *mut gtk_sys::GtkLabel,
1577 _param_spec: glib_sys::gpointer,
1578 f: glib_sys::gpointer,
1579 ) where
1580 P: IsA<Label>,
1581 {
1582 let f: &F = &*(f as *const F);
1583 f(&Label::from_glib_borrow(this).unsafe_cast())
1584 }
1585 unsafe {
1586 let f: Box_<F> = Box_::new(f);
1587 connect_raw(
1588 self.as_ptr() as *mut _,
1589 b"notify::mnemonic-keyval\0".as_ptr() as *const _,
1590 Some(transmute(
1591 notify_mnemonic_keyval_trampoline::<Self, F> as usize,
1592 )),
1593 Box_::into_raw(f),
1594 )
1595 }
1596 }
1597
1598 fn connect_property_mnemonic_widget_notify<F: Fn(&Self) + 'static>(
1599 &self,
1600 f: F,
1601 ) -> SignalHandlerId {
1602 unsafe extern "C" fn notify_mnemonic_widget_trampoline<P, F: Fn(&P) + 'static>(
1603 this: *mut gtk_sys::GtkLabel,
1604 _param_spec: glib_sys::gpointer,
1605 f: glib_sys::gpointer,
1606 ) where
1607 P: IsA<Label>,
1608 {
1609 let f: &F = &*(f as *const F);
1610 f(&Label::from_glib_borrow(this).unsafe_cast())
1611 }
1612 unsafe {
1613 let f: Box_<F> = Box_::new(f);
1614 connect_raw(
1615 self.as_ptr() as *mut _,
1616 b"notify::mnemonic-widget\0".as_ptr() as *const _,
1617 Some(transmute(
1618 notify_mnemonic_widget_trampoline::<Self, F> as usize,
1619 )),
1620 Box_::into_raw(f),
1621 )
1622 }
1623 }
1624
1625 fn connect_property_pattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1626 unsafe extern "C" fn notify_pattern_trampoline<P, F: Fn(&P) + 'static>(
1627 this: *mut gtk_sys::GtkLabel,
1628 _param_spec: glib_sys::gpointer,
1629 f: glib_sys::gpointer,
1630 ) where
1631 P: IsA<Label>,
1632 {
1633 let f: &F = &*(f as *const F);
1634 f(&Label::from_glib_borrow(this).unsafe_cast())
1635 }
1636 unsafe {
1637 let f: Box_<F> = Box_::new(f);
1638 connect_raw(
1639 self.as_ptr() as *mut _,
1640 b"notify::pattern\0".as_ptr() as *const _,
1641 Some(transmute(notify_pattern_trampoline::<Self, F> as usize)),
1642 Box_::into_raw(f),
1643 )
1644 }
1645 }
1646
1647 fn connect_property_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1648 unsafe extern "C" fn notify_selectable_trampoline<P, F: Fn(&P) + 'static>(
1649 this: *mut gtk_sys::GtkLabel,
1650 _param_spec: glib_sys::gpointer,
1651 f: glib_sys::gpointer,
1652 ) where
1653 P: IsA<Label>,
1654 {
1655 let f: &F = &*(f as *const F);
1656 f(&Label::from_glib_borrow(this).unsafe_cast())
1657 }
1658 unsafe {
1659 let f: Box_<F> = Box_::new(f);
1660 connect_raw(
1661 self.as_ptr() as *mut _,
1662 b"notify::selectable\0".as_ptr() as *const _,
1663 Some(transmute(notify_selectable_trampoline::<Self, F> as usize)),
1664 Box_::into_raw(f),
1665 )
1666 }
1667 }
1668
1669 fn connect_property_selection_bound_notify<F: Fn(&Self) + 'static>(
1670 &self,
1671 f: F,
1672 ) -> SignalHandlerId {
1673 unsafe extern "C" fn notify_selection_bound_trampoline<P, F: Fn(&P) + 'static>(
1674 this: *mut gtk_sys::GtkLabel,
1675 _param_spec: glib_sys::gpointer,
1676 f: glib_sys::gpointer,
1677 ) where
1678 P: IsA<Label>,
1679 {
1680 let f: &F = &*(f as *const F);
1681 f(&Label::from_glib_borrow(this).unsafe_cast())
1682 }
1683 unsafe {
1684 let f: Box_<F> = Box_::new(f);
1685 connect_raw(
1686 self.as_ptr() as *mut _,
1687 b"notify::selection-bound\0".as_ptr() as *const _,
1688 Some(transmute(
1689 notify_selection_bound_trampoline::<Self, F> as usize,
1690 )),
1691 Box_::into_raw(f),
1692 )
1693 }
1694 }
1695
1696 fn connect_property_single_line_mode_notify<F: Fn(&Self) + 'static>(
1697 &self,
1698 f: F,
1699 ) -> SignalHandlerId {
1700 unsafe extern "C" fn notify_single_line_mode_trampoline<P, F: Fn(&P) + 'static>(
1701 this: *mut gtk_sys::GtkLabel,
1702 _param_spec: glib_sys::gpointer,
1703 f: glib_sys::gpointer,
1704 ) where
1705 P: IsA<Label>,
1706 {
1707 let f: &F = &*(f as *const F);
1708 f(&Label::from_glib_borrow(this).unsafe_cast())
1709 }
1710 unsafe {
1711 let f: Box_<F> = Box_::new(f);
1712 connect_raw(
1713 self.as_ptr() as *mut _,
1714 b"notify::single-line-mode\0".as_ptr() as *const _,
1715 Some(transmute(
1716 notify_single_line_mode_trampoline::<Self, F> as usize,
1717 )),
1718 Box_::into_raw(f),
1719 )
1720 }
1721 }
1722
1723 fn connect_property_track_visited_links_notify<F: Fn(&Self) + 'static>(
1724 &self,
1725 f: F,
1726 ) -> SignalHandlerId {
1727 unsafe extern "C" fn notify_track_visited_links_trampoline<P, F: Fn(&P) + 'static>(
1728 this: *mut gtk_sys::GtkLabel,
1729 _param_spec: glib_sys::gpointer,
1730 f: glib_sys::gpointer,
1731 ) where
1732 P: IsA<Label>,
1733 {
1734 let f: &F = &*(f as *const F);
1735 f(&Label::from_glib_borrow(this).unsafe_cast())
1736 }
1737 unsafe {
1738 let f: Box_<F> = Box_::new(f);
1739 connect_raw(
1740 self.as_ptr() as *mut _,
1741 b"notify::track-visited-links\0".as_ptr() as *const _,
1742 Some(transmute(
1743 notify_track_visited_links_trampoline::<Self, F> as usize,
1744 )),
1745 Box_::into_raw(f),
1746 )
1747 }
1748 }
1749
1750 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1751 unsafe extern "C" fn notify_use_markup_trampoline<P, F: Fn(&P) + 'static>(
1752 this: *mut gtk_sys::GtkLabel,
1753 _param_spec: glib_sys::gpointer,
1754 f: glib_sys::gpointer,
1755 ) where
1756 P: IsA<Label>,
1757 {
1758 let f: &F = &*(f as *const F);
1759 f(&Label::from_glib_borrow(this).unsafe_cast())
1760 }
1761 unsafe {
1762 let f: Box_<F> = Box_::new(f);
1763 connect_raw(
1764 self.as_ptr() as *mut _,
1765 b"notify::use-markup\0".as_ptr() as *const _,
1766 Some(transmute(notify_use_markup_trampoline::<Self, F> as usize)),
1767 Box_::into_raw(f),
1768 )
1769 }
1770 }
1771
1772 fn connect_property_use_underline_notify<F: Fn(&Self) + 'static>(
1773 &self,
1774 f: F,
1775 ) -> SignalHandlerId {
1776 unsafe extern "C" fn notify_use_underline_trampoline<P, F: Fn(&P) + 'static>(
1777 this: *mut gtk_sys::GtkLabel,
1778 _param_spec: glib_sys::gpointer,
1779 f: glib_sys::gpointer,
1780 ) where
1781 P: IsA<Label>,
1782 {
1783 let f: &F = &*(f as *const F);
1784 f(&Label::from_glib_borrow(this).unsafe_cast())
1785 }
1786 unsafe {
1787 let f: Box_<F> = Box_::new(f);
1788 connect_raw(
1789 self.as_ptr() as *mut _,
1790 b"notify::use-underline\0".as_ptr() as *const _,
1791 Some(transmute(
1792 notify_use_underline_trampoline::<Self, F> as usize,
1793 )),
1794 Box_::into_raw(f),
1795 )
1796 }
1797 }
1798
1799 fn connect_property_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1800 unsafe extern "C" fn notify_width_chars_trampoline<P, F: Fn(&P) + 'static>(
1801 this: *mut gtk_sys::GtkLabel,
1802 _param_spec: glib_sys::gpointer,
1803 f: glib_sys::gpointer,
1804 ) where
1805 P: IsA<Label>,
1806 {
1807 let f: &F = &*(f as *const F);
1808 f(&Label::from_glib_borrow(this).unsafe_cast())
1809 }
1810 unsafe {
1811 let f: Box_<F> = Box_::new(f);
1812 connect_raw(
1813 self.as_ptr() as *mut _,
1814 b"notify::width-chars\0".as_ptr() as *const _,
1815 Some(transmute(notify_width_chars_trampoline::<Self, F> as usize)),
1816 Box_::into_raw(f),
1817 )
1818 }
1819 }
1820
1821 fn connect_property_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1822 unsafe extern "C" fn notify_wrap_trampoline<P, F: Fn(&P) + 'static>(
1823 this: *mut gtk_sys::GtkLabel,
1824 _param_spec: glib_sys::gpointer,
1825 f: glib_sys::gpointer,
1826 ) where
1827 P: IsA<Label>,
1828 {
1829 let f: &F = &*(f as *const F);
1830 f(&Label::from_glib_borrow(this).unsafe_cast())
1831 }
1832 unsafe {
1833 let f: Box_<F> = Box_::new(f);
1834 connect_raw(
1835 self.as_ptr() as *mut _,
1836 b"notify::wrap\0".as_ptr() as *const _,
1837 Some(transmute(notify_wrap_trampoline::<Self, F> as usize)),
1838 Box_::into_raw(f),
1839 )
1840 }
1841 }
1842
1843 fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1844 unsafe extern "C" fn notify_wrap_mode_trampoline<P, F: Fn(&P) + 'static>(
1845 this: *mut gtk_sys::GtkLabel,
1846 _param_spec: glib_sys::gpointer,
1847 f: glib_sys::gpointer,
1848 ) where
1849 P: IsA<Label>,
1850 {
1851 let f: &F = &*(f as *const F);
1852 f(&Label::from_glib_borrow(this).unsafe_cast())
1853 }
1854 unsafe {
1855 let f: Box_<F> = Box_::new(f);
1856 connect_raw(
1857 self.as_ptr() as *mut _,
1858 b"notify::wrap-mode\0".as_ptr() as *const _,
1859 Some(transmute(notify_wrap_mode_trampoline::<Self, F> as usize)),
1860 Box_::into_raw(f),
1861 )
1862 }
1863 }
1864
1865 #[cfg(any(feature = "v3_16", feature = "dox"))]
1866 fn connect_property_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1867 unsafe extern "C" fn notify_xalign_trampoline<P, F: Fn(&P) + 'static>(
1868 this: *mut gtk_sys::GtkLabel,
1869 _param_spec: glib_sys::gpointer,
1870 f: glib_sys::gpointer,
1871 ) where
1872 P: IsA<Label>,
1873 {
1874 let f: &F = &*(f as *const F);
1875 f(&Label::from_glib_borrow(this).unsafe_cast())
1876 }
1877 unsafe {
1878 let f: Box_<F> = Box_::new(f);
1879 connect_raw(
1880 self.as_ptr() as *mut _,
1881 b"notify::xalign\0".as_ptr() as *const _,
1882 Some(transmute(notify_xalign_trampoline::<Self, F> as usize)),
1883 Box_::into_raw(f),
1884 )
1885 }
1886 }
1887
1888 #[cfg(any(feature = "v3_16", feature = "dox"))]
1889 fn connect_property_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1890 unsafe extern "C" fn notify_yalign_trampoline<P, F: Fn(&P) + 'static>(
1891 this: *mut gtk_sys::GtkLabel,
1892 _param_spec: glib_sys::gpointer,
1893 f: glib_sys::gpointer,
1894 ) where
1895 P: IsA<Label>,
1896 {
1897 let f: &F = &*(f as *const F);
1898 f(&Label::from_glib_borrow(this).unsafe_cast())
1899 }
1900 unsafe {
1901 let f: Box_<F> = Box_::new(f);
1902 connect_raw(
1903 self.as_ptr() as *mut _,
1904 b"notify::yalign\0".as_ptr() as *const _,
1905 Some(transmute(notify_yalign_trampoline::<Self, F> as usize)),
1906 Box_::into_raw(f),
1907 )
1908 }
1909 }
1910}
1911
1912impl fmt::Display for Label {
1913 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1914 write!(f, "Label")
1915 }
1916}