ui/common/types.c

changeset 1113
2df0be42b5e0
parent 1105
8e8c7670547f
equal deleted inserted replaced
1112:9250601f9d9a 1113:2df0be42b5e0
971 } 971 }
972 972
973 void ui_list_class_set_iter(UiList *list, void *iter) { 973 void ui_list_class_set_iter(UiList *list, void *iter) {
974 list->iter = iter; 974 list->iter = iter;
975 } 975 }
976
977 /* ---------------- Text functions ---------------- */
978
979 char* ui_text_getsubstr(UiText *text, int begin, int end) {
980 if(text->getsubstr) {
981 text->getsubstr(text, begin, end);
982 } else {
983 return NULL;
984 }
985 }
986
987 void ui_text_insert(UiText *text, int pos, const char *str) {
988 if(text->insert) {
989 text->insert(text, pos, str);
990 }
991 }
992
993 void ui_text_replace(UiText *text, int begin, int end, const char *str) {
994 if(text->replace) {
995 text->replace(text, begin, end, str);
996 }
997 }
998
999 void ui_text_setposition(UiText *text, int pos) {
1000 if(text->setposition) {
1001 text->setposition(text, pos);
1002 }
1003 }
1004
1005 int ui_text_position(UiText *text) {
1006 if(text->position) {
1007 return text->position(text);
1008 } else {
1009 return 0;
1010 }
1011 }
1012
1013 void ui_text_showposition(UiText *text, int pos) {
1014 if(text->showposition) {
1015 text->showposition(text, pos);
1016 }
1017 }
1018
1019 void ui_text_setselection(UiText *text, int begin, int end) {
1020 if(text->setselection) {
1021 text->setselection(text, begin, end);
1022 }
1023 }
1024
1025 void ui_text_selection(UiText *text, int *begin, int *end) {
1026 if(text->selection) {
1027 text->selection(text, begin, end);
1028 } else {
1029 if(begin) {
1030 *begin = 0;
1031 }
1032 if(end) {
1033 *end = 0;
1034 }
1035 }
1036 }
1037
1038 int ui_text_length(UiText *text) {
1039 if(text->length) {
1040 return text->length(text);
1041 } else {
1042 return 0;
1043 }
1044 }
1045 void ui_text_remove(UiText *text, int begin, int end) {
1046 if(text->remove) {
1047 text->remove(text, begin, end);
1048 }
1049 }

mercurial