gitkrwoptionchoiceboolean.c

Go to the documentation of this file.
00001 
00012 #define GITK_RENDERER_C
00013 #define GITKR_WIDGET_OPTIONCHOICE_BOOLEAN_C
00014 
00015 #include "gitkrincludes.h"
00016 
00018 void gitkr_widget_optionchoice_boolean_new(GitkrPhoneWidgetPtr widget,GitkDialogPtr dialog,xmlNodePtr node) {
00019   gitkr_widget_new(widget,dialog,node);
00020   widget->type=GITK_WIDGET_TYPE_OPTIONCHOICE_BOOLEAN;
00021   widget->output=gitkr_widget_optionchoice_boolean_output;
00022   widget->handle=gitkr_widget_optionchoice_boolean_handle;
00023 }
00024 
00026 void gitkr_widget_optionchoice_boolean_output(GitkrPhoneWidgetPtr widget,gboolean active) {
00027   gchar *value=gitkr_widget_get_value(widget->dialog,widget->id,"value");
00028   gint cur_value;
00029 
00030   //-- determine selected entry
00031   cur_value=(value?atoi(value):0);
00032   g_free(value);
00033 
00034   capi_text_output(capiinfo,IconOptionChoice,ftinfo);
00035   //-- display label
00036   if(widget->label) {
00037     capi_text_output(capiinfo, widget->label, ftinfo);
00038   }
00039   else {
00040     capi_text_output(capiinfo, widget->id, ftinfo);
00041   }
00042   if(cur_value) capi_text_output(capiinfo, TextOn, ftinfo);
00043   else capi_text_output(capiinfo, TextOff, ftinfo);
00044 }
00045 
00047 gboolean gitkr_widget_optionchoice_boolean_handle(GitkrPhoneWidgetPtr widget) {
00048   gchar *value=gitkr_widget_get_value(widget->dialog,widget->id,"value");
00049   gint cur_value;
00050   char res[10]; //-- temporary buffer for setting the result
00051 
00052   
00053   capi_text_output(capiinfo,IconOptionChoice,ftinfo);
00054   //-- determine selected entry
00055   cur_value=1-(value?atoi(value):0);
00056   g_free(value);
00057   sprintf(res,"%d",cur_value);
00058   gitkr_widget_set_value(widget->dialog,widget->id,"value",res);
00059 
00060   return(TRUE);
00061 }

Generated on Thu Oct 28 10:59:14 2004 for gitk by doxygen 1.3.6