static int on_close (SsdWidget widget, const char *new_value) { if (ssd_dialog_is_currently_active () && (!strcmp (ssd_dialog_currently_active_name (), "BonusPopUPDlg"))) ssd_dialog_hide_current (dec_close); return 0; }
static int on_delete (SsdWidget widget, const char *new_value){ reminder_remove_pin((char *)widget->context); remider_remover_from_history((char *)widget->context); if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), REMINDER_POP_DLG_NAME))) ssd_dialog_hide_current(dec_close); return 1; }
/************************************************************************************************* * roadmap_canvas_refresh * Canvas refresh interface function */ void roadmap_canvas_refresh (void) { /* * Enable the menu if the map is shown ( no dialogs on it ) */ FreeMapNativeManager_SetIsMenuEnabled( !ssd_dialog_is_currently_active() ); // Signal the java layer to update the screen FreeMapNativeCanvas_RefreshScreen(); }
static int on_close (SsdWidget widget, const char *new_value){ int id = -1; if (widget->context) id = get_id((char *)widget->context); if ((id != -1) && (!ReminderTable.reminder[id].repeat)){ reminder_remove_pin((char *)widget->context); remider_remover_from_history((char *)widget->context); } if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), REMINDER_POP_DLG_NAME))) ssd_dialog_hide_current(dec_close); return 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; }
static void OnReminderShortClick (const char *name, const char *sprite, const char *image, const RoadMapGpsPosition *gps_position, const RoadMapGuiPoint *offset, BOOL is_visible, int scale, int opacity, const char *id, const char *text){ SsdWidget button; SsdWidget spacer; SsdWidget txt; SsdWidget bg; RoadMapPosition Pos; Pos.latitude = gps_position->latitude; Pos.longitude = gps_position->longitude; if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), REMINDER_POP_DLG_NAME))) ssd_dialog_hide_current(dec_close); bg = create_reminder_dlg(); if (get_id(id) != -1){ char msg[250]; int rem_distance; Reminder reminder; SsdWidget container; container = ssd_container_new( "container_txt", "", SSD_MIN_SIZE, SSD_MIN_SIZE, 0 ); ssd_widget_set_color( container, NULL, NULL ); reminder = ReminderTable.reminder[get_id(id)]; txt = ssd_text_new("reminder_title",&reminder.title[0] ,22, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 25, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); txt = ssd_text_new("reminder_desc",&reminder.description[0] ,18, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); rem_distance = roadmap_math_to_trip_distance_tenths(reminder.distance); sprintf(msg, roadmap_lang_get("Distance to remind: %.1f %s"),rem_distance/10.0, roadmap_lang_get(roadmap_math_trip_unit()) ); txt = ssd_text_new("reminder_dist",&msg[0] ,14, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); ssd_widget_add( bg, container ); } #ifdef TOUCH_SCREEN button = create_close_button(); ssd_widget_add(bg, button); button = create_del_button(); ssd_widget_set_offset(button, 0, -20); button->context = strdup(id); ssd_widget_add(bg, button); #endif //TOUCH_SCREEN show_reminder_dlg(); }
static void show_reminder(int id, int distance){ SsdWidget button; SsdWidget spacer; SsdWidget txt; SsdWidget bg; if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), REMINDER_POP_DLG_NAME))) ssd_dialog_hide_current(dec_close); bg = create_reminder_dlg(); if (id != -1){ Reminder reminder; SsdWidget container; char msg[250]; int rem_distance; container = ssd_container_new( "container_txt", "", SSD_MIN_SIZE, SSD_MIN_SIZE, 0 ); ssd_widget_set_color( container, NULL, NULL ); reminder = ReminderTable.reminder[id]; txt = ssd_text_new("reminder_title",&reminder.title[0] ,22, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 25, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); txt = ssd_text_new("reminder_desc",&reminder.description[0] ,18, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); spacer = ssd_container_new( "space", "", SSD_MIN_SIZE, 10, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( container, spacer ); rem_distance = roadmap_math_to_trip_distance_tenths(reminder.distance); sprintf(msg, "%s: %.1f %s",roadmap_lang_get("Distance"), rem_distance/10.0, roadmap_lang_get(roadmap_math_trip_unit()) ); txt = ssd_text_new("reminder_dist",&msg[0] ,14, SSD_END_ROW); ssd_text_set_color(txt, "#ab5939"); ssd_widget_set_offset(txt, 30, 0); ssd_widget_add(container, txt); ssd_widget_add( bg, container ); } #ifdef TOUCH_SCREEN spacer = ssd_container_new( "space", "", 10, 30, SSD_END_ROW ); ssd_widget_set_color( spacer, NULL, NULL ); ssd_widget_add( bg, spacer ); button = create_close_button(); button->context = (void *)roadmap_string_get(generate_id(id)); ssd_widget_add(bg, button); if (ReminderTable.reminder[id].repeat == 1){ button = create_del_button(); button->context = (void *)roadmap_string_get(generate_id(id)); ssd_widget_add(bg, button); } #endif //TOUCH_SCREEN show_reminder_dlg(); }
static void hide_alert_dialog(void){ if (ssd_dialog_is_currently_active() && (!strcmp(ssd_dialog_currently_active_name(), "Alert_Dlg"))) ssd_dialog_hide("Alert_Dlg", dec_close); }
char *ssd_dialog_currently_active_name(void){ if (!ssd_dialog_is_currently_active()) return NULL; else return RoadMapDialogCurrent->name; }