1use crate::{Actor, Animatable, Color, Container, Rect, TextBuffer};
3use glib::{
4 object as gobject,
5 object::{Cast, IsA, ObjectExt},
6 signal::{connect_raw, SignalHandlerId},
7 translate::*,
8 GString, StaticType, Value,
9};
10use std::boxed::Box as Box_;
11use std::{fmt, mem, mem::transmute};
12
13glib_wrapper! {
15 pub struct Text(Object<ffi::ClutterText, ffi::ClutterTextClass, TextClass>) @extends Actor, gobject::InitiallyUnowned, @implements Animatable, Container;
16
17 match fn {
18 get_type => || ffi::clutter_text_get_type(),
19 }
20}
21
22impl Text {
23 pub fn new() -> Text {
30 unsafe { Actor::from_glib_none(ffi::clutter_text_new()).unsafe_cast() }
31 }
32
33 pub fn new_full(font_name: &str, text: &str, color: &Color) -> Text {
51 unsafe {
52 Actor::from_glib_none(ffi::clutter_text_new_full(
53 font_name.to_glib_none().0,
54 text.to_glib_none().0,
55 color.to_glib_none().0,
56 ))
57 .unsafe_cast()
58 }
59 }
60
61 pub fn with_buffer<P: IsA<TextBuffer>>(buffer: &P) -> Text {
62 unsafe {
63 Actor::from_glib_none(ffi::clutter_text_new_with_buffer(
64 buffer.as_ref().to_glib_none().0,
65 ))
66 .unsafe_cast()
67 }
68 }
69
70 pub fn with_text(font_name: Option<&str>, text: &str) -> Text {
71 unsafe {
72 Actor::from_glib_none(ffi::clutter_text_new_with_text(
73 font_name.to_glib_none().0,
74 text.to_glib_none().0,
75 ))
76 .unsafe_cast()
77 }
78 }
79}
80
81impl Default for Text {
82 fn default() -> Self {
83 Self::new()
84 }
85}
86
87pub const NONE_TEXT: Option<&Text> = None;
88
89pub trait TextExt: 'static {
95 fn activate(&self) -> bool;
108
109 fn coords_to_position(&self, x: f32, y: f32) -> i32;
119
120 fn delete_chars(&self, n_chars: u32);
128
129 fn delete_selection(&self) -> bool;
138
139 fn delete_text(&self, start_pos: isize, end_pos: isize);
149
150 fn get_activatable(&self) -> bool;
156
157 fn get_attributes(&self) -> Option<pango::AttrList>;
165
166 fn get_buffer(&self) -> Option<TextBuffer>;
173
174 fn get_chars(&self, start_pos: isize, end_pos: isize) -> Option<GString>;
189
190 fn get_color(&self) -> Color;
194
195 fn get_cursor_color(&self) -> Color;
199
200 fn get_cursor_position(&self) -> i32;
206
207 fn get_cursor_rect(&self) -> Rect;
214
215 fn get_cursor_size(&self) -> u32;
221
222 fn get_cursor_visible(&self) -> bool;
228
229 fn get_editable(&self) -> bool;
235
236 fn get_ellipsize(&self) -> pango::EllipsizeMode;
243
244 fn get_font_description(&self) -> Option<pango::FontDescription>;
251
252 fn get_font_name(&self) -> Option<GString>;
260
261 fn get_justify(&self) -> bool;
268
269 fn get_layout(&self) -> Option<pango::Layout>;
276
277 fn get_layout_offsets(&self) -> (i32, i32);
284
285 fn get_line_alignment(&self) -> pango::Alignment;
292
293 fn get_line_wrap(&self) -> bool;
300
301 fn get_line_wrap_mode(&self) -> pango::WrapMode;
309
310 fn get_max_length(&self) -> i32;
318
319 fn get_password_char(&self) -> char;
327
328 fn get_selectable(&self) -> bool;
334
335 fn get_selected_text_color(&self) -> Color;
339
340 fn get_selection(&self) -> Option<GString>;
348
349 fn get_selection_bound(&self) -> i32;
356
357 fn get_selection_color(&self) -> Color;
361
362 fn get_single_line_mode(&self) -> bool;
368
369 fn get_text(&self) -> Option<GString>;
391
392 fn get_use_markup(&self) -> bool;
399
400 fn insert_text(&self, text: &str, position: isize);
411
412 fn insert_unichar(&self, wc: char);
417
418 fn position_to_coords(&self, position: i32) -> Option<(f32, f32, f32)>;
432
433 fn set_activatable(&self, activatable: bool);
444
445 fn set_attributes(&self, attrs: Option<&pango::AttrList>);
453
454 fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: &P);
459
460 fn set_color(&self, color: &Color);
469
470 fn set_cursor_color(&self, color: Option<&Color>);
477
478 fn set_cursor_position(&self, position: i32);
484
485 fn set_cursor_size(&self, size: i32);
492
493 fn set_cursor_visible(&self, cursor_visible: bool);
506
507 fn set_editable(&self, editable: bool);
515
516 fn set_ellipsize(&self, mode: pango::EllipsizeMode);
522
523 fn set_font_description(&self, font_desc: &mut pango::FontDescription);
531
532 fn set_font_name(&self, font_name: Option<&str>);
552
553 fn set_justify(&self, justify: bool);
559
560 fn set_line_alignment(&self, alignment: pango::Alignment);
569
570 fn set_line_wrap(&self, line_wrap: bool);
575
576 fn set_line_wrap_mode(&self, wrap_mode: pango::WrapMode);
582
583 fn set_markup(&self, markup: Option<&str>);
598
599 fn set_max_length(&self, max: i32);
606
607 fn set_password_char(&self, wc: char);
615
616 fn set_preedit_string(
632 &self,
633 preedit_str: Option<&str>,
634 preedit_attrs: Option<&pango::AttrList>,
635 cursor_pos: u32,
636 );
637
638 fn set_selectable(&self, selectable: bool);
645
646 fn set_selected_text_color(&self, color: Option<&Color>);
653
654 fn set_selection(&self, start_pos: isize, end_pos: isize);
663
664 fn set_selection_bound(&self, selection_bound: i32);
671
672 fn set_selection_color(&self, color: Option<&Color>);
680
681 fn set_single_line_mode(&self, single_line: bool);
697
698 fn set_text(&self, text: Option<&str>);
708
709 fn set_use_markup(&self, setting: bool);
719
720 fn get_property_cursor_color_set(&self) -> bool;
722
723 fn get_property_selected_text_color_set(&self) -> bool;
725
726 fn get_property_selection_color_set(&self) -> bool;
728
729 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
733
734 fn connect_cursor_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
737
738 fn connect_delete_text<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId;
745
746 fn emit_delete_text(&self, start_pos: i32, end_pos: i32);
747
748 fn connect_text_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
752
753 fn connect_property_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
754
755 fn connect_property_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
756
757 fn connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
758
759 fn connect_property_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
760
761 fn connect_property_cursor_color_notify<F: Fn(&Self) + 'static>(&self, f: F)
762 -> SignalHandlerId;
763
764 fn connect_property_cursor_color_set_notify<F: Fn(&Self) + 'static>(
765 &self,
766 f: F,
767 ) -> SignalHandlerId;
768
769 fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
770 &self,
771 f: F,
772 ) -> SignalHandlerId;
773
774 fn connect_property_cursor_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
775
776 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
777 &self,
778 f: F,
779 ) -> SignalHandlerId;
780
781 fn connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
782
783 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
784
785 fn connect_property_font_description_notify<F: Fn(&Self) + 'static>(
786 &self,
787 f: F,
788 ) -> SignalHandlerId;
789
790 fn connect_property_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
791
792 fn connect_property_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
793
794 fn connect_property_line_alignment_notify<F: Fn(&Self) + 'static>(
795 &self,
796 f: F,
797 ) -> SignalHandlerId;
798
799 fn connect_property_line_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
800
801 fn connect_property_line_wrap_mode_notify<F: Fn(&Self) + 'static>(
802 &self,
803 f: F,
804 ) -> SignalHandlerId;
805
806 fn connect_property_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
807
808 fn connect_property_password_char_notify<F: Fn(&Self) + 'static>(
809 &self,
810 f: F,
811 ) -> SignalHandlerId;
812
813 fn connect_property_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
814
815 fn connect_property_selected_text_color_notify<F: Fn(&Self) + 'static>(
816 &self,
817 f: F,
818 ) -> SignalHandlerId;
819
820 fn connect_property_selected_text_color_set_notify<F: Fn(&Self) + 'static>(
821 &self,
822 f: F,
823 ) -> SignalHandlerId;
824
825 fn connect_property_selection_bound_notify<F: Fn(&Self) + 'static>(
826 &self,
827 f: F,
828 ) -> SignalHandlerId;
829
830 fn connect_property_selection_color_notify<F: Fn(&Self) + 'static>(
831 &self,
832 f: F,
833 ) -> SignalHandlerId;
834
835 fn connect_property_selection_color_set_notify<F: Fn(&Self) + 'static>(
836 &self,
837 f: F,
838 ) -> SignalHandlerId;
839
840 fn connect_property_single_line_mode_notify<F: Fn(&Self) + 'static>(
841 &self,
842 f: F,
843 ) -> SignalHandlerId;
844
845 fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
846
847 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
848}
849
850impl<O: IsA<Text>> TextExt for O {
851 fn activate(&self) -> bool {
852 unsafe { from_glib(ffi::clutter_text_activate(self.as_ref().to_glib_none().0)) }
853 }
854
855 fn coords_to_position(&self, x: f32, y: f32) -> i32 {
856 unsafe { ffi::clutter_text_coords_to_position(self.as_ref().to_glib_none().0, x, y) }
857 }
858
859 fn delete_chars(&self, n_chars: u32) {
860 unsafe {
861 ffi::clutter_text_delete_chars(self.as_ref().to_glib_none().0, n_chars);
862 }
863 }
864
865 fn delete_selection(&self) -> bool {
866 unsafe {
867 from_glib(ffi::clutter_text_delete_selection(
868 self.as_ref().to_glib_none().0,
869 ))
870 }
871 }
872
873 fn delete_text(&self, start_pos: isize, end_pos: isize) {
874 unsafe {
875 ffi::clutter_text_delete_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
876 }
877 }
878
879 fn get_activatable(&self) -> bool {
880 unsafe {
881 from_glib(ffi::clutter_text_get_activatable(
882 self.as_ref().to_glib_none().0,
883 ))
884 }
885 }
886
887 fn get_attributes(&self) -> Option<pango::AttrList> {
888 unsafe {
889 from_glib_none(ffi::clutter_text_get_attributes(
890 self.as_ref().to_glib_none().0,
891 ))
892 }
893 }
894
895 fn get_buffer(&self) -> Option<TextBuffer> {
896 unsafe { from_glib_none(ffi::clutter_text_get_buffer(self.as_ref().to_glib_none().0)) }
897 }
898
899 fn get_chars(&self, start_pos: isize, end_pos: isize) -> Option<GString> {
900 unsafe {
901 from_glib_full(ffi::clutter_text_get_chars(
902 self.as_ref().to_glib_none().0,
903 start_pos,
904 end_pos,
905 ))
906 }
907 }
908
909 fn get_color(&self) -> Color {
910 unsafe {
911 let mut color = Color::uninitialized();
912 ffi::clutter_text_get_color(self.as_ref().to_glib_none().0, color.to_glib_none_mut().0);
913 color
914 }
915 }
916
917 fn get_cursor_color(&self) -> Color {
918 unsafe {
919 let mut color = Color::uninitialized();
920 ffi::clutter_text_get_cursor_color(
921 self.as_ref().to_glib_none().0,
922 color.to_glib_none_mut().0,
923 );
924 color
925 }
926 }
927
928 fn get_cursor_position(&self) -> i32 {
929 unsafe { ffi::clutter_text_get_cursor_position(self.as_ref().to_glib_none().0) }
930 }
931
932 fn get_cursor_rect(&self) -> Rect {
933 unsafe {
934 let mut rect = Rect::uninitialized();
935 ffi::clutter_text_get_cursor_rect(
936 self.as_ref().to_glib_none().0,
937 rect.to_glib_none_mut().0,
938 );
939 rect
940 }
941 }
942
943 fn get_cursor_size(&self) -> u32 {
944 unsafe { ffi::clutter_text_get_cursor_size(self.as_ref().to_glib_none().0) }
945 }
946
947 fn get_cursor_visible(&self) -> bool {
948 unsafe {
949 from_glib(ffi::clutter_text_get_cursor_visible(
950 self.as_ref().to_glib_none().0,
951 ))
952 }
953 }
954
955 fn get_editable(&self) -> bool {
956 unsafe {
957 from_glib(ffi::clutter_text_get_editable(
958 self.as_ref().to_glib_none().0,
959 ))
960 }
961 }
962
963 fn get_ellipsize(&self) -> pango::EllipsizeMode {
964 unsafe {
965 from_glib(ffi::clutter_text_get_ellipsize(
966 self.as_ref().to_glib_none().0,
967 ))
968 }
969 }
970
971 fn get_font_description(&self) -> Option<pango::FontDescription> {
972 unsafe {
973 from_glib_full(ffi::clutter_text_get_font_description(
974 self.as_ref().to_glib_none().0,
975 ))
976 }
977 }
978
979 fn get_font_name(&self) -> Option<GString> {
980 unsafe {
981 from_glib_none(ffi::clutter_text_get_font_name(
982 self.as_ref().to_glib_none().0,
983 ))
984 }
985 }
986
987 fn get_justify(&self) -> bool {
988 unsafe {
989 from_glib(ffi::clutter_text_get_justify(
990 self.as_ref().to_glib_none().0,
991 ))
992 }
993 }
994
995 fn get_layout(&self) -> Option<pango::Layout> {
996 unsafe { from_glib_none(ffi::clutter_text_get_layout(self.as_ref().to_glib_none().0)) }
997 }
998
999 fn get_layout_offsets(&self) -> (i32, i32) {
1000 unsafe {
1001 let mut x = mem::MaybeUninit::uninit();
1002 let mut y = mem::MaybeUninit::uninit();
1003 ffi::clutter_text_get_layout_offsets(
1004 self.as_ref().to_glib_none().0,
1005 x.as_mut_ptr(),
1006 y.as_mut_ptr(),
1007 );
1008 let x = x.assume_init();
1009 let y = y.assume_init();
1010 (x, y)
1011 }
1012 }
1013
1014 fn get_line_alignment(&self) -> pango::Alignment {
1015 unsafe {
1016 from_glib(ffi::clutter_text_get_line_alignment(
1017 self.as_ref().to_glib_none().0,
1018 ))
1019 }
1020 }
1021
1022 fn get_line_wrap(&self) -> bool {
1023 unsafe {
1024 from_glib(ffi::clutter_text_get_line_wrap(
1025 self.as_ref().to_glib_none().0,
1026 ))
1027 }
1028 }
1029
1030 fn get_line_wrap_mode(&self) -> pango::WrapMode {
1031 unsafe {
1032 from_glib(ffi::clutter_text_get_line_wrap_mode(
1033 self.as_ref().to_glib_none().0,
1034 ))
1035 }
1036 }
1037
1038 fn get_max_length(&self) -> i32 {
1039 unsafe { ffi::clutter_text_get_max_length(self.as_ref().to_glib_none().0) }
1040 }
1041
1042 fn get_password_char(&self) -> char {
1043 unsafe {
1044 from_glib(ffi::clutter_text_get_password_char(
1045 self.as_ref().to_glib_none().0,
1046 ))
1047 }
1048 }
1049
1050 fn get_selectable(&self) -> bool {
1051 unsafe {
1052 from_glib(ffi::clutter_text_get_selectable(
1053 self.as_ref().to_glib_none().0,
1054 ))
1055 }
1056 }
1057
1058 fn get_selected_text_color(&self) -> Color {
1059 unsafe {
1060 let mut color = Color::uninitialized();
1061 ffi::clutter_text_get_selected_text_color(
1062 self.as_ref().to_glib_none().0,
1063 color.to_glib_none_mut().0,
1064 );
1065 color
1066 }
1067 }
1068
1069 fn get_selection(&self) -> Option<GString> {
1070 unsafe {
1071 from_glib_full(ffi::clutter_text_get_selection(
1072 self.as_ref().to_glib_none().0,
1073 ))
1074 }
1075 }
1076
1077 fn get_selection_bound(&self) -> i32 {
1078 unsafe { ffi::clutter_text_get_selection_bound(self.as_ref().to_glib_none().0) }
1079 }
1080
1081 fn get_selection_color(&self) -> Color {
1082 unsafe {
1083 let mut color = Color::uninitialized();
1084 ffi::clutter_text_get_selection_color(
1085 self.as_ref().to_glib_none().0,
1086 color.to_glib_none_mut().0,
1087 );
1088 color
1089 }
1090 }
1091
1092 fn get_single_line_mode(&self) -> bool {
1093 unsafe {
1094 from_glib(ffi::clutter_text_get_single_line_mode(
1095 self.as_ref().to_glib_none().0,
1096 ))
1097 }
1098 }
1099
1100 fn get_text(&self) -> Option<GString> {
1101 unsafe { from_glib_none(ffi::clutter_text_get_text(self.as_ref().to_glib_none().0)) }
1102 }
1103
1104 fn get_use_markup(&self) -> bool {
1105 unsafe {
1106 from_glib(ffi::clutter_text_get_use_markup(
1107 self.as_ref().to_glib_none().0,
1108 ))
1109 }
1110 }
1111
1112 fn insert_text(&self, text: &str, position: isize) {
1113 unsafe {
1114 ffi::clutter_text_insert_text(
1115 self.as_ref().to_glib_none().0,
1116 text.to_glib_none().0,
1117 position,
1118 );
1119 }
1120 }
1121
1122 fn insert_unichar(&self, wc: char) {
1123 unsafe {
1124 ffi::clutter_text_insert_unichar(self.as_ref().to_glib_none().0, wc.to_glib());
1125 }
1126 }
1127
1128 fn position_to_coords(&self, position: i32) -> Option<(f32, f32, f32)> {
1129 unsafe {
1130 let mut x = mem::MaybeUninit::uninit();
1131 let mut y = mem::MaybeUninit::uninit();
1132 let mut line_height = mem::MaybeUninit::uninit();
1133 let ret = from_glib(ffi::clutter_text_position_to_coords(
1134 self.as_ref().to_glib_none().0,
1135 position,
1136 x.as_mut_ptr(),
1137 y.as_mut_ptr(),
1138 line_height.as_mut_ptr(),
1139 ));
1140 let x = x.assume_init();
1141 let y = y.assume_init();
1142 let line_height = line_height.assume_init();
1143 if ret {
1144 Some((x, y, line_height))
1145 } else {
1146 None
1147 }
1148 }
1149 }
1150
1151 fn set_activatable(&self, activatable: bool) {
1152 unsafe {
1153 ffi::clutter_text_set_activatable(
1154 self.as_ref().to_glib_none().0,
1155 activatable.to_glib(),
1156 );
1157 }
1158 }
1159
1160 fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
1161 unsafe {
1162 ffi::clutter_text_set_attributes(
1163 self.as_ref().to_glib_none().0,
1164 attrs.to_glib_none().0,
1165 );
1166 }
1167 }
1168
1169 fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: &P) {
1170 unsafe {
1171 ffi::clutter_text_set_buffer(
1172 self.as_ref().to_glib_none().0,
1173 buffer.as_ref().to_glib_none().0,
1174 );
1175 }
1176 }
1177
1178 fn set_color(&self, color: &Color) {
1179 unsafe {
1180 ffi::clutter_text_set_color(self.as_ref().to_glib_none().0, color.to_glib_none().0);
1181 }
1182 }
1183
1184 fn set_cursor_color(&self, color: Option<&Color>) {
1185 unsafe {
1186 ffi::clutter_text_set_cursor_color(
1187 self.as_ref().to_glib_none().0,
1188 color.to_glib_none().0,
1189 );
1190 }
1191 }
1192
1193 fn set_cursor_position(&self, position: i32) {
1194 unsafe {
1195 ffi::clutter_text_set_cursor_position(self.as_ref().to_glib_none().0, position);
1196 }
1197 }
1198
1199 fn set_cursor_size(&self, size: i32) {
1200 unsafe {
1201 ffi::clutter_text_set_cursor_size(self.as_ref().to_glib_none().0, size);
1202 }
1203 }
1204
1205 fn set_cursor_visible(&self, cursor_visible: bool) {
1206 unsafe {
1207 ffi::clutter_text_set_cursor_visible(
1208 self.as_ref().to_glib_none().0,
1209 cursor_visible.to_glib(),
1210 );
1211 }
1212 }
1213
1214 fn set_editable(&self, editable: bool) {
1215 unsafe {
1216 ffi::clutter_text_set_editable(self.as_ref().to_glib_none().0, editable.to_glib());
1217 }
1218 }
1219
1220 fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
1221 unsafe {
1222 ffi::clutter_text_set_ellipsize(self.as_ref().to_glib_none().0, mode.to_glib());
1223 }
1224 }
1225
1226 fn set_font_description(&self, font_desc: &mut pango::FontDescription) {
1227 unsafe {
1228 ffi::clutter_text_set_font_description(
1229 self.as_ref().to_glib_none().0,
1230 font_desc.to_glib_none_mut().0,
1231 );
1232 }
1233 }
1234
1235 fn set_font_name(&self, font_name: Option<&str>) {
1236 unsafe {
1237 ffi::clutter_text_set_font_name(
1238 self.as_ref().to_glib_none().0,
1239 font_name.to_glib_none().0,
1240 );
1241 }
1242 }
1243
1244 fn set_justify(&self, justify: bool) {
1245 unsafe {
1246 ffi::clutter_text_set_justify(self.as_ref().to_glib_none().0, justify.to_glib());
1247 }
1248 }
1249
1250 fn set_line_alignment(&self, alignment: pango::Alignment) {
1251 unsafe {
1252 ffi::clutter_text_set_line_alignment(
1253 self.as_ref().to_glib_none().0,
1254 alignment.to_glib(),
1255 );
1256 }
1257 }
1258
1259 fn set_line_wrap(&self, line_wrap: bool) {
1260 unsafe {
1261 ffi::clutter_text_set_line_wrap(self.as_ref().to_glib_none().0, line_wrap.to_glib());
1262 }
1263 }
1264
1265 fn set_line_wrap_mode(&self, wrap_mode: pango::WrapMode) {
1266 unsafe {
1267 ffi::clutter_text_set_line_wrap_mode(
1268 self.as_ref().to_glib_none().0,
1269 wrap_mode.to_glib(),
1270 );
1271 }
1272 }
1273
1274 fn set_markup(&self, markup: Option<&str>) {
1275 unsafe {
1276 ffi::clutter_text_set_markup(self.as_ref().to_glib_none().0, markup.to_glib_none().0);
1277 }
1278 }
1279
1280 fn set_max_length(&self, max: i32) {
1281 unsafe {
1282 ffi::clutter_text_set_max_length(self.as_ref().to_glib_none().0, max);
1283 }
1284 }
1285
1286 fn set_password_char(&self, wc: char) {
1287 unsafe {
1288 ffi::clutter_text_set_password_char(self.as_ref().to_glib_none().0, wc.to_glib());
1289 }
1290 }
1291
1292 fn set_preedit_string(
1293 &self,
1294 preedit_str: Option<&str>,
1295 preedit_attrs: Option<&pango::AttrList>,
1296 cursor_pos: u32,
1297 ) {
1298 unsafe {
1299 ffi::clutter_text_set_preedit_string(
1300 self.as_ref().to_glib_none().0,
1301 preedit_str.to_glib_none().0,
1302 preedit_attrs.to_glib_none().0,
1303 cursor_pos,
1304 );
1305 }
1306 }
1307
1308 fn set_selectable(&self, selectable: bool) {
1309 unsafe {
1310 ffi::clutter_text_set_selectable(self.as_ref().to_glib_none().0, selectable.to_glib());
1311 }
1312 }
1313
1314 fn set_selected_text_color(&self, color: Option<&Color>) {
1315 unsafe {
1316 ffi::clutter_text_set_selected_text_color(
1317 self.as_ref().to_glib_none().0,
1318 color.to_glib_none().0,
1319 );
1320 }
1321 }
1322
1323 fn set_selection(&self, start_pos: isize, end_pos: isize) {
1324 unsafe {
1325 ffi::clutter_text_set_selection(self.as_ref().to_glib_none().0, start_pos, end_pos);
1326 }
1327 }
1328
1329 fn set_selection_bound(&self, selection_bound: i32) {
1330 unsafe {
1331 ffi::clutter_text_set_selection_bound(self.as_ref().to_glib_none().0, selection_bound);
1332 }
1333 }
1334
1335 fn set_selection_color(&self, color: Option<&Color>) {
1336 unsafe {
1337 ffi::clutter_text_set_selection_color(
1338 self.as_ref().to_glib_none().0,
1339 color.to_glib_none().0,
1340 );
1341 }
1342 }
1343
1344 fn set_single_line_mode(&self, single_line: bool) {
1345 unsafe {
1346 ffi::clutter_text_set_single_line_mode(
1347 self.as_ref().to_glib_none().0,
1348 single_line.to_glib(),
1349 );
1350 }
1351 }
1352
1353 fn set_text(&self, text: Option<&str>) {
1354 unsafe {
1355 ffi::clutter_text_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
1356 }
1357 }
1358
1359 fn set_use_markup(&self, setting: bool) {
1360 unsafe {
1361 ffi::clutter_text_set_use_markup(self.as_ref().to_glib_none().0, setting.to_glib());
1362 }
1363 }
1364
1365 fn get_property_cursor_color_set(&self) -> bool {
1366 unsafe {
1367 let mut value = Value::from_type(<bool as StaticType>::static_type());
1368 gobject_sys::g_object_get_property(
1369 self.to_glib_none().0 as *mut gobject_sys::GObject,
1370 b"cursor-color-set\0".as_ptr() as *const _,
1371 value.to_glib_none_mut().0,
1372 );
1373 value
1374 .get()
1375 .expect("Return Value for property `cursor-color-set` getter")
1376 .unwrap()
1377 }
1378 }
1379
1380 fn get_property_selected_text_color_set(&self) -> bool {
1381 unsafe {
1382 let mut value = Value::from_type(<bool as StaticType>::static_type());
1383 gobject_sys::g_object_get_property(
1384 self.to_glib_none().0 as *mut gobject_sys::GObject,
1385 b"selected-text-color-set\0".as_ptr() as *const _,
1386 value.to_glib_none_mut().0,
1387 );
1388 value
1389 .get()
1390 .expect("Return Value for property `selected-text-color-set` getter")
1391 .unwrap()
1392 }
1393 }
1394
1395 fn get_property_selection_color_set(&self) -> bool {
1396 unsafe {
1397 let mut value = Value::from_type(<bool as StaticType>::static_type());
1398 gobject_sys::g_object_get_property(
1399 self.to_glib_none().0 as *mut gobject_sys::GObject,
1400 b"selection-color-set\0".as_ptr() as *const _,
1401 value.to_glib_none_mut().0,
1402 );
1403 value
1404 .get()
1405 .expect("Return Value for property `selection-color-set` getter")
1406 .unwrap()
1407 }
1408 }
1409
1410 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1411 unsafe extern "C" fn activate_trampoline<P, F: Fn(&P) + 'static>(
1412 this: *mut ffi::ClutterText,
1413 f: glib_sys::gpointer,
1414 ) where
1415 P: IsA<Text>,
1416 {
1417 let f: &F = &*(f as *const F);
1418 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1419 }
1420 unsafe {
1421 let f: Box_<F> = Box_::new(f);
1422 connect_raw(
1423 self.as_ptr() as *mut _,
1424 b"activate\0".as_ptr() as *const _,
1425 Some(transmute::<_, unsafe extern "C" fn()>(
1426 activate_trampoline::<Self, F> as *const (),
1427 )),
1428 Box_::into_raw(f),
1429 )
1430 }
1431 }
1432
1433 fn connect_cursor_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1434 unsafe extern "C" fn cursor_changed_trampoline<P, F: Fn(&P) + 'static>(
1435 this: *mut ffi::ClutterText,
1436 f: glib_sys::gpointer,
1437 ) where
1438 P: IsA<Text>,
1439 {
1440 let f: &F = &*(f as *const F);
1441 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1442 }
1443 unsafe {
1444 let f: Box_<F> = Box_::new(f);
1445 connect_raw(
1446 self.as_ptr() as *mut _,
1447 b"cursor-changed\0".as_ptr() as *const _,
1448 Some(transmute::<_, unsafe extern "C" fn()>(
1449 cursor_changed_trampoline::<Self, F> as *const (),
1450 )),
1451 Box_::into_raw(f),
1452 )
1453 }
1454 }
1455
1456 fn connect_delete_text<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
1457 unsafe extern "C" fn delete_text_trampoline<P, F: Fn(&P, i32, i32) + 'static>(
1458 this: *mut ffi::ClutterText,
1459 start_pos: libc::c_int,
1460 end_pos: libc::c_int,
1461 f: glib_sys::gpointer,
1462 ) where
1463 P: IsA<Text>,
1464 {
1465 let f: &F = &*(f as *const F);
1466 f(
1467 &Text::from_glib_borrow(this).unsafe_cast_ref(),
1468 start_pos,
1469 end_pos,
1470 )
1471 }
1472 unsafe {
1473 let f: Box_<F> = Box_::new(f);
1474 connect_raw(
1475 self.as_ptr() as *mut _,
1476 b"delete-text\0".as_ptr() as *const _,
1477 Some(transmute::<_, unsafe extern "C" fn()>(
1478 delete_text_trampoline::<Self, F> as *const (),
1479 )),
1480 Box_::into_raw(f),
1481 )
1482 }
1483 }
1484
1485 fn emit_delete_text(&self, start_pos: i32, end_pos: i32) {
1486 let _ = unsafe {
1487 glib::Object::from_glib_borrow(self.as_ptr() as *mut gobject_sys::GObject)
1488 .emit("delete-text", &[&start_pos, &end_pos])
1489 .unwrap()
1490 };
1491 }
1492
1493 fn connect_text_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1498 unsafe extern "C" fn text_changed_trampoline<P, F: Fn(&P) + 'static>(
1499 this: *mut ffi::ClutterText,
1500 f: glib_sys::gpointer,
1501 ) where
1502 P: IsA<Text>,
1503 {
1504 let f: &F = &*(f as *const F);
1505 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1506 }
1507 unsafe {
1508 let f: Box_<F> = Box_::new(f);
1509 connect_raw(
1510 self.as_ptr() as *mut _,
1511 b"text-changed\0".as_ptr() as *const _,
1512 Some(transmute::<_, unsafe extern "C" fn()>(
1513 text_changed_trampoline::<Self, F> as *const (),
1514 )),
1515 Box_::into_raw(f),
1516 )
1517 }
1518 }
1519
1520 fn connect_property_activatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1521 unsafe extern "C" fn notify_activatable_trampoline<P, F: Fn(&P) + 'static>(
1522 this: *mut ffi::ClutterText,
1523 _param_spec: glib_sys::gpointer,
1524 f: glib_sys::gpointer,
1525 ) where
1526 P: IsA<Text>,
1527 {
1528 let f: &F = &*(f as *const F);
1529 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1530 }
1531 unsafe {
1532 let f: Box_<F> = Box_::new(f);
1533 connect_raw(
1534 self.as_ptr() as *mut _,
1535 b"notify::activatable\0".as_ptr() as *const _,
1536 Some(transmute::<_, unsafe extern "C" fn()>(
1537 notify_activatable_trampoline::<Self, F> as *const (),
1538 )),
1539 Box_::into_raw(f),
1540 )
1541 }
1542 }
1543
1544 fn connect_property_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1545 unsafe extern "C" fn notify_attributes_trampoline<P, F: Fn(&P) + 'static>(
1546 this: *mut ffi::ClutterText,
1547 _param_spec: glib_sys::gpointer,
1548 f: glib_sys::gpointer,
1549 ) where
1550 P: IsA<Text>,
1551 {
1552 let f: &F = &*(f as *const F);
1553 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1554 }
1555 unsafe {
1556 let f: Box_<F> = Box_::new(f);
1557 connect_raw(
1558 self.as_ptr() as *mut _,
1559 b"notify::attributes\0".as_ptr() as *const _,
1560 Some(transmute::<_, unsafe extern "C" fn()>(
1561 notify_attributes_trampoline::<Self, F> as *const (),
1562 )),
1563 Box_::into_raw(f),
1564 )
1565 }
1566 }
1567
1568 fn connect_property_buffer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1569 unsafe extern "C" fn notify_buffer_trampoline<P, F: Fn(&P) + 'static>(
1570 this: *mut ffi::ClutterText,
1571 _param_spec: glib_sys::gpointer,
1572 f: glib_sys::gpointer,
1573 ) where
1574 P: IsA<Text>,
1575 {
1576 let f: &F = &*(f as *const F);
1577 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1578 }
1579 unsafe {
1580 let f: Box_<F> = Box_::new(f);
1581 connect_raw(
1582 self.as_ptr() as *mut _,
1583 b"notify::buffer\0".as_ptr() as *const _,
1584 Some(transmute::<_, unsafe extern "C" fn()>(
1585 notify_buffer_trampoline::<Self, F> as *const (),
1586 )),
1587 Box_::into_raw(f),
1588 )
1589 }
1590 }
1591
1592 fn connect_property_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1593 unsafe extern "C" fn notify_color_trampoline<P, F: Fn(&P) + 'static>(
1594 this: *mut ffi::ClutterText,
1595 _param_spec: glib_sys::gpointer,
1596 f: glib_sys::gpointer,
1597 ) where
1598 P: IsA<Text>,
1599 {
1600 let f: &F = &*(f as *const F);
1601 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1602 }
1603 unsafe {
1604 let f: Box_<F> = Box_::new(f);
1605 connect_raw(
1606 self.as_ptr() as *mut _,
1607 b"notify::color\0".as_ptr() as *const _,
1608 Some(transmute::<_, unsafe extern "C" fn()>(
1609 notify_color_trampoline::<Self, F> as *const (),
1610 )),
1611 Box_::into_raw(f),
1612 )
1613 }
1614 }
1615
1616 fn connect_property_cursor_color_notify<F: Fn(&Self) + 'static>(
1617 &self,
1618 f: F,
1619 ) -> SignalHandlerId {
1620 unsafe extern "C" fn notify_cursor_color_trampoline<P, F: Fn(&P) + 'static>(
1621 this: *mut ffi::ClutterText,
1622 _param_spec: glib_sys::gpointer,
1623 f: glib_sys::gpointer,
1624 ) where
1625 P: IsA<Text>,
1626 {
1627 let f: &F = &*(f as *const F);
1628 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1629 }
1630 unsafe {
1631 let f: Box_<F> = Box_::new(f);
1632 connect_raw(
1633 self.as_ptr() as *mut _,
1634 b"notify::cursor-color\0".as_ptr() as *const _,
1635 Some(transmute::<_, unsafe extern "C" fn()>(
1636 notify_cursor_color_trampoline::<Self, F> as *const (),
1637 )),
1638 Box_::into_raw(f),
1639 )
1640 }
1641 }
1642
1643 fn connect_property_cursor_color_set_notify<F: Fn(&Self) + 'static>(
1644 &self,
1645 f: F,
1646 ) -> SignalHandlerId {
1647 unsafe extern "C" fn notify_cursor_color_set_trampoline<P, F: Fn(&P) + 'static>(
1648 this: *mut ffi::ClutterText,
1649 _param_spec: glib_sys::gpointer,
1650 f: glib_sys::gpointer,
1651 ) where
1652 P: IsA<Text>,
1653 {
1654 let f: &F = &*(f as *const F);
1655 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1656 }
1657 unsafe {
1658 let f: Box_<F> = Box_::new(f);
1659 connect_raw(
1660 self.as_ptr() as *mut _,
1661 b"notify::cursor-color-set\0".as_ptr() as *const _,
1662 Some(transmute::<_, unsafe extern "C" fn()>(
1663 notify_cursor_color_set_trampoline::<Self, F> as *const (),
1664 )),
1665 Box_::into_raw(f),
1666 )
1667 }
1668 }
1669
1670 fn connect_property_cursor_position_notify<F: Fn(&Self) + 'static>(
1671 &self,
1672 f: F,
1673 ) -> SignalHandlerId {
1674 unsafe extern "C" fn notify_cursor_position_trampoline<P, F: Fn(&P) + 'static>(
1675 this: *mut ffi::ClutterText,
1676 _param_spec: glib_sys::gpointer,
1677 f: glib_sys::gpointer,
1678 ) where
1679 P: IsA<Text>,
1680 {
1681 let f: &F = &*(f as *const F);
1682 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1683 }
1684 unsafe {
1685 let f: Box_<F> = Box_::new(f);
1686 connect_raw(
1687 self.as_ptr() as *mut _,
1688 b"notify::cursor-position\0".as_ptr() as *const _,
1689 Some(transmute::<_, unsafe extern "C" fn()>(
1690 notify_cursor_position_trampoline::<Self, F> as *const (),
1691 )),
1692 Box_::into_raw(f),
1693 )
1694 }
1695 }
1696
1697 fn connect_property_cursor_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1698 unsafe extern "C" fn notify_cursor_size_trampoline<P, F: Fn(&P) + 'static>(
1699 this: *mut ffi::ClutterText,
1700 _param_spec: glib_sys::gpointer,
1701 f: glib_sys::gpointer,
1702 ) where
1703 P: IsA<Text>,
1704 {
1705 let f: &F = &*(f as *const F);
1706 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1707 }
1708 unsafe {
1709 let f: Box_<F> = Box_::new(f);
1710 connect_raw(
1711 self.as_ptr() as *mut _,
1712 b"notify::cursor-size\0".as_ptr() as *const _,
1713 Some(transmute::<_, unsafe extern "C" fn()>(
1714 notify_cursor_size_trampoline::<Self, F> as *const (),
1715 )),
1716 Box_::into_raw(f),
1717 )
1718 }
1719 }
1720
1721 fn connect_property_cursor_visible_notify<F: Fn(&Self) + 'static>(
1722 &self,
1723 f: F,
1724 ) -> SignalHandlerId {
1725 unsafe extern "C" fn notify_cursor_visible_trampoline<P, F: Fn(&P) + 'static>(
1726 this: *mut ffi::ClutterText,
1727 _param_spec: glib_sys::gpointer,
1728 f: glib_sys::gpointer,
1729 ) where
1730 P: IsA<Text>,
1731 {
1732 let f: &F = &*(f as *const F);
1733 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1734 }
1735 unsafe {
1736 let f: Box_<F> = Box_::new(f);
1737 connect_raw(
1738 self.as_ptr() as *mut _,
1739 b"notify::cursor-visible\0".as_ptr() as *const _,
1740 Some(transmute::<_, unsafe extern "C" fn()>(
1741 notify_cursor_visible_trampoline::<Self, F> as *const (),
1742 )),
1743 Box_::into_raw(f),
1744 )
1745 }
1746 }
1747
1748 fn connect_property_editable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1749 unsafe extern "C" fn notify_editable_trampoline<P, F: Fn(&P) + 'static>(
1750 this: *mut ffi::ClutterText,
1751 _param_spec: glib_sys::gpointer,
1752 f: glib_sys::gpointer,
1753 ) where
1754 P: IsA<Text>,
1755 {
1756 let f: &F = &*(f as *const F);
1757 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1758 }
1759 unsafe {
1760 let f: Box_<F> = Box_::new(f);
1761 connect_raw(
1762 self.as_ptr() as *mut _,
1763 b"notify::editable\0".as_ptr() as *const _,
1764 Some(transmute::<_, unsafe extern "C" fn()>(
1765 notify_editable_trampoline::<Self, F> as *const (),
1766 )),
1767 Box_::into_raw(f),
1768 )
1769 }
1770 }
1771
1772 fn connect_property_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1773 unsafe extern "C" fn notify_ellipsize_trampoline<P, F: Fn(&P) + 'static>(
1774 this: *mut ffi::ClutterText,
1775 _param_spec: glib_sys::gpointer,
1776 f: glib_sys::gpointer,
1777 ) where
1778 P: IsA<Text>,
1779 {
1780 let f: &F = &*(f as *const F);
1781 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1782 }
1783 unsafe {
1784 let f: Box_<F> = Box_::new(f);
1785 connect_raw(
1786 self.as_ptr() as *mut _,
1787 b"notify::ellipsize\0".as_ptr() as *const _,
1788 Some(transmute::<_, unsafe extern "C" fn()>(
1789 notify_ellipsize_trampoline::<Self, F> as *const (),
1790 )),
1791 Box_::into_raw(f),
1792 )
1793 }
1794 }
1795
1796 fn connect_property_font_description_notify<F: Fn(&Self) + 'static>(
1797 &self,
1798 f: F,
1799 ) -> SignalHandlerId {
1800 unsafe extern "C" fn notify_font_description_trampoline<P, F: Fn(&P) + 'static>(
1801 this: *mut ffi::ClutterText,
1802 _param_spec: glib_sys::gpointer,
1803 f: glib_sys::gpointer,
1804 ) where
1805 P: IsA<Text>,
1806 {
1807 let f: &F = &*(f as *const F);
1808 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1809 }
1810 unsafe {
1811 let f: Box_<F> = Box_::new(f);
1812 connect_raw(
1813 self.as_ptr() as *mut _,
1814 b"notify::font-description\0".as_ptr() as *const _,
1815 Some(transmute::<_, unsafe extern "C" fn()>(
1816 notify_font_description_trampoline::<Self, F> as *const (),
1817 )),
1818 Box_::into_raw(f),
1819 )
1820 }
1821 }
1822
1823 fn connect_property_font_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1824 unsafe extern "C" fn notify_font_name_trampoline<P, F: Fn(&P) + 'static>(
1825 this: *mut ffi::ClutterText,
1826 _param_spec: glib_sys::gpointer,
1827 f: glib_sys::gpointer,
1828 ) where
1829 P: IsA<Text>,
1830 {
1831 let f: &F = &*(f as *const F);
1832 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1833 }
1834 unsafe {
1835 let f: Box_<F> = Box_::new(f);
1836 connect_raw(
1837 self.as_ptr() as *mut _,
1838 b"notify::font-name\0".as_ptr() as *const _,
1839 Some(transmute::<_, unsafe extern "C" fn()>(
1840 notify_font_name_trampoline::<Self, F> as *const (),
1841 )),
1842 Box_::into_raw(f),
1843 )
1844 }
1845 }
1846
1847 fn connect_property_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1848 unsafe extern "C" fn notify_justify_trampoline<P, F: Fn(&P) + 'static>(
1849 this: *mut ffi::ClutterText,
1850 _param_spec: glib_sys::gpointer,
1851 f: glib_sys::gpointer,
1852 ) where
1853 P: IsA<Text>,
1854 {
1855 let f: &F = &*(f as *const F);
1856 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1857 }
1858 unsafe {
1859 let f: Box_<F> = Box_::new(f);
1860 connect_raw(
1861 self.as_ptr() as *mut _,
1862 b"notify::justify\0".as_ptr() as *const _,
1863 Some(transmute::<_, unsafe extern "C" fn()>(
1864 notify_justify_trampoline::<Self, F> as *const (),
1865 )),
1866 Box_::into_raw(f),
1867 )
1868 }
1869 }
1870
1871 fn connect_property_line_alignment_notify<F: Fn(&Self) + 'static>(
1872 &self,
1873 f: F,
1874 ) -> SignalHandlerId {
1875 unsafe extern "C" fn notify_line_alignment_trampoline<P, F: Fn(&P) + 'static>(
1876 this: *mut ffi::ClutterText,
1877 _param_spec: glib_sys::gpointer,
1878 f: glib_sys::gpointer,
1879 ) where
1880 P: IsA<Text>,
1881 {
1882 let f: &F = &*(f as *const F);
1883 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1884 }
1885 unsafe {
1886 let f: Box_<F> = Box_::new(f);
1887 connect_raw(
1888 self.as_ptr() as *mut _,
1889 b"notify::line-alignment\0".as_ptr() as *const _,
1890 Some(transmute::<_, unsafe extern "C" fn()>(
1891 notify_line_alignment_trampoline::<Self, F> as *const (),
1892 )),
1893 Box_::into_raw(f),
1894 )
1895 }
1896 }
1897
1898 fn connect_property_line_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1899 unsafe extern "C" fn notify_line_wrap_trampoline<P, F: Fn(&P) + 'static>(
1900 this: *mut ffi::ClutterText,
1901 _param_spec: glib_sys::gpointer,
1902 f: glib_sys::gpointer,
1903 ) where
1904 P: IsA<Text>,
1905 {
1906 let f: &F = &*(f as *const F);
1907 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1908 }
1909 unsafe {
1910 let f: Box_<F> = Box_::new(f);
1911 connect_raw(
1912 self.as_ptr() as *mut _,
1913 b"notify::line-wrap\0".as_ptr() as *const _,
1914 Some(transmute::<_, unsafe extern "C" fn()>(
1915 notify_line_wrap_trampoline::<Self, F> as *const (),
1916 )),
1917 Box_::into_raw(f),
1918 )
1919 }
1920 }
1921
1922 fn connect_property_line_wrap_mode_notify<F: Fn(&Self) + 'static>(
1923 &self,
1924 f: F,
1925 ) -> SignalHandlerId {
1926 unsafe extern "C" fn notify_line_wrap_mode_trampoline<P, F: Fn(&P) + 'static>(
1927 this: *mut ffi::ClutterText,
1928 _param_spec: glib_sys::gpointer,
1929 f: glib_sys::gpointer,
1930 ) where
1931 P: IsA<Text>,
1932 {
1933 let f: &F = &*(f as *const F);
1934 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1935 }
1936 unsafe {
1937 let f: Box_<F> = Box_::new(f);
1938 connect_raw(
1939 self.as_ptr() as *mut _,
1940 b"notify::line-wrap-mode\0".as_ptr() as *const _,
1941 Some(transmute::<_, unsafe extern "C" fn()>(
1942 notify_line_wrap_mode_trampoline::<Self, F> as *const (),
1943 )),
1944 Box_::into_raw(f),
1945 )
1946 }
1947 }
1948
1949 fn connect_property_max_length_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1950 unsafe extern "C" fn notify_max_length_trampoline<P, F: Fn(&P) + 'static>(
1951 this: *mut ffi::ClutterText,
1952 _param_spec: glib_sys::gpointer,
1953 f: glib_sys::gpointer,
1954 ) where
1955 P: IsA<Text>,
1956 {
1957 let f: &F = &*(f as *const F);
1958 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1959 }
1960 unsafe {
1961 let f: Box_<F> = Box_::new(f);
1962 connect_raw(
1963 self.as_ptr() as *mut _,
1964 b"notify::max-length\0".as_ptr() as *const _,
1965 Some(transmute::<_, unsafe extern "C" fn()>(
1966 notify_max_length_trampoline::<Self, F> as *const (),
1967 )),
1968 Box_::into_raw(f),
1969 )
1970 }
1971 }
1972
1973 fn connect_property_password_char_notify<F: Fn(&Self) + 'static>(
1974 &self,
1975 f: F,
1976 ) -> SignalHandlerId {
1977 unsafe extern "C" fn notify_password_char_trampoline<P, F: Fn(&P) + 'static>(
1978 this: *mut ffi::ClutterText,
1979 _param_spec: glib_sys::gpointer,
1980 f: glib_sys::gpointer,
1981 ) where
1982 P: IsA<Text>,
1983 {
1984 let f: &F = &*(f as *const F);
1985 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
1986 }
1987 unsafe {
1988 let f: Box_<F> = Box_::new(f);
1989 connect_raw(
1990 self.as_ptr() as *mut _,
1991 b"notify::password-char\0".as_ptr() as *const _,
1992 Some(transmute::<_, unsafe extern "C" fn()>(
1993 notify_password_char_trampoline::<Self, F> as *const (),
1994 )),
1995 Box_::into_raw(f),
1996 )
1997 }
1998 }
1999
2000 fn connect_property_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2001 unsafe extern "C" fn notify_selectable_trampoline<P, F: Fn(&P) + 'static>(
2002 this: *mut ffi::ClutterText,
2003 _param_spec: glib_sys::gpointer,
2004 f: glib_sys::gpointer,
2005 ) where
2006 P: IsA<Text>,
2007 {
2008 let f: &F = &*(f as *const F);
2009 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2010 }
2011 unsafe {
2012 let f: Box_<F> = Box_::new(f);
2013 connect_raw(
2014 self.as_ptr() as *mut _,
2015 b"notify::selectable\0".as_ptr() as *const _,
2016 Some(transmute::<_, unsafe extern "C" fn()>(
2017 notify_selectable_trampoline::<Self, F> as *const (),
2018 )),
2019 Box_::into_raw(f),
2020 )
2021 }
2022 }
2023
2024 fn connect_property_selected_text_color_notify<F: Fn(&Self) + 'static>(
2025 &self,
2026 f: F,
2027 ) -> SignalHandlerId {
2028 unsafe extern "C" fn notify_selected_text_color_trampoline<P, F: Fn(&P) + 'static>(
2029 this: *mut ffi::ClutterText,
2030 _param_spec: glib_sys::gpointer,
2031 f: glib_sys::gpointer,
2032 ) where
2033 P: IsA<Text>,
2034 {
2035 let f: &F = &*(f as *const F);
2036 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2037 }
2038 unsafe {
2039 let f: Box_<F> = Box_::new(f);
2040 connect_raw(
2041 self.as_ptr() as *mut _,
2042 b"notify::selected-text-color\0".as_ptr() as *const _,
2043 Some(transmute::<_, unsafe extern "C" fn()>(
2044 notify_selected_text_color_trampoline::<Self, F> as *const (),
2045 )),
2046 Box_::into_raw(f),
2047 )
2048 }
2049 }
2050
2051 fn connect_property_selected_text_color_set_notify<F: Fn(&Self) + 'static>(
2052 &self,
2053 f: F,
2054 ) -> SignalHandlerId {
2055 unsafe extern "C" fn notify_selected_text_color_set_trampoline<P, F: Fn(&P) + 'static>(
2056 this: *mut ffi::ClutterText,
2057 _param_spec: glib_sys::gpointer,
2058 f: glib_sys::gpointer,
2059 ) where
2060 P: IsA<Text>,
2061 {
2062 let f: &F = &*(f as *const F);
2063 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2064 }
2065 unsafe {
2066 let f: Box_<F> = Box_::new(f);
2067 connect_raw(
2068 self.as_ptr() as *mut _,
2069 b"notify::selected-text-color-set\0".as_ptr() as *const _,
2070 Some(transmute::<_, unsafe extern "C" fn()>(
2071 notify_selected_text_color_set_trampoline::<Self, F> as *const (),
2072 )),
2073 Box_::into_raw(f),
2074 )
2075 }
2076 }
2077
2078 fn connect_property_selection_bound_notify<F: Fn(&Self) + 'static>(
2079 &self,
2080 f: F,
2081 ) -> SignalHandlerId {
2082 unsafe extern "C" fn notify_selection_bound_trampoline<P, F: Fn(&P) + 'static>(
2083 this: *mut ffi::ClutterText,
2084 _param_spec: glib_sys::gpointer,
2085 f: glib_sys::gpointer,
2086 ) where
2087 P: IsA<Text>,
2088 {
2089 let f: &F = &*(f as *const F);
2090 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2091 }
2092 unsafe {
2093 let f: Box_<F> = Box_::new(f);
2094 connect_raw(
2095 self.as_ptr() as *mut _,
2096 b"notify::selection-bound\0".as_ptr() as *const _,
2097 Some(transmute::<_, unsafe extern "C" fn()>(
2098 notify_selection_bound_trampoline::<Self, F> as *const (),
2099 )),
2100 Box_::into_raw(f),
2101 )
2102 }
2103 }
2104
2105 fn connect_property_selection_color_notify<F: Fn(&Self) + 'static>(
2106 &self,
2107 f: F,
2108 ) -> SignalHandlerId {
2109 unsafe extern "C" fn notify_selection_color_trampoline<P, F: Fn(&P) + 'static>(
2110 this: *mut ffi::ClutterText,
2111 _param_spec: glib_sys::gpointer,
2112 f: glib_sys::gpointer,
2113 ) where
2114 P: IsA<Text>,
2115 {
2116 let f: &F = &*(f as *const F);
2117 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2118 }
2119 unsafe {
2120 let f: Box_<F> = Box_::new(f);
2121 connect_raw(
2122 self.as_ptr() as *mut _,
2123 b"notify::selection-color\0".as_ptr() as *const _,
2124 Some(transmute::<_, unsafe extern "C" fn()>(
2125 notify_selection_color_trampoline::<Self, F> as *const (),
2126 )),
2127 Box_::into_raw(f),
2128 )
2129 }
2130 }
2131
2132 fn connect_property_selection_color_set_notify<F: Fn(&Self) + 'static>(
2133 &self,
2134 f: F,
2135 ) -> SignalHandlerId {
2136 unsafe extern "C" fn notify_selection_color_set_trampoline<P, F: Fn(&P) + 'static>(
2137 this: *mut ffi::ClutterText,
2138 _param_spec: glib_sys::gpointer,
2139 f: glib_sys::gpointer,
2140 ) where
2141 P: IsA<Text>,
2142 {
2143 let f: &F = &*(f as *const F);
2144 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2145 }
2146 unsafe {
2147 let f: Box_<F> = Box_::new(f);
2148 connect_raw(
2149 self.as_ptr() as *mut _,
2150 b"notify::selection-color-set\0".as_ptr() as *const _,
2151 Some(transmute::<_, unsafe extern "C" fn()>(
2152 notify_selection_color_set_trampoline::<Self, F> as *const (),
2153 )),
2154 Box_::into_raw(f),
2155 )
2156 }
2157 }
2158
2159 fn connect_property_single_line_mode_notify<F: Fn(&Self) + 'static>(
2160 &self,
2161 f: F,
2162 ) -> SignalHandlerId {
2163 unsafe extern "C" fn notify_single_line_mode_trampoline<P, F: Fn(&P) + 'static>(
2164 this: *mut ffi::ClutterText,
2165 _param_spec: glib_sys::gpointer,
2166 f: glib_sys::gpointer,
2167 ) where
2168 P: IsA<Text>,
2169 {
2170 let f: &F = &*(f as *const F);
2171 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2172 }
2173 unsafe {
2174 let f: Box_<F> = Box_::new(f);
2175 connect_raw(
2176 self.as_ptr() as *mut _,
2177 b"notify::single-line-mode\0".as_ptr() as *const _,
2178 Some(transmute::<_, unsafe extern "C" fn()>(
2179 notify_single_line_mode_trampoline::<Self, F> as *const (),
2180 )),
2181 Box_::into_raw(f),
2182 )
2183 }
2184 }
2185
2186 fn connect_property_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2187 unsafe extern "C" fn notify_text_trampoline<P, F: Fn(&P) + 'static>(
2188 this: *mut ffi::ClutterText,
2189 _param_spec: glib_sys::gpointer,
2190 f: glib_sys::gpointer,
2191 ) where
2192 P: IsA<Text>,
2193 {
2194 let f: &F = &*(f as *const F);
2195 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2196 }
2197 unsafe {
2198 let f: Box_<F> = Box_::new(f);
2199 connect_raw(
2200 self.as_ptr() as *mut _,
2201 b"notify::text\0".as_ptr() as *const _,
2202 Some(transmute::<_, unsafe extern "C" fn()>(
2203 notify_text_trampoline::<Self, F> as *const (),
2204 )),
2205 Box_::into_raw(f),
2206 )
2207 }
2208 }
2209
2210 fn connect_property_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2211 unsafe extern "C" fn notify_use_markup_trampoline<P, F: Fn(&P) + 'static>(
2212 this: *mut ffi::ClutterText,
2213 _param_spec: glib_sys::gpointer,
2214 f: glib_sys::gpointer,
2215 ) where
2216 P: IsA<Text>,
2217 {
2218 let f: &F = &*(f as *const F);
2219 f(&Text::from_glib_borrow(this).unsafe_cast_ref())
2220 }
2221 unsafe {
2222 let f: Box_<F> = Box_::new(f);
2223 connect_raw(
2224 self.as_ptr() as *mut _,
2225 b"notify::use-markup\0".as_ptr() as *const _,
2226 Some(transmute::<_, unsafe extern "C" fn()>(
2227 notify_use_markup_trampoline::<Self, F> as *const (),
2228 )),
2229 Box_::into_raw(f),
2230 )
2231 }
2232 }
2233}
2234
2235impl fmt::Display for Text {
2236 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2237 write!(f, "Text")
2238 }
2239}