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