ui/gtk/text.c

changeset 29
3fc287f06305
parent 0
2483f517c562
child 32
e5f4d8af567e
equal deleted inserted replaced
28:1ecc1183f046 29:3fc287f06305
191 text->value.ptr = g_strdup(str); 191 text->value.ptr = g_strdup(str);
192 text->value.free = (ui_freefunc)g_free; 192 text->value.free = (ui_freefunc)g_free;
193 return str; 193 return str;
194 } 194 }
195 195
196 void ui_textarea_set(UiText *text, char *str) { 196 void ui_textarea_set(UiText *text, const char *str) {
197 gtk_text_buffer_set_text((GtkTextBuffer*)text->obj, str, -1); 197 gtk_text_buffer_set_text((GtkTextBuffer*)text->obj, str, -1);
198 if(text->value.ptr) { 198 if(text->value.ptr) {
199 text->value.free(text->value.ptr); 199 text->value.free(text->value.ptr);
200 } 200 }
201 text->value.ptr = NULL; 201 text->value.ptr = NULL;
630 e.intval = 0; 630 e.intval = 0;
631 ui_notify_evt(value->observers, &e); 631 ui_notify_evt(value->observers, &e);
632 } 632 }
633 } 633 }
634 634
635 UIWIDGET ui_textfield(UiObject *obj, UiString *value) { 635 UIWIDGET ui_textfield_deprecated(UiObject *obj, UiString *value) {
636 return create_textfield(obj, 0, FALSE, FALSE, value); 636 return create_textfield(obj, 0, FALSE, FALSE, value);
637 } 637 }
638 638
639 UIWIDGET ui_textfield_nv(UiObject *obj, char *varname) { 639 UIWIDGET ui_textfield_nv(UiObject *obj, char *varname) {
640 return create_textfield_nv(obj, 0, FALSE, FALSE, varname); 640 return create_textfield_nv(obj, 0, FALSE, FALSE, varname);
646 646
647 UIWIDGET ui_textfield_wnv(UiObject *obj, int width, char *varname) { 647 UIWIDGET ui_textfield_wnv(UiObject *obj, int width, char *varname) {
648 return create_textfield_nv(obj, width, FALSE, FALSE, varname); 648 return create_textfield_nv(obj, width, FALSE, FALSE, varname);
649 } 649 }
650 650
651 UIWIDGET ui_frameless_textfield(UiObject *obj, UiString *value) { 651 UIWIDGET ui_frameless_textfield_deprecated(UiObject *obj, UiString *value) {
652 return create_textfield(obj, 0, TRUE, FALSE, value); 652 return create_textfield(obj, 0, TRUE, FALSE, value);
653 } 653 }
654 654
655 UIWIDGET ui_frameless_textfield_nv(UiObject *obj, char *varname) { 655 UIWIDGET ui_frameless_textfield_nv(UiObject *obj, char *varname) {
656 return create_textfield_nv(obj, 0, TRUE, FALSE, varname); 656 return create_textfield_nv(obj, 0, TRUE, FALSE, varname);
657 } 657 }
658 658
659 UIWIDGET ui_passwordfield(UiObject *obj, UiString *value) { 659 UIWIDGET ui_passwordfield_deprecated(UiObject *obj, UiString *value) {
660 return create_textfield(obj, 0, FALSE, TRUE, value); 660 return create_textfield(obj, 0, FALSE, TRUE, value);
661 } 661 }
662 662
663 UIWIDGET ui_passwordfield_nv(UiObject *obj, char *varname) { 663 UIWIDGET ui_passwordfield_nv(UiObject *obj, char *varname) {
664 return create_textfield_nv(obj, 0, FALSE, TRUE, varname); 664 return create_textfield_nv(obj, 0, FALSE, TRUE, varname);
679 str->value.ptr = g_strdup(gtk_entry_get_text(str->obj)); 679 str->value.ptr = g_strdup(gtk_entry_get_text(str->obj));
680 str->value.free = (ui_freefunc)g_free; 680 str->value.free = (ui_freefunc)g_free;
681 return str->value.ptr; 681 return str->value.ptr;
682 } 682 }
683 683
684 void ui_textfield_set(UiString *str, char *value) { 684 void ui_textfield_set(UiString *str, const char *value) {
685 gtk_entry_set_text(str->obj, value); 685 gtk_entry_set_text(str->obj, value);
686 if(str->value.ptr) { 686 if(str->value.ptr) {
687 str->value.free(str->value.ptr); 687 str->value.free(str->value.ptr);
688 str->value.ptr = NULL; 688 str->value.ptr = NULL;
689 str->value.free = NULL; 689 str->value.free = NULL;

mercurial