00001
00012 #define GITK_RENDERER_C
00013 #define GITKR_WIDGET_CHARACTERINPUT_C
00014
00015 #include "gitkrincludes.h"
00016
00018 void gitkr_widget_characterinput_new(GitkrPhoneWidgetPtr widget,GitkDialogPtr dialog,xmlNodePtr node) {
00019 gitkr_widget_new(widget,dialog,node);
00020 widget->type=GITK_WIDGET_TYPE_CHARACTERINPUT;
00021 widget->output=gitkr_widget_characterinput_output;
00022 widget->handle=gitkr_widget_characterinput_handle;
00023 }
00024
00026 void gitkr_widget_characterinput_output(GitkrPhoneWidgetPtr widget,gboolean active) {
00027 gint str_len;
00028 gchar *value=gitkr_widget_get_value(widget->dialog,widget->id,"value");
00029
00030
00031 capi_text_output(capiinfo,IconEdit,ftinfo);
00032 if(widget->label) {
00033 capi_text_output(capiinfo, widget->label, ftinfo);
00034 }
00035 else {
00036 capi_text_output(capiinfo, widget->id, ftinfo);
00037 }
00038 if(active)capi_text_output(capiinfo, selected, ftinfo);
00039 gitkr_widget_characterinput_value_output((value?value:"value is empty"), 0);
00040 free(value);
00041 }
00042
00046 #define MAX_INPUT_LEN 1024
00047
00049 gboolean gitkr_widget_characterinput_handle(GitkrPhoneWidgetPtr widget) {
00050 gboolean result=TRUE;
00051 gchar editbuf[MAX_INPUT_LEN],*value;
00052
00053
00054 value=gitkr_widget_get_value(widget->dialog,widget->id,"value");
00055
00056 if(value) gitkr_widget_characterinput_value_output((value?value:""), 0);
00057 else capi_sound_question(capiinfo, ftinfo);
00058
00059 capi_text_output(capiinfo,IconEdit,ftinfo);
00060
00061
00062 capi_dtmf_input_text(capiinfo, editbuf);
00063 gitkr_widget_set_value(widget->dialog,widget->id,"value",editbuf);
00064
00069 value=gitkr_widget_get_value(widget->dialog,widget->id,"value");
00070 gitkr_widget_characterinput_value_output((value?value:" "), 0);
00071
00072
00073 return(result);
00074 }
00075
00077 void gitkr_widget_characterinput_value_output(gchar *value, gint offset) {
00078 if(value && value != "" && value != " ") capi_text_output(capiinfo, value, ftinfo);
00079 else capi_text_output(capiinfo, "no value available", ftinfo);
00080 }