예제 #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;
}
예제 #2
0
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;
}
예제 #3
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;
}
예제 #4
0
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;
}
예제 #5
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;
}
예제 #6
0
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();
}
예제 #7
0
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();

}
예제 #8
0
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);
}