Exemple #1
0
static BOOL on_kb_closed(  int         exit_code,
                           const char* value,
                           void*       context)
{
    SsdWidget w = context;
    SsdEntryContext* ctx = ( SsdEntryContext* ) w->context;
    BOOL retVal = TRUE;

    if( dec_ok == exit_code)
    {
        w->set_value( w, value);

        if( value && value[0])
            ssd_widget_hide( ssd_widget_get( w, "BgText"));
        else
            ssd_widget_show( ssd_widget_get( w, "BgText"));
    }

    if ( ctx->kb_post_done_cb )
    {
        retVal = ctx->kb_post_done_cb( exit_code, value, context );
    }

    return retVal;
}
void ssd_generic_icon_list_dialog_show(
                                  const char*            title,
                                  int                    count,
                                  const char**           labels,
                                  const void**           values,
                                  const char**           icons,
                                  const int*             flags,
                                  PFN_ON_ITEM_SELECTED   on_item_selected,
                                  PFN_ON_ITEM_SELECTED   on_item_deleted,
                                  void*                  context,
                                  const char*            left_softkey_text,
                                  SsdSoftKeyCallback     left_softkey_callback,
                                  int                    list_height,
                                  int                    dialog_flags,
                                  BOOL                   add_next_button)
{
   static SsdListContext list_context;

   SsdWidget list;
   int list_flags = 0;

#if defined (OPENGL)

   /*
    * Borders are fast in OPENGL
    */
   list_flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE;
#endif // OPENGL

   list_context.on_item_selected= on_item_selected;
   list_context.on_item_deleted = on_item_deleted;
   list_context.context         = context;
   list_context.left_softkey_callback = left_softkey_callback;
   if ( !ssd_dialog_exists( SSD_GEN_LIST_DLG_NAME ) )
   {
      GenericList   = ssd_dialog_new ( SSD_GEN_LIST_DLG_NAME, "", on_dialog_closed, SSD_CONTAINER_TITLE|dialog_flags);
      list          = ssd_list_new ("list", SSD_MAX_SIZE, SSD_MAX_SIZE, inputtype_none, 0, NULL);
      ssd_widget_add (GenericList, list);
   }
   else{
     GenericList->flags &= ~SSD_HEADER_BLACK;
     GenericList->flags |= dialog_flags;
   }
   ssd_widget_set_offset(GenericList,0,0);
   list = ssd_widget_get (GenericList, "list");

   GenericList->set_value (GenericList->parent, title);
   ssd_widget_set_context (GenericList, &list_context);


   ssd_widget_reset_cache (list->parent);
   ssd_widget_reset_position(GenericList);
   ssd_list_resize ( list, list_height );
   ssd_list_populate (list, count, labels, values,icons,flags, list_callback, del_callback, add_next_button);
   ssd_widget_set_left_softkey_text(GenericList, left_softkey_text);
   if (left_softkey_callback != NULL)
      ssd_widget_set_left_softkey_callback(GenericList, list_left_softkey_callback);
   ssd_dialog_activate (SSD_GEN_LIST_DLG_NAME, NULL);
   ssd_dialog_draw();
}
Exemple #3
0
int ssd_widget_set_value (const SsdWidget widget, const char *name,
                          const char *value) {

   SsdWidget w = ssd_widget_get (widget, name);
   if (!w || !w->set_value) return -1;

   return w->set_value(w, value);
}
void ssd_generic_list_dialog_show(const char*            title,
                                  int                    count,
                                  const char**           labels,
                                  const void**           values,
                                  PFN_ON_ITEM_SELECTED   on_item_selected,
                                  PFN_ON_ITEM_SELECTED   on_item_deleted,
                                  void*                  context,
                                  int                     list_height )
{
   static SsdListContext list_context;

   SsdWidget list;
   int flags = 0;

#if defined (OPENGL)

   /*
    * Borders are fast in OPENGL
    */
   flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE;
#endif // OPENGL

   list_context.on_item_selected= on_item_selected;
   list_context.on_item_deleted = on_item_deleted;
   list_context.context         = context;
   list_context.left_softkey_callback = NULL;

   if (!GenericList)
   {
      GenericList = ssd_dialog_new ( SSD_GEN_LIST_DLG_NAME, "", on_dialog_closed,
                                    SSD_CONTAINER_TITLE);
      ssd_dialog_add_vspace (GenericList, 5, 0);
      list = ssd_list_new ("list", ssd_container_get_width(), SSD_MAX_SIZE, inputtype_none, flags, NULL);

      ssd_widget_add (GenericList, list);
   }

   list = ssd_widget_get (GenericList, "list");
   ssd_widget_set_offset(GenericList,0,0);

   ssd_widget_set_left_softkey_text(GenericList, roadmap_lang_get("Exit_key"));
   ssd_widget_set_left_softkey_callback(GenericList, NULL);

   GenericList->set_value (GenericList->parent, title);
   ssd_widget_set_context (GenericList, &list_context);

   ssd_widget_reset_cache (list->parent);
   ssd_widget_reset_position(GenericList);
   ssd_list_resize ( list, list_height );
   ssd_list_populate (list, count, labels, values, NULL, NULL, list_callback, del_callback, FALSE);
   ssd_dialog_activate ( SSD_GEN_LIST_DLG_NAME, NULL );
   ssd_dialog_draw();
 }
Exemple #5
0
void roadmap_messagebox (const char *title, const char *text) {

   SsdWidget dialog = ssd_dialog_activate ("message_box", NULL);
   title = roadmap_lang_get (title);
   text  = roadmap_lang_get (text);

   if (!dialog) {
      create_messagebox ();
      dialog = ssd_dialog_activate ("message_box", NULL);
   }

   dialog->set_value (dialog, title);
   ssd_widget_set_value (dialog, "text", text);

	kill_messagebox_timer ();
   ssd_dialog_draw ();
}
void ssd_confirm_dialog_custom (const char *title, const char *text, BOOL default_yes, ConfirmDialogCallback callback, void *context,const char *textYes, const char *textNo) {

SsdWidget dialog;
  confirm_dialog_context *data =
    (confirm_dialog_context  *)calloc (1, sizeof(*data));

  data->default_yes = default_yes;
  dialog = ssd_dialog_activate ("confirm_dialog", NULL);
  title = roadmap_lang_get (title);
  text  = roadmap_lang_get (text);

  if (!dialog) {
      create_confirm_dialog (default_yes,textYes,textNo);
      dialog = ssd_dialog_activate ("confirm_dialog", NULL);
  }
  else{
#ifdef TOUCH_SCREEN
   //set button text & softkeys
   SsdWidget buttonYes;
   SsdWidget buttonNo;
   buttonYes = ssd_widget_get(dialog, roadmap_lang_get ("Yes")); // change the buttons to custom text
   ssd_button_change_text(buttonYes, textYes);
   buttonNo = ssd_widget_get(dialog, roadmap_lang_get ("No"));
   ssd_button_change_text(buttonNo, textNo);
#else //Non touch
   set_soft_keys(dialog, textYes, textNo); // change softkeys text to custom text
   ssd_dialog_refresh_current_softkeys();
#endif
  }

  if (title[0] == 0){
       ssd_widget_hide(ssd_widget_get(dialog, "title_bar"));  
  }
  else{
       ssd_widget_show(ssd_widget_get(dialog, "title_bar"));
  }
   
  data->callback = callback;
  data->context = context;

  dialog->set_value (dialog, title);
  ssd_widget_set_value (dialog, "text", text);
  dialog->context = data;
  ssd_dialog_draw ();
}