Ejemplo n.º 1
0
static int on_next (SsdWidget widget, const char *new_value) {
    static SsdWidget dialog;
    SsdWidget button;
    SsdWidget browserCont;
    SsdSize dlg_size, cnt_size;
    int browser_cont_flags = 0;

	ssd_dialog_hide_current(dec_close);

    if ( dialog != NULL )
    {
      if (ssd_dialog_currently_active_name() && !strcmp(ssd_dialog_currently_active_name(), "BonusBrowserDlg"))
            ssd_dialog_hide_current(dec_close);

         ssd_dialog_free( "BonusBrowserDlg", FALSE );
         dialog = NULL;
    }


    dialog = ssd_dialog_new ( "BonusBrowserDlg", "", on_dialog_close,
            SSD_CONTAINER_BORDER|SSD_DIALOG_FLOAT|SSD_DIALOG_MODAL|
            SSD_ALIGN_CENTER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_BLACK);

#ifndef TOUCH_SCREEN
    browser_cont_flags = SSD_ALIGN_VCENTER;
    ssd_dialog_add_vspace(dialog, 2 ,0);
#else
    ssd_dialog_add_vspace(dialog, 5 ,0);
#endif

    browserCont = ssd_container_new("BonusBrowserDlg.BrowserContainer","", SSD_MAX_SIZE, get_browser_height() , SSD_ALIGN_CENTER|browser_cont_flags);
    browserCont->context = (void *)widget->context;
    browserCont->draw = draw_browser_rect;
    ssd_widget_set_color(browserCont, NULL, NULL);
    ssd_widget_add(dialog, browserCont);

#ifdef TOUCH_SCREEN
    ssd_dialog_add_vspace(dialog, 5 ,0);

    button = ssd_button_label("Close_button", roadmap_lang_get("Close"), SSD_ALIGN_CENTER, on_button_close);
    ssd_widget_add(dialog, button);
    button = ssd_button_label("Navigate_button", roadmap_lang_get("Navigate"), SSD_ALIGN_CENTER, on_button_navigate);
    button->context = widget->context;
    ssd_widget_add(dialog, button);
#else
    ssd_widget_set_left_softkey_callback(dialog, NULL);
    ssd_widget_set_left_softkey_text(dialog, "");
#endif
    ssd_dialog_activate ("BonusBrowserDlg", NULL);

    ssd_dialog_recalculate( "BonusBrowserDlg" );
    ssd_widget_get_size( dialog, &dlg_size, NULL );
    ssd_widget_get_size( browserCont, &cnt_size, NULL );

   return 1;
}
Ejemplo n.º 2
0
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;
   /*
    * Borders are fast in OPENGL

    */
   list_flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_CONTAINER_FLAGS;
   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);
      ssd_dialog_add_vspace (GenericList, 5, 0);
      list          = ssd_list_new ("list", ssd_container_get_width(), SSD_MAX_SIZE, inputtype_none, list_flags, NULL);
      ssd_widget_add (GenericList, list);
   }
   else{
     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 ();
}
Ejemplo n.º 3
0
static SsdWidget create_results_container()
{
   SsdWidget rcnt = NULL;
   SsdWidget list = NULL;
   SsdWidget title = NULL;
   SsdWidget bitmap = NULL;
   SsdWidget bitmap_cnt = NULL;
   SsdWidget text = NULL;

   rcnt = ssd_container_new(  LSD_RESULTS_CONT_NAME,
                              NULL,
                              SSD_MIN_SIZE,
                              SSD_MIN_SIZE,
                              0);
   ssd_widget_set_color(rcnt, NULL,NULL);


   title = ssd_container_new(  "Title box",
                   NULL,
                   roadmap_canvas_width()-8,
                   SSD_MIN_SIZE,
                   SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE|SSD_ALIGN_CENTER);

   ssd_dialog_add_vspace( rcnt, 2, 0);
   bitmap_cnt = ssd_container_new( "Logo container", NULL, 80, SSD_MIN_SIZE, SSD_ALIGN_VCENTER );
   bitmap = ssd_bitmap_new( "local search icon", local_search_get_logo_name(), SSD_ALIGN_VCENTER|SSD_ALIGN_CENTER );
   ssd_widget_add( bitmap_cnt, bitmap );
   ssd_widget_add(title, bitmap_cnt);

   text = ssd_text_new("Local search text", roadmap_lang_get("Local search results"), 14, SSD_ALIGN_VCENTER );
   ssd_widget_add(title, text);
   ssd_widget_add( rcnt, title);
   ssd_dialog_add_vspace(rcnt, 5, 0);
   list = ssd_list_new(       LSD_RC_LIST_NAME,
                              SSD_MAX_SIZE,
                              SSD_MAX_SIZE,
                              inputtype_free_text,
                              SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE,
                              NULL);
   //ssd_widget_set_color(list, NULL,NULL);
   ssd_list_resize( list, 80);
   ssd_widget_add( rcnt, list);

   return rcnt;
}
Ejemplo n.º 4
0
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();
 }
Ejemplo n.º 5
0
static void create_confirm_dialog (BOOL default_yes, const char * textYes, const char *textNo) {
   SsdWidget text;
   SsdWidget dialog,widget_title;
   SsdWidget text_con;
   SsdSize dlg_size;
   // const char *question_icon[] = {"question"};

#ifndef TOUCH_SCREEN
   int yes_flags = 0;
   int no_flags = 0;

   if(default_yes)
      yes_flags|= SSD_WS_DEFWIDGET;
   else
      no_flags |= SSD_WS_DEFWIDGET;
#endif

   dialog = ssd_dialog_new ("confirm_dialog", "", NULL,
         SSD_CONTAINER_BORDER|SSD_DIALOG_FLOAT|
         SSD_ALIGN_CENTER|SSD_CONTAINER_TITLE|SSD_ALIGN_VCENTER|SSD_ROUNDED_CORNERS|SSD_POINTER_NONE);
   ssd_widget_set_color (dialog, "#000000", "#ff0000000");


   ssd_widget_get_size( dialog, &dlg_size, NULL );
   /* Spacer */
   ssd_widget_add (dialog,
      ssd_container_new ("spacer1", NULL, 0, 15, SSD_END_ROW));

   /*
   image_container = ssd_container_new ("image_container", NULL,
                                  SSD_MIN_SIZE,
                                  SSD_MIN_SIZE,
                                  SSD_ALIGN_RIGHT);

   ssd_widget_set_color (image_container, "#000000", "#ff0000000");
   ssd_widget_add (image_container,
        ssd_button_new ("question", "question", question_icon , 1,
                           SSD_ALIGN_CENTER|SSD_ALIGN_VCENTER ,
                           NULL));
   // Image container
   ssd_widget_add (dialog,image_container);
    */

   text_con = ssd_container_new ("text_container", NULL,
                                  ( dlg_size.width * 9 )/10,	/* 90% of dialog width */
                                  SSD_MIN_SIZE,
                                  SSD_END_ROW|SSD_ALIGN_CENTER );
   ssd_widget_set_color (text_con, "#000000", "#ff0000000");


   // Text box
   text =  ssd_text_new ("text", "", 16, SSD_END_ROW|SSD_WIDGET_SPACE);

   ssd_widget_add (text_con,text);

  ssd_widget_add(dialog, text_con);

  widget_title = ssd_widget_get( dialog, "title_text" );
  ssd_text_set_font_size( widget_title, 20 );

#ifdef TOUCH_SCREEN

  ssd_dialog_add_vspace( dialog, 10, SSD_START_NEW_ROW );

    ssd_widget_add (dialog,
    ssd_button_label (roadmap_lang_get ("Yes"), textYes,
                        SSD_ALIGN_CENTER| SSD_WS_TABSTOP,
                        yes_button_callback));

   ssd_widget_add (dialog,
		   ssd_button_label (roadmap_lang_get ("No"), textNo,
                        SSD_ALIGN_CENTER| SSD_WS_TABSTOP,
                        no_button_callback));

#else
	set_soft_keys(dialog, textYes, textNo);

#endif
    ssd_widget_add (dialog,
      ssd_container_new ("spacer2", NULL, 0, 10, SSD_START_NEW_ROW|SSD_WIDGET_SPACE));
}
Ejemplo n.º 6
0
/////////////////////////////////////////////////////////////////////
// Twitter
/////////////////////////////////////////////////////////////////////
void welcome_wizard_twitter_dialog(void){
   SsdWidget dialog;
   SsdWidget group, box, label, label_cnt;
   SsdWidget group_title, text;
   SsdWidget bitmap, button;
   const char* icons[3];

   dialog = ssd_dialog_new( WELCOME_WIZ_DLG_TWITTER_NAME, roadmap_lang_get( WELCOME_WIZ_DLG_TWITTER_TITLE ), NULL, SSD_CONTAINER_TITLE|SSD_DIALOG_NO_SCROLL );

   // Space before white container
   ssd_dialog_add_vspace( dialog, ADJ_SCALE( 3 ), 0 );

   box = ssd_container_new ( "Sign Up Box", NULL, SSD_MAX_SIZE,
         SSD_MIN_SIZE, SSD_END_ROW | SSD_ALIGN_CENTER | SSD_CONTAINER_BORDER | SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE|SSD_WIDGET_SPACE );

   // Space inside white container
   ssd_dialog_add_vspace( box, ADJ_SCALE( 1 ), 0 );

   // Twitter title
   group = ssd_container_new ( "Twitter title group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW );
   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_HOFFSET ), SSD_ALIGN_VCENTER );
   bitmap = ssd_bitmap_new( "Twitter logo","welcome_twitter", SSD_ALIGN_VCENTER);
   ssd_widget_add( group, bitmap );
   ssd_dialog_add_hspace( group, ADJ_SCALE( 15 ), SSD_ALIGN_VCENTER );
   group_title = ssd_text_new( "Twitter", roadmap_lang_get( "Twitter" ), 15, SSD_TEXT_LABEL );
   ssd_text_set_color( group_title, "#202020" );
   ssd_widget_add( group, group_title );

   ssd_widget_add( box, group );

   // Tweeter explanation text
   ssd_dialog_add_vspace( box, ADJ_SCALE( 16 ), 0 );
   group = ssd_container_new ( "Twitter text", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW );
   ssd_dialog_add_hspace( group, ADJ_SCALE( 5 ), SSD_ALIGN_VCENTER );
   label = ssd_text_new( "Label", roadmap_lang_get ( "Tweet your road reports" ), WELCOME_WIZ_DLG_LBL_FONT,
                                                            SSD_TEXT_LABEL | SSD_ALIGN_VCENTER | SSD_TEXT_NORMAL_FONT );
   ssd_text_set_color( label, WELCOME_WIZ_DLG_LBL_COLOR );
   ssd_widget_add( group, label );

   ssd_widget_add( box, group );

   // Username
   ssd_dialog_add_vspace( box, ADJ_SCALE( 14 ), 0 );
   group = get_welcome_wiz_entry_group( "Username", "TwitterUserName", "Username" );
   ssd_widget_add( box, group );

   // Password
   ssd_dialog_add_vspace( box, ADJ_SCALE( 10 ), 0 );
   group = get_welcome_wiz_entry_group( "Password", "TwitterPassword", "Password" );
   ssd_widget_add( box, group );

   // Tweet checkout waze
   ssd_dialog_add_vspace( box, ADJ_SCALE( 4 ), 0 );
   group = ssd_container_new ("Tweet checkout group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW | SSD_WS_TABSTOP );
   ssd_widget_set_color ( group, NULL, NULL );
   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_HOFFSET ), 0 );
   ssd_widget_add( group, ssd_checkbox_new ( WELCOME_WIZ_DLG_TWITTER_SET_SIGNUP, TRUE,  0, NULL, NULL, NULL, CHECKBOX_STYLE_DEFAULT ) );
   label_cnt = ssd_container_new ( "Label container", NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_ALIGN_VCENTER );
   ssd_widget_set_color ( label_cnt, NULL, NULL );
   ssd_dialog_add_hspace( label_cnt, ADJ_SCALE( 10 ), 0 );
   label = ssd_text_new ("Label", roadmap_lang_get ( "Tweet that I'm checking-out waze"), WELCOME_WIZ_DLG_LBL_FONT,
                                                               SSD_TEXT_NORMAL_FONT|SSD_TEXT_LABEL|SSD_ALIGN_VCENTER );
   ssd_text_set_color( label, WELCOME_WIZ_DLG_LBL_COLOR );
   ssd_widget_add ( label_cnt, label );
   ssd_widget_add ( group, label_cnt );
   ssd_widget_add ( box, group);

   ssd_dialog_add_vspace( box, ADJ_SCALE( 10 ), 0 );

#ifdef TOUCH_SCREEN

    icons[0] = "welcome_btn";
    icons[1] = "welcome_btn_h";
    icons[2] = NULL;
    // Preload image to get dimensions
    group = ssd_container_new ( "Buttons group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_ALIGN_CENTER | SSD_END_ROW );
    button = ssd_button_label_custom( "Skip", roadmap_lang_get ("Skip"), SSD_ALIGN_CENTER | SSD_ALIGN_VCENTER, twitter_button_callback,
          icons, 2, "#FFFFFF", "#FFFFFF",14 );
    text = ssd_widget_get( button, "label" );
    text->flags |= SSD_TEXT_NORMAL_FONT;
    ssd_text_set_font_size( text, 15 );
    ssd_widget_add ( group, button );
    ssd_dialog_add_hspace( group, ADJ_SCALE( 10 ), SSD_ALIGN_CENTER | SSD_ALIGN_VCENTER );

    // Skip button

    button = ssd_button_label_custom( "Next", roadmap_lang_get ("Next"), SSD_ALIGN_CENTER | SSD_ALIGN_VCENTER, twitter_button_callback,
          icons, 2, "#FFFFFF", "#FFFFFF",14 );
    text = ssd_widget_get( button, "label" );
    text->flags |= SSD_TEXT_NORMAL_FONT;
    ssd_text_set_font_size( text, 15 );
    ssd_widget_add ( group, button );

    ssd_widget_add ( box, group );

    ssd_dialog_add_vspace( box, ADJ_SCALE( 6 ), 0 );
#else
    ssd_widget_set_left_softkey_text       ( dialog, roadmap_lang_get("Next"));
    ssd_widget_set_left_softkey_callback   ( dialog, on_softkey_next_twitter);
#endif

   ssd_widget_add ( dialog, box );

   ssd_dialog_activate( WELCOME_WIZ_DLG_TWITTER_NAME, NULL );
   ssd_dialog_draw();

}
Ejemplo n.º 7
0
/////////////////////////////////////////////////////////////////////
// Ping
/////////////////////////////////////////////////////////////////////
void welcome_wizard_ping_dialog(void){
   SsdWidget dialog;
   SsdWidget group, box, label, label_cnt;
   SsdWidget group_title, text;
   SsdWidget button;
   const char* icons[3];
   char str[512];

   dialog = ssd_dialog_new( WELCOME_WIZ_DLG_PING_NAME, roadmap_lang_get( WELCOME_WIZ_DLG_PING_TITLE ), NULL,
                                                            SSD_CONTAINER_TITLE|SSD_DIALOG_NO_SCROLL );

   box = ssd_container_new ( "Ping Box", NULL, SSD_MAX_SIZE,
         SSD_MIN_SIZE, SSD_END_ROW | SSD_ALIGN_CENTER | SSD_CONTAINER_BORDER | SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE|SSD_WIDGET_SPACE );

   // Space inside white container
   ssd_dialog_add_vspace( box, ADJ_SCALE( 1 ), 0 );

   // Ping title
   group = ssd_container_new ( "Ping title group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW );
   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_PING_HOFFSET ), SSD_ALIGN_VCENTER );

   group_title = ssd_text_new( "Ping", roadmap_lang_get( "Ping" ), 15, SSD_TEXT_LABEL );
   ssd_text_set_color( group_title, "#202020" );
   ssd_widget_add( group, group_title );
   ssd_widget_add( box, group );

   // Ping explanation text
   ssd_dialog_add_vspace( box, ADJ_SCALE( 16 ), 0 );

   snprintf( str, sizeof(str), "%s\n%s",
             roadmap_lang_get("Allow wazers to ping you."),
             roadmap_lang_get("It's useful, fun and you can always turn it off."));

   group = ssd_container_new ( "Ping text", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW );

   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_PING_HOFFSET ), SSD_ALIGN_VCENTER );

   label_cnt = ssd_container_new ( "Label container", NULL, WELCOME_WIZ_DLG_PING_TEXT_WIDTH, SSD_MIN_SIZE, SSD_END_ROW );

   label = ssd_text_new( "Label", str, WELCOME_WIZ_DLG_LBL_FONT,
                                                            SSD_TEXT_LABEL | SSD_TEXT_NORMAL_FONT );
   ssd_text_set_color( label, WELCOME_WIZ_DLG_LBL_COLOR );

   ssd_widget_add( label_cnt, label );
   ssd_widget_add( group, label_cnt );

   ssd_widget_add( box, group );

   ssd_dialog_add_vspace( box, ADJ_SCALE( 34 ), 0 );

   // Ping checkbox
   group = ssd_container_new ("Ping agree group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW | SSD_WS_TABSTOP );
   ssd_widget_set_color ( group, NULL, NULL );
   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_PING_HOFFSET ), 0 );
   ssd_widget_add( group, ssd_checkbox_new ( WELCOME_WIZ_DLG_PING_AGREE, TRUE,  0, NULL, NULL, NULL, CHECKBOX_STYLE_DEFAULT ) );
   label_cnt = ssd_container_new ( "Label container", NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_ALIGN_VCENTER );
   ssd_widget_set_color ( label_cnt, NULL, NULL );
   ssd_dialog_add_hspace( label_cnt, ADJ_SCALE( 10 ), 0 );
   label = ssd_text_new ("Label", roadmap_lang_get( "I agree to be pinged" ), WELCOME_WIZ_DLG_LBL_FONT,
                                                               SSD_TEXT_NORMAL_FONT|SSD_TEXT_LABEL|SSD_ALIGN_VCENTER );
   ssd_text_set_color( label, WELCOME_WIZ_DLG_LBL_COLOR );
   ssd_widget_add ( label_cnt, label );
   ssd_widget_add ( group, label_cnt );
   ssd_widget_add ( box, group);


#ifdef TOUCH_SCREEN

    // Next button
    ssd_dialog_add_vspace( box, ADJ_SCALE( 8 ), 0 );

    icons[0] = "welcome_btn";
    icons[1] = "welcome_btn_h";
    icons[2] = NULL;
    group = ssd_container_new ( "Buttons group", NULL, ssd_container_get_width()*0.9, SSD_MIN_SIZE, SSD_ALIGN_CENTER | SSD_END_ROW );

    button = ssd_button_label_custom( "Next", roadmap_lang_get ("Next"), SSD_ALIGN_RIGHT | SSD_ALIGN_VCENTER, ping_button_callback,
          icons, 2, "#FFFFFF", "#FFFFFF",14 );
    text = ssd_widget_get( button, "label" );
    text->flags |= SSD_TEXT_NORMAL_FONT;
    ssd_text_set_font_size( text, 15 );
    ssd_widget_add ( group, button );

    ssd_widget_add ( box, group );

#else
    ssd_widget_set_left_softkey_text       ( dialog, roadmap_lang_get("Next"));
    ssd_widget_set_left_softkey_callback   ( dialog, on_softkey_next_ping );
#endif

    ssd_dialog_add_vspace( box, ADJ_SCALE( 12 ), 0 );

    ssd_widget_add ( dialog, box );

    ssd_dialog_activate( WELCOME_WIZ_DLG_PING_NAME, NULL );
    ssd_dialog_draw();
}
Ejemplo n.º 8
0
/////////////////////////////////////////////////////////////////////
// Way to go dialog
/////////////////////////////////////////////////////////////////////
void welcome_wizard_way_to_go( void )
{
   SsdWidget dialog;
   SsdWidget group, box;
   SsdWidget group_title, text;
   SsdWidget button, separator, way_to_go_bmp;
   const char* explanation_text;
   const char* icons[3];
#define WAY_TO_GO_TEXT_1_WIDTH   225
#define WAY_TO_GO_TEXT_2_WIDTH   290
   dialog = ssd_dialog_new( WELCOME_WIZ_DLG_WAY_TO_GO_NAME, roadmap_lang_get( WELCOME_WIZ_DLG_WAY_TO_GO_TITLE ), NULL,
                                                            SSD_CONTAINER_TITLE );

   ssd_dialog_add_vspace( dialog, ADJ_SCALE( 5 ), 0 );

   box = ssd_container_new ( "Way to go box", NULL, ssd_container_get_width(),
         SSD_MIN_SIZE, SSD_END_ROW | SSD_ALIGN_CENTER | SSD_CONTAINER_BORDER | SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE|SSD_WIDGET_SPACE );

   // Space inside white container
   ssd_dialog_add_vspace( box, ADJ_SCALE( 12 ), 0 );

   // Title
   group = ssd_container_new ( "Way to go title group", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, SSD_END_ROW );
   ssd_dialog_add_hspace( group, ADJ_SCALE( WELCOME_WIZ_DLG_WAY_TO_GO_HOFFSET ), SSD_ALIGN_VCENTER );

   group_title = ssd_text_new( "Way to go title text", roadmap_lang_get( "Way to go!" ), 25, SSD_TEXT_LABEL );
   ssd_text_set_color( group_title, WELCOME_WIZ_DLG_WAY_TO_GO_TITLE_COLOR );
   ssd_widget_add( group, group_title );
   ssd_widget_add( box, group );

   ssd_dialog_add_vspace( box, ADJ_SCALE( 7 ), 0 );
   group = ssd_container_new ( "Way to go separator group", NULL, ssd_container_get_width()*0.9, SSD_MIN_SIZE, SSD_ALIGN_CENTER|SSD_END_ROW );
   separator = ssd_separator_new( "Separator", SSD_ALIGN_CENTER|SSD_WIDGET_SPACE );
   ssd_widget_add( group, separator );
   ssd_widget_add( box, group );

   /*
    * Logo bitmap
    */
   ssd_dialog_add_vspace( box, ADJ_SCALE( 10 ), 0 );
   way_to_go_bmp = ssd_bitmap_new( "Way to go bitmap", "way_to_go_wazer", SSD_ALIGN_CENTER|SSD_END_ROW );
   ssd_widget_add( box, way_to_go_bmp );

   // Explanation text - I
   ssd_dialog_add_vspace( box, ADJ_SCALE( 12 ), 0 );
   group = ssd_container_new ( "Explanation text I", NULL, ADJ_SCALE( WAY_TO_GO_TEXT_1_WIDTH ), SSD_MIN_SIZE, SSD_END_ROW|SSD_ALIGN_CENTER );
   ssd_widget_set_color( group, NULL, NULL );
   if ( Realtime_is_random_user() )
      explanation_text = "Your temporary account has been created!";
   else
      explanation_text = "Your account has been created!";
   text = ssd_text_new( "Way to go explanation text", roadmap_lang_get( explanation_text ), 16, SSD_TEXT_LABEL|SSD_ALIGN_CENTER );
   ssd_text_set_color( text, WELCOME_WIZ_DLG_WAY_TO_GO_EXPL_COLOR );
   ssd_widget_add( group, text );
   ssd_widget_add( box, group );

   // Explanation text - II
   ssd_dialog_add_vspace( box, ADJ_SCALE( 20 ), 0 );
   group = ssd_container_new ( "Explanation text II", NULL, ADJ_SCALE( WAY_TO_GO_TEXT_2_WIDTH ), SSD_MIN_SIZE, SSD_END_ROW|SSD_ALIGN_CENTER );
   ssd_widget_set_color( group, NULL, NULL );
   explanation_text = "Take a moment to click through the following screens to familiarize yourself with waze...";
   text = ssd_text_new( "Way to go explanation text", roadmap_lang_get( explanation_text ), 15, SSD_TEXT_LABEL|SSD_ALIGN_CENTER );
   ssd_text_set_color( text, WELCOME_WIZ_DLG_WAY_TO_GO_EXPL_COLOR );
   ssd_widget_add( group, text );
   ssd_widget_add( box, group );
   ssd_dialog_add_vspace( box, ADJ_SCALE( 12 ), 0 );

#ifdef TOUCH_SCREEN

    icons[0] = "welcome_btn";
    icons[1] = "welcome_btn_h";
    icons[2] = NULL;
    button = ssd_button_label_custom( "Go", roadmap_lang_get ( "Go" ), SSD_ALIGN_CENTER, way_to_go_button_callback, icons, 2, "#FFFFFF", "#FFFFFF", 14 );
//    text = ssd_widget_get( button, "label" );
//    text->flags |= SSD_TEXT_NORMAL_FONT;
//    ssd_text_set_font_size( text, 15 );
    ssd_widget_add ( box, button );

#else
    ssd_widget_set_left_softkey_text       ( dialog, roadmap_lang_get("Go"));
    ssd_widget_set_left_softkey_callback   ( dialog, on_softkey_left_way_to_go );
#endif

    ssd_dialog_add_vspace( box, ADJ_SCALE( 16 ), 0 );

    ssd_widget_add ( dialog, box );

    ssd_dialog_activate( WELCOME_WIZ_DLG_WAY_TO_GO_NAME, NULL );
    ssd_dialog_draw();
}
Ejemplo n.º 9
0
void roadmap_mood_dialog (RoadMapCallback callback) {

    char **files;
    const char *cursor;
    char **cursor2;
    char *directory = NULL;
    int count = 0;
    SsdWidget moodDlg;
    SsdWidget list;
    SsdWidget exclusive_list;
    SsdWidget baby_list;
    SsdWidget text;
    int i;
    BOOL only_baby_mood = Realtime_IsNewbie();
    int row_height = ssd_container_get_row_height();
    SsdListCallback exclusive_callback = NULL;

    SsdListCallback regular_mood_callback = roadmap_mood_call_back;
    int flags = 0;
    int width = SSD_MAX_SIZE;

    static roadmap_mood_list_dialog context = {"roadmap_mood", NULL};
    static char *labels[MAX_MOOD_ENTRIES] ;
    static void *values[MAX_MOOD_ENTRIES] ;
    static void *icons[MAX_MOOD_ENTRIES];

    static char *exclusive_labels[MAX_EXCLUSIVE_ICONS] ;
    static void *exclusive_values[MAX_EXCLUSIVE_ICONS] ;
    static void *exclusive_icons[MAX_EXCLUSIVE_ICONS];

    static char *baby_labels[1] ;
    static void *baby_values[1] ;
    static void *baby_icons[1];


    flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_CONTAINER_FLAGS;
    width = ssd_container_get_width();


    moodDlg   = ssd_dialog_new ( "MoodDlg", roadmap_lang_get ("Select your mood"), NULL, SSD_CONTAINER_TITLE);
    moodDlg->context = (void *)callback;
    exclusive_list = ssd_list_new ("list", width, SSD_MAX_SIZE, inputtype_none, flags, NULL);

    ssd_list_resize ( exclusive_list, row_height );

    baby_list = ssd_list_new ("baby_list", width, SSD_MAX_SIZE, inputtype_none, flags, NULL);

    ssd_list_resize ( baby_list, row_height );

    exclusive_labels[0] = (char *)roadmap_lang_get("wazer_gold");
    exclusive_values[0] = "wazer_gold";
    exclusive_icons[0] = "wazer_gold";

    exclusive_labels[1] = (char *)roadmap_lang_get("wazer_silver");
    exclusive_values[1] = "wazer_silver";
    exclusive_icons[1] = "wazer_silver";

    exclusive_labels[2] = (char *)roadmap_lang_get("wazer_bronze");
    exclusive_values[2] = "wazer_bronze";
    exclusive_icons[2] = "wazer_bronze";

    if (roadmap_mood_get_exclusive_moods() > 0){
       exclusive_callback = roadmap_exclusive_mood_call_back;
    }

    ssd_list_populate (exclusive_list, 3, (const char **)exclusive_labels, (const void **)exclusive_values, (const char **)exclusive_icons, NULL, exclusive_callback, NULL, FALSE);

    if (only_baby_mood){
       char msg[150];
       baby_labels[0] = (char *)roadmap_lang_get("Baby");
       baby_values[0] = "wazer_baby";
       baby_icons[0] = "wazer_baby";
       ssd_list_populate (baby_list, 1, (const char **)baby_labels, (const void **)baby_values, (const char **)baby_icons, NULL, NULL, NULL, FALSE);

       ssd_dialog_add_hspace(moodDlg, 20, 0);
       text = ssd_text_new ("Baby Mood Txt", roadmap_lang_get("Waze newbie"), SSD_HEADER_TEXT_SIZE, SSD_TEXT_NORMAL_FONT | SSD_END_ROW);
       ssd_widget_add(moodDlg, text);
       ssd_dialog_add_hspace(moodDlg, 20, 0);
       snprintf(msg, sizeof(msg), roadmap_lang_get("(Gotta drive %d+ %s to access other moods)"), roadmap_mood_get_number_of_newbie_miles(), roadmap_lang_get(roadmap_math_trip_unit()));
       text = ssd_text_new ("Gold Mood Txt", msg, 12, SSD_END_ROW|SSD_TEXT_NORMAL_FONT);
       ssd_widget_add(moodDlg, text);
       ssd_widget_add (moodDlg, baby_list);

    }
    ssd_dialog_add_vspace(moodDlg, ADJ_SCALE(5),0);
    ssd_dialog_add_hspace(moodDlg, 20, 0);
    text = ssd_text_new ("Gold Mood Txt", roadmap_lang_get("Exclusive moods"), SSD_HEADER_TEXT_SIZE, SSD_TEXT_NORMAL_FONT | SSD_END_ROW);
    ssd_widget_add(moodDlg, text);
    ssd_dialog_add_hspace(moodDlg, 20, 0);
    text = ssd_text_new ("Gold Mood Txt", roadmap_lang_get("(Available only to top weekly scoring wazers)"), SSD_FOOTER_TEXT_SIZE, SSD_END_ROW|SSD_TEXT_NORMAL_FONT);
    ssd_widget_add(moodDlg, text);
    ssd_dialog_add_vspace(moodDlg, ADJ_SCALE(3),0);
    ssd_widget_add (moodDlg, exclusive_list);

    for (i = 0; i < (3 - roadmap_mood_get_exclusive_moods()); i++){
           SsdWidget row = ssd_list_get_row(exclusive_list, i);
           if (row){
              SsdWidget label = ssd_widget_get(row,"label");
              if (label)
                 ssd_text_set_color(label,"#999999");
           }
    }



    list = ssd_list_new ("list", width, SSD_MAX_SIZE, inputtype_none, flags, NULL);
    exclusive_list->key_pressed = NULL;
    ssd_dialog_add_vspace(moodDlg, ADJ_SCALE(10), 0);
    ssd_dialog_add_hspace(moodDlg, 20, 0);
    text = ssd_text_new ("Gold Mood Txt", roadmap_lang_get("Everyday moods"), SSD_HEADER_TEXT_SIZE, SSD_TEXT_NORMAL_FONT | SSD_END_ROW);
    ssd_widget_add(moodDlg, text);
    ssd_dialog_add_hspace(moodDlg, 20, 0);
    text = ssd_text_new ("Gold Mood Txt", roadmap_lang_get("(Available to all)"), SSD_FOOTER_TEXT_SIZE, SSD_END_ROW|SSD_TEXT_NORMAL_FONT);
    ssd_widget_add(moodDlg, text);
    ssd_dialog_add_vspace(moodDlg, ADJ_SCALE(3),0);
    ssd_widget_add (moodDlg, list);
    ssd_list_resize ( list, row_height );

    context.callback = callback;
    for (cursor = roadmap_path_first ("skin");
            cursor != NULL;
            cursor = roadmap_path_next ("skin", cursor)) {

       directory = roadmap_path_join (cursor, "moods");

      files = roadmap_path_list (directory, ".png");
      if ( *files == NULL )
      {
         files = roadmap_path_list (directory, NULL);
      }

         for (cursor2 = files; *cursor2 != NULL; ++cursor2) {
               labels[count]  =   (char *)(strtok(*cursor2,"."));
               count++;
         }
   }


    qsort((void *) &labels[0], count, sizeof(void *), cstring_cmp);

    for (i = 0; i< count; i++){
       values[i] = labels[i];
       icons[i]   =   roadmap_path_join("moods", labels[i]);
       labels[i] = (char *)roadmap_lang_get(labels[i]);
    }



    if (only_baby_mood){
       regular_mood_callback = NULL;
    }

    free(directory);
    ssd_list_populate (list, count, (const char **)labels, (const void **)values, (const char **)icons, NULL, regular_mood_callback, NULL, FALSE);

    if (only_baby_mood){
       for (i = 0; i< count; i++){
          SsdWidget row = ssd_list_get_row(list, i);
          if (row){
             SsdWidget label = ssd_widget_get(row,"label");
             if (label)
                ssd_text_set_color(label,"#999999");
          }
       }
    }
//    else{
//       SsdWidget row = ssd_list_get_row(baby_list,0 );
//       if (row){
//          SsdWidget label = ssd_widget_get(row,"label");
//          if (label)
//             ssd_text_set_color(label,"#999999");
//       }
//    }

    exclusive_list->key_pressed = NULL;
    ssd_dialog_activate ("MoodDlg", NULL);
    ssd_dialog_draw ();

}