Beispiel #1
0
void show_alert_dialog(){
   SsdWidget box;
   SsdWidget bitmap, text;
   char TextStr[200];
   int 	alertId;
   BOOL is_cancelable;
   const char * iconName;


   alertId = roadmap_alerter_get_active_alert_id();
   roadmap_square_set_current(the_active_alert.square);

   sprintf(TextStr, "%s",roadmap_lang_get((* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_string)) (alertId) ));

   dialog =  ssd_popup_new("Alert_Dlg", TextStr, NULL, SSD_MAX_SIZE, SSD_MIN_SIZE,NULL, SSD_PERSISTENT|SSD_ROUNDED_BLACK | SSD_HEADER_BLACK);

   box = ssd_container_new ("box", NULL, SSD_MIN_SIZE,SSD_MIN_SIZE,SSD_WIDGET_SPACE);
   ssd_widget_set_color(box, NULL, NULL);
   ssd_widget_add (box, space(1));
   sprintf(TextStr,"%s: %d %s", roadmap_lang_get("In"), the_active_alert.distance_to_alert, roadmap_lang_get(roadmap_math_distance_unit()));

   text = ssd_text_new ("Distance", TextStr, 14,0);
   ssd_widget_set_color(text, "#ffffff", "#ffffff");
   ssd_widget_add (box, text);
   ssd_widget_add (dialog, box);

   if (the_active_alert.alert_type == ALERT){
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_alert_icon)) (alertId);
   }
   else {
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_warning_icon)) (alertId);
   }
   bitmap = ssd_bitmap_new("alert_Icon",iconName, SSD_ALIGN_RIGHT);
   ssd_widget_add (box, bitmap);

   is_cancelable = (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->is_cancelable)) (alertId);
#ifdef TOUCH_SCREEN
   ssd_widget_add (dialog,
         ssd_button_label ("Hide", roadmap_lang_get ("Hide"),
            SSD_WS_TABSTOP|SSD_ALIGN_CENTER, alert_dialog_buttons_callback));

   if (is_cancelable){
      ssd_widget_add (dialog,
            ssd_button_label ("Irrelevant", roadmap_lang_get ("Not there"),
               SSD_WS_TABSTOP|SSD_ALIGN_CENTER, alert_dialog_buttons_callback));
   }

#else
   if (is_cancelable)
      set_softkey();
#endif
   ssd_dialog_activate ("Alert_Dlg", NULL);

}
Beispiel #2
0
int RealtimeBonus_PopUpNext (SsdWidget widget, const char *new_value) {
   SsdWidget popup, spacer, container, button, text, icon;
   char msg[512];
   RTBonus *pbonus = g_pbonus;
   const char *title;
   char *text_color = "#ffffff";
   int width;

   if (!pbonus)
      return 0;

   if (ssd_dialog_is_currently_active () && (!strcmp (ssd_dialog_currently_active_name (),
                  "BonusPopUPDlg")))
      ssd_dialog_hide_current (dec_cancel);

   if (pbonus->pBonusTitle){
      title = roadmap_lang_get (pbonus->pBonusTitle);
   }
   else{
      if (pbonus->iType == BONUS_TYPE_TREASURE)
         title = roadmap_lang_get ("Treasure chest");
   }

   popup = ssd_popup_new ("BonusPopUPDlg", title, NULL,
                  SSD_MAX_SIZE, SSD_MIN_SIZE, &pbonus->position, SSD_POINTER_LOCATION
                                 | SSD_ROUNDED_BLACK,DIALOG_ANIMATION_FROM_TOP);

   spacer = ssd_container_new ("space", "", SSD_MIN_SIZE, 5, SSD_END_ROW);
   ssd_widget_set_color (spacer, NULL, NULL);
   ssd_widget_add (popup, spacer);

   container = ssd_container_new ("IconCon", "", 50, SSD_MIN_SIZE, SSD_ALIGN_RIGHT);
   ssd_widget_set_color (container, NULL, NULL);
   icon = ssd_bitmap_new ("bonusIcon", pbonus->pIconName, SSD_ALIGN_VCENTER | SSD_ALIGN_CENTER);
   ssd_widget_add (container, icon);
   ssd_widget_add (popup, container);

   if (pbonus->pBonusText){
      snprintf (msg, sizeof(msg), "%s", pbonus->pBonusText);
   }else if (pbonus->iType == BONUS_TYPE_TREASURE){
      if (!Realtime_is_random_user())
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get ("There may be presents in this treasure chest! You'll know when you drive over it."));
      else
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get ("There may be presents in this treasure chest! You'll know when you drive over it. Note: You need to be a registered user in order to receive the gift inside. Register in 'Settings > Profile'"));
   }

   if (roadmap_canvas_width() > roadmap_canvas_height())
      width = roadmap_canvas_height() - 90;
   else
      width = roadmap_canvas_width() - 90;
   container = ssd_container_new ("IconCon", "", width, SSD_MIN_SIZE, 0);
   ssd_widget_set_color (container, NULL, NULL);
   text = ssd_text_new ("PointsTxt", msg, 16, SSD_END_ROW);
   if (pbonus->pBonusTextColor)
      text_color = pbonus->pBonusTextColor;

   ssd_text_set_color (text,text_color);
   ssd_widget_add (container, text);
   ssd_widget_add (popup, container);

#ifdef TOUCH_SCREEN
   spacer = ssd_container_new ("space", "", SSD_MIN_SIZE, 5, SSD_END_ROW);
   ssd_widget_set_color (spacer, NULL, NULL);
   ssd_widget_add (popup, spacer);

   button = ssd_button_label ("Close_button", roadmap_lang_get ("Close"), SSD_ALIGN_CENTER,
                  on_close);
   ssd_widget_add (popup, button);
#endif //TOUCH_SCREEN
   ssd_dialog_activate ("BonusPopUPDlg", NULL);

   if (!roadmap_screen_refresh ()) {
      roadmap_screen_redraw ();
   }
   return 1;
}
Beispiel #3
0
void show_alert_dialog(){
   SsdWidget box;
   SsdWidget title;
   SsdWidget bitmap, text;
   char TextStr[200];
   int 	alertId;
   BOOL is_cancelable;
   BOOL can_send_thumbs_up;
   const char * iconName;


   alertId = roadmap_alerter_get_active_alert_id();
   roadmap_square_set_current(the_active_alert.square);

   sprintf(TextStr, "%s",roadmap_lang_get((* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_string)) (alertId) ));

   dialog =  ssd_popup_new("Alert_Dlg", TextStr, on_popup_close, SSD_MAX_SIZE, SSD_MIN_SIZE,NULL, SSD_PERSISTENT|SSD_ROUNDED_BLACK, DIALOG_ANIMATION_FROM_TOP);

   title = ssd_widget_get(dialog, "popuup_text");
   if (title)
      ssd_widget_set_color(title,"#f6a201", "#f6a201");

   box = ssd_container_new ("box", NULL, SSD_MIN_SIZE,SSD_MIN_SIZE,SSD_WIDGET_SPACE);
   if (box){
         ssd_widget_set_color(box, NULL, NULL);
         ssd_widget_add (box, space(1));
   }

   if (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_additional_string != NULL){
      const  char *additional_text = (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_additional_string)) (alertId);
      if (additional_text){
         text = ssd_text_new ("AdditionalText", additional_text, 16,SSD_END_ROW);
         ssd_widget_set_color(text, "#ffffff", "#ffffff");
         ssd_widget_add (box, text);
         ssd_widget_add (box, space(1));
      }
   }

   if ((RoadMapAlertProviders.provider[the_active_alert.alert_provider]->show_distance != NULL) && ((*(RoadMapAlertProviders.provider[the_active_alert.alert_provider]->show_distance))(alertId)))
      sprintf(TextStr,"%s %d %s", roadmap_lang_get("In"), (the_active_alert.distance_to_alert/10)*10, roadmap_lang_get(roadmap_math_distance_unit()));

   text = ssd_text_new ("Distance", TextStr, 16,0);
   ssd_widget_set_color(text, "#ffffff", "#ffffff");
   ssd_widget_add (box, text);
   ssd_widget_add (dialog, box);

   if (the_active_alert.alert_type == ALERT){
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_alert_icon)) (alertId);
   }
   else {
      iconName =  (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->get_warning_icon)) (alertId);
   }
   bitmap = ssd_bitmap_new("alert_Icon",iconName, SSD_ALIGN_RIGHT|SSD_ALIGN_VCENTER);
   ssd_widget_set_offset(bitmap, 0, -20);
   ssd_widget_add (box, bitmap);

   is_cancelable = (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->is_cancelable) && (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->is_cancelable)) (alertId);

   can_send_thumbs_up = (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->can_send_thumbs_up) && (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->can_send_thumbs_up)) (alertId);

#ifdef TOUCH_SCREEN
   ssd_widget_add (dialog,
         ssd_button_label ("Close", roadmap_lang_get ("Close"),
            SSD_WS_TABSTOP|SSD_ALIGN_CENTER, alert_dialog_buttons_callback));

   if (can_send_thumbs_up){
      char *icon[3];
      SsdWidget button;
      icon[0] = "thumbs_up_button";
      icon[1] = "thumbs_up_button_down";
      icon[2] = NULL;
      button = ssd_button_new( "ThumbsUp", "Thumbs up", (const char**) &icon[0], 2, SSD_ALIGN_CENTER, alert_dialog_buttons_callback );
      ssd_widget_add(dialog, button);
   }

   if (is_cancelable){
      ssd_widget_add (dialog,
            ssd_button_label ("Irrelevant", roadmap_lang_get ("Not there"),
               SSD_WS_TABSTOP|SSD_ALIGN_CENTER|SSD_END_ROW, alert_dialog_buttons_callback));
   }

   if (can_send_thumbs_up){
      SsdWidget text;
      text = ssd_text_new("ThumbsUpText",roadmap_lang_get("Thanks sent to user"), -1, SSD_ALIGN_CENTER);
      ssd_text_set_color(text, "#f6a201");
      ssd_widget_hide(text);
      ssd_widget_add(dialog, text);
   }

#else
   if (is_cancelable)
      set_softkey();
#endif
   ssd_dialog_activate ("Alert_Dlg", NULL);

   if (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->on_alerter_start != NULL)
      (* (RoadMapAlertProviders.provider[the_active_alert.alert_provider]->on_alerter_start))(the_active_alert.active_alert_id);

}