예제 #1
0
static int get_browser_height(){
#ifndef TOUCH_SCREEN
      if (!is_screen_wide())
         return ADJ_SCALE(240);
#endif
      return ADJ_SCALE(155);
}
예제 #2
0
SsdWidget ssd_checkbox_new (const char *name,
                          BOOL Selected,
                          int flags,
                          SsdCallback callback,
                          const char *checked_icon,
                          const char *unchecked_icon,
                          int style) {


   SsdWidget button;
   SsdWidget choice;

   struct ssd_checkbox_data *data =
      (struct ssd_checkbox_data *)calloc (1, sizeof(*data));

   choice =
      ssd_container_new (name, NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, flags);
   ssd_widget_set_color(choice, NULL, NULL);

   data->callback = callback;
   data->selected = Selected;
   data->style = style;
   choice->get_value = get_value;
   choice->get_data = get_data;
   choice->set_value = set_value;
   choice->set_data = set_data;
   choice->data = data;
   choice->bg_color = NULL;

   if (checked_icon == NULL)
   		data->checked_icon = checked_button[data->style];
   else
   		data->checked_icon = checked_icon;

   if (unchecked_icon == NULL)
   		data->unchecked_icon = unchecked_button[data->style];
   else
   		data->unchecked_icon = unchecked_icon;


   if (Selected)
   	button = ssd_button_new ("checkbox_button", "", &data->checked_icon, 1,
                   SSD_ALIGN_VCENTER, choice_callback);
   else
   	button = ssd_button_new ("checkbox_button", "", &data->unchecked_icon, 1,
                   SSD_ALIGN_VCENTER, choice_callback);
   ssd_widget_add (choice, button);

   if (sgChkBoxOffsets.left == 0) {
      sgChkBoxOffsets.left = -ADJ_SCALE(CHKBOX_CLICK_OFFSET_DEFAULT_X);
      sgChkBoxOffsets.top = -ADJ_SCALE(CHKBOX_CLICK_OFFSET_DEFAULT_Y);
      sgChkBoxOffsets.right = ADJ_SCALE(CHKBOX_CLICK_OFFSET_DEFAULT_X);
      sgChkBoxOffsets.bottom = ADJ_SCALE(CHKBOX_CLICK_OFFSET_DEFAULT_Y);
   }

   ssd_widget_set_click_offsets( button, &sgChkBoxOffsets );
   ssd_widget_set_click_offsets( choice, &sgChkBoxOffsets );

   return choice;
}
예제 #3
0
static void _draw_alert(SsdWidget widget, RoadMapGuiRect *rect, int flags) {
	event_on_route_info *data = (event_on_route_info *) widget->data;
	RoadMapImage image;
	int width = widget->parent->cached_size.width - ADJ_SCALE(38);

	image = roadmap_res_get(RES_BITMAP, RES_SKIN, RTAlerts_Get_Map_Icon_By_Type(data->iType));
	if (!image)
		return;

	if (flags & SSD_GET_SIZE) {
		rect->maxx = rect->minx;
		rect->maxy = rect->miny + roadmap_canvas_image_height(image);
	}
	else {
		RoadMapGuiPoint position;
		if (ssd_widget_rtl(NULL))
			position.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(image)
					/ 2 ;
		else
			position.x = rect->minx + (width * data->iStart / 100) - roadmap_canvas_image_width(image)
					/ 2 + ADJ_SCALE(10);
		position.y = rect->miny - ADJ_SCALE(13);
		roadmap_canvas_draw_image(image, &position, 0, IMAGE_NORMAL);
	}

}
예제 #4
0
static void _draw_bar(SsdWidget widget, RoadMapGuiRect *rect, int flags) {

	static RoadMapImage bar_image = NULL;

	if (!bar_image)
		bar_image = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_on_route_bar");

	if (bar_image) {
		RoadMapGuiPoint sign_bottom, sign_top;
		RoadMapGuiPoint position;
		sign_top.x = rect->minx + ADJ_SCALE(15);
		sign_top.y = rect->miny;
		position.x = roadmap_canvas_image_width(bar_image) / 2;
		position.y = roadmap_canvas_image_height(bar_image) / 2;
		sign_bottom.x = rect->maxx - ADJ_SCALE(15);
		sign_bottom.y = rect->miny + roadmap_canvas_image_height(bar_image);
		if (flags & SSD_GET_SIZE) {
			rect->maxy = rect->miny + roadmap_canvas_image_height(bar_image) + 5;
			rect->minx = rect->minx + ADJ_SCALE(15);
			rect->maxx = rect->maxx - ADJ_SCALE(15);
			return;
		}
		else {
			roadmap_canvas_draw_image_stretch(bar_image, &sign_top, &sign_bottom, &position, 0,
					IMAGE_NORMAL);
		}
	}
}
예제 #5
0
static SsdWidget ssd_progress_msg_dialog_new( void )
{
	SsdWidget dialog, group, text;
	SsdWidget text_cnt, spacer, button;
	int         text_container_height = ADJ_SCALE( SSD_PROGRESS_MSG_TXT_CNT_HEIGHT );

	SsdSize     dlg_size;
   dialog = ssd_dialog_new( SSD_PROGRESS_MSG_DLG_NAME, "", NULL, SSD_CONTAINER_BORDER|SSD_PERSISTENT|
								SSD_DIALOG_FLOAT|SSD_ALIGN_CENTER|
								SSD_ALIGN_VCENTER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_BLACK);

    if ( !dialog )
    {
        roadmap_log( ROADMAP_ERROR, "Error creating progress message dialog" );
        return NULL;
    }

    ssd_widget_get_size( dialog, &dlg_size, NULL );

    group = ssd_container_new( "Text Group", NULL,
                SSD_MAX_SIZE, text_container_height, SSD_END_ROW|SSD_ALIGN_CENTER );
    ssd_widget_set_color ( group, NULL, NULL );

    /*
     * Container takes 85% of the dialog width. Aligned at the center vertically and horizontally. Text should fix the container
     * as much as possible
     */
    text_cnt = ssd_container_new ( "Text container", NULL,  dlg_size.width * 0.85, text_container_height, SSD_ALIGN_VCENTER|SSD_ALIGN_CENTER );
    ssd_widget_set_color ( text_cnt, NULL, NULL);
    text = ssd_text_new( SSD_PROGRESS_MSG_TEXT_FLD, "", SSD_PROGRESS_MSG_FONT_SIZE, SSD_ALIGN_VCENTER|SSD_ALIGN_CENTER|SSD_TEXT_LABEL );
    ssd_widget_set_color( text, "#ffffff","#ffffff" );
    ssd_widget_add( text_cnt, text );
    ssd_widget_add ( group, text_cnt );


    ssd_widget_add ( dialog, group );
    // Space below
    spacer = ssd_container_new( "spacer", NULL, SSD_MAX_SIZE, ADJ_SCALE( 3 ), SSD_END_ROW );
    ssd_widget_set_color(spacer, NULL, NULL);
    ssd_widget_add( dialog, spacer );

#ifdef TOUCH_SCREEN
    button = ssd_button_label( "Hide Button", roadmap_lang_get("Hide"), SSD_ALIGN_CENTER, on_button_hide );
    ssd_widget_add( dialog, button );
#endif

    return dialog;
}
예제 #6
0
static SsdWidget _traffic_widget(event_on_route_info *event) {
	SsdWidget w;
	event_on_route_info *data = (event_on_route_info *) calloc(1, sizeof(*data));
	*data = *event;
	w = ssd_container_new("traffic_widget", "", 1, ADJ_SCALE(10), SSD_ALIGN_VCENTER);
	w->data = data;
	w->draw = _draw_traffic;
	return w;
}
예제 #7
0
void RealtimeBonus_FloatingPopUp (RTBonus *pbonus, SsdCallback on_next_cb) {
   char msg[512];
   const char *title;

   if (!pbonus)
      return;

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

   if (pbonus->iType == BONUS_TYPE_POINTS){
      if (pbonus->pBonusText){
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get(pbonus->pBonusText));
      } else if (pbonus->iType == BONUS_TYPE_POINTS){
         snprintf (msg, sizeof(msg), "%d %s",pbonus->iNumPoints, roadmap_lang_get ("points!"));
      } else{
         msg[0] = 0;
      }
   }
   else{
      if (pbonus->pBonusText){
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get(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'"));
      }
   }
   ssd_popup_show_float("BonusPopUPDlg",
                             title,
                             pbonus->pBonusTitleColor,
                             msg,
                             pbonus->pBonusTextColor,
                             pbonus->pIconName,
                             &pbonus->position,
                             ADJ_SCALE(-20),
                             NULL,
                             on_next_cb,
                             "More",
                             (void *)pbonus);

}
예제 #8
0
static void add_title (SsdWidget w, int flags) {
   SsdWidget title, text;
	int rt_soft_key_flag;
	int lf_soft_key_flag;
	int align_flag = SSD_ALIGN_CENTER;

#ifdef TOUCH_SCREEN
	const char *back_buttons[] = {"back_button", "back_button_s"};
#endif

	if (ssd_widget_rtl (NULL)) {
		rt_soft_key_flag = SSD_END_ROW;
		lf_soft_key_flag = SSD_ALIGN_RIGHT;
	}
	else{
		rt_soft_key_flag = SSD_ALIGN_RIGHT;
		lf_soft_key_flag = SSD_END_ROW;
	}


  if (!((w->flags & SSD_DIALOG_FLOAT) && !(w->flags & SSD_DIALOG_TRANSPARENT)))
  {
	int height = ADJ_SCALE( 34 );

#ifdef ANDROID
   align_flag = 0;
#endif //ANDROID

#ifndef TOUCH_SCREEN
      height = 28;
#endif
   title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, height, SSD_END_ROW);
   ssd_widget_set_click_offsets_ext( title, 0, 0, 0, 10 );
   ssd_widget_set_offset(title, 0, 0);
   title->draw = draw_title;
  }
  else{
   int height = 28;
      if ( roadmap_screen_is_hd_screen() )
      {
         height = height*1.8;
      }

      title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, height,
                              SSD_END_ROW);
  }

   ssd_widget_set_color (title, "#ffffff", "#ff0000000");

   text = ssd_text_new ("title_text", "" , 13, SSD_WIDGET_SPACE|SSD_ALIGN_VCENTER|align_flag);

   ssd_widget_set_color (text, "#ffffff", "#ff0000000");



   if ((w->flags & SSD_ROUNDED_CORNERS) && (!(w->flags & SSD_POINTER_MENU)))
   	ssd_widget_set_color (text, "#ffffff", "#ff0000000");

   if (w->flags & SSD_CONTAINER_TITLE){
   		if (w->flags & SSD_ROUNDED_BLACK)
   		   ssd_widget_set_color (text, "#ffffff", "#ffffff");
   		else if (!(w->flags & SSD_DIALOG_FLOAT))
   			ssd_widget_set_color (text, "#ffffff", "#ff0000000");
   		else
   		   if (flags & SSD_DIALOG_TRANSPARENT)
   		      ssd_widget_set_color (text, "#ffffff", "#ff0000000");
   		   else
   		      ssd_widget_set_color (text, "#000000", "#ff0000000");
   }
#if defined(TOUCH_SCREEN)
   if (!( ((flags & SSD_DIALOG_FLOAT)&& !(flags & SSD_DIALOG_TRANSPARENT)) || (flags & SSD_DIALOG_NO_BACK))){
      SsdWidget btn = NULL;
#ifndef ANDROID
      btn = ssd_button_new (SSD_DIALOG_BUTTON_BACK_NAME, "", back_buttons, 2,
                        SSD_ALIGN_VCENTER, button_callback );
#endif


	   if ( ssd_widget_rtl(NULL) )
	   {
         SsdWidget btn2 =             ssd_button_new ("right_title_button", "", back_buttons, 2,
                  SSD_ALIGN_VCENTER, NULL );
         ssd_widget_add( title, btn2 );
         ssd_widget_set_click_offsets_ext( btn2, -40, -20, 20, 10 );
         ssd_widget_hide(btn2);
#ifdef ANDROID
         ssd_dialog_add_hspace (title, 10, 0);
#endif //ANDROID
	      ssd_widget_add (title,text);
	      if ( btn != NULL )
	      {
	         ssd_widget_set_click_offsets_ext( btn, -20, -20, 70, 10 );
	         ssd_widget_set_flags( btn, SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT );
	         ssd_widget_add( title, btn );
	      }
	   }
	   else
	   {
         SsdWidget btn2 =             ssd_button_new ("right_title_button", "", back_buttons, 2,
                  SSD_ALIGN_VCENTER|SSD_ALIGN_RIGHT, NULL );
         ssd_widget_set_click_offsets_ext( btn2, -40, -20, 20, 10 );
         ssd_widget_hide(btn2);
         if ( btn != NULL )
         {
            ssd_widget_set_click_offsets_ext( btn, -20, -20, 70, 10 );
            ssd_widget_add( title, btn );
         }
#ifdef ANDROID
         ssd_dialog_add_hspace (title, 10, 0);
#endif //ANDROID
         ssd_widget_add (title,text);
         ssd_widget_add( title, btn2 );
	   }

	}
   else
   {
	   ssd_widget_add ( title, text );
   }
#else
   ssd_widget_add ( title, text );
#endif

   ssd_widget_add (w, title);
}
예제 #9
0
SsdWidget events_on_route_widget(int altId, int flags) {
	SsdWidget container;
	SsdWidget bar;
	SsdWidget bitmap;
	int i;
	int count = 0;
	int non_traffic_count = 0;
	int height = ADJ_SCALE(50);

	if (!events_on_route_feature_enabled())
		return NULL;
	for (i = 0; i < events_on_route_count_alternative(altId); i++) {
		event_on_route_info *event = events_on_route_at_index_alternative(i, altId);
		if (event->iType != RT_ALERT_TYPE_TRAFFIC_INFO)
			non_traffic_count++;
		count++;
	}

	if (non_traffic_count == 0)
		height = ADJ_SCALE(40);

	container = ssd_container_new("events_container", NULL, SSD_MAX_SIZE, height, SSD_WIDGET_SPACE
			| SSD_END_ROW | flags);
	ssd_widget_set_color(container, NULL, NULL);

	bar = ssd_container_new("events_container", NULL, SSD_MAX_SIZE, ADJ_SCALE(10), SSD_WIDGET_SPACE
			| SSD_END_ROW | SSD_ALIGN_BOTTOM);
	bar->draw = _draw_bar;
	ssd_widget_add(container, bar);

	if (ssd_widget_rtl(NULL)) {
		bitmap = ssd_bitmap_new("Start", "events_arrow_left", 0);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(13) : ADJ_SCALE(3));
	}
	else {
		bitmap = ssd_bitmap_new("Start", "events_arrow_right", 0);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(13) : ADJ_SCALE(3));
	}
	ssd_widget_add(container, bitmap);

	if (ssd_widget_rtl(NULL)) {
		bitmap = ssd_bitmap_new("End", "events_flag_left", SSD_ALIGN_RIGHT);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(3), non_traffic_count ? ADJ_SCALE(10) : ADJ_SCALE(0));
	}
	else {
		bitmap = ssd_bitmap_new("End", "events_flag_right", SSD_ALIGN_RIGHT);
		ssd_widget_set_offset(bitmap, ADJ_SCALE(-3), non_traffic_count ? ADJ_SCALE(10) : ADJ_SCALE(0));
	}
	ssd_widget_add(container, bitmap);

	for (i = 0; i < count; i++) {
		event_on_route_info *event = (event_on_route_info *) events_on_route_at_index_alternative(i, altId);
		if (event->iType != RT_ALERT_TYPE_TRAFFIC_INFO) {
			ssd_widget_add(container, _alert_widget(event));
		}
		else {
			ssd_widget_add(bar, _traffic_widget(event));
		}
	}

	return container;
}
예제 #10
0
static void _draw_traffic(SsdWidget widget, RoadMapGuiRect *rect, int flags) {
	event_on_route_info *data = (event_on_route_info *) widget->data;
	static RoadMapImage events_divider;
	static RoadMapImage events_traffic_1 = NULL;
	static RoadMapImage events_traffic_2 = NULL;
	static RoadMapImage events_traffic_3 = NULL;
	RoadMapImage event_traffic;

	int width = widget->parent->cached_size.width - ADJ_SCALE(34);

	if (ssd_widget_rtl(NULL))
		rect->minx -= ADJ_SCALE(17);
	else
		rect->minx += ADJ_SCALE(17);

	if (!events_divider)
		events_divider = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_divider");

	if (!events_traffic_1)
		events_traffic_1 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_1");
	if (!events_traffic_2)
		events_traffic_2 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_2");

	if (!events_traffic_3)
		events_traffic_3 = roadmap_res_get(RES_BITMAP, RES_SKIN | RES_NOCACHE, "events_traffic_3");

	switch (data->iSeverity) {
	case JAM_TYPE_MODERATE_TRAFFIC:
		event_traffic = events_traffic_1;
		break;
	case JAM_TYPE_HEAVY_TRAFFIC:
		event_traffic = events_traffic_2;
		break;
	case JAM_TYPE_STAND_STILL_TRAFFIC:
		event_traffic = events_traffic_3;
		break;
	default:
		return;
	}

	if (flags & SSD_GET_SIZE) {
		rect->maxx = rect->minx;//.+ 2 ;
		rect->maxy = rect->miny + roadmap_canvas_image_height(events_divider);
	}
	else {
		if ((data->iPrecentage * width / 100) > roadmap_canvas_image_width(events_divider)*2+2) {
			RoadMapGuiPoint position;
			RoadMapGuiPoint sign_top;
			RoadMapGuiPoint sign_bottom;

			if (ssd_widget_rtl(NULL))
				position.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(
						events_divider);
			else
				position.x = rect->minx + (width * data->iStart / 100);
			position.y = rect->miny;
			roadmap_canvas_draw_image(events_divider, &position, 0, IMAGE_NORMAL);

			if (ssd_widget_rtl(NULL))
				position.x = rect->minx - (width * data->iStart / 100) - (width * data->iPrecentage / 100)
						+ roadmap_canvas_image_width(events_divider);
			else
				position.x = rect->minx + (width * data->iStart / 100) + (width * data->iPrecentage / 100)
						- 2 * roadmap_canvas_image_width(events_divider);
			position.y = rect->miny;
			roadmap_canvas_draw_image(events_divider, &position, 0, IMAGE_NORMAL);

			if (ssd_widget_rtl(NULL))
				sign_bottom.x = rect->minx - (width * data->iStart / 100) - roadmap_canvas_image_width(
						events_divider);
			else
				sign_top.x = rect->minx + (width * data->iStart / 100) + roadmap_canvas_image_width(
						events_divider);
			sign_top.y = rect->miny;
			position.x = roadmap_canvas_image_width(event_traffic) / 2;
			position.y = roadmap_canvas_image_height(event_traffic) / 2;
			if (ssd_widget_rtl(NULL))
				sign_top.x = rect->minx - (width * data->iStart / 100) - (width * data->iPrecentage
						/ 100) + 2 * roadmap_canvas_image_width(events_divider);
			else
				sign_bottom.x = rect->minx + (width * data->iStart / 100) + (width * data->iPrecentage
						/ 100) - 2 * roadmap_canvas_image_width(events_divider);
			sign_bottom.y = rect->miny + roadmap_canvas_image_height(event_traffic);
			roadmap_canvas_draw_image_stretch(event_traffic, &sign_top, &sign_bottom, &position, 0,
					IMAGE_NORMAL);
		}
	}

}
예제 #11
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();

}
예제 #12
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();
}
예제 #13
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();
}
예제 #14
0
SsdWidget ssd_entry_new (const char *name,
                         const char *value,
                         int entry_flags,
                         int text_flags,
                         int width,
                         int height,
                         const char *background_text)
{

    SsdWidget space;
    SsdWidget bg_text;
    SsdWidget entry;
    SsdWidget text_box;
    SsdWidget text;
    int tab_st = 0;
    int txt_box_height = ADJ_SCALE(37);
    SsdEntryContext*  ctx = (SsdEntryContext*) calloc( 1, sizeof( SsdEntryContext ) );
#ifndef TOUCH_SCREEN
    txt_box_height = 23;
#endif

#ifdef OPENGL
    if ( height > 0 )
        txt_box_height = height;
#endif

    entry_ctx_init( ctx );

    if (entry_flags & SSD_WS_TABSTOP) {
        entry_flags &= ~SSD_WS_TABSTOP;
        tab_st = SSD_WS_TABSTOP;
    }

    entry =
        ssd_container_new (name, NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, entry_flags);

    text_box =
        ssd_container_new ("text_box", NULL, width,
                           txt_box_height, SSD_CONTAINER_TXT_BOX|SSD_ALIGN_VCENTER|tab_st);
    ssd_widget_set_color(text_box, NULL, NULL);
    ssd_widget_set_pointer_force_click( text_box );
    entry->get_value = get_value;
    entry->set_value = set_value;

    entry->bg_color = NULL;

    text_box->callback = edit_callback;
    text_box->bg_color = NULL;


    space = ssd_container_new("Space", NULL,5, SSD_MIN_SIZE, SSD_WIDGET_SPACE);
    ssd_widget_set_color(space, NULL, NULL);
    ssd_widget_add(text_box, space);
    text = ssd_text_new ("Text", value, -1, text_flags|SSD_ALIGN_VCENTER|SSD_TEXT_SINGLE_LINE );
    ssd_widget_add (text_box, text);
#ifdef TOUCH_SCREEN
    ssd_widget_set_offset(text, 0, -2);
#endif
    if (background_text == NULL)
        bg_text = ssd_text_new ("BgText", "", -1, SSD_ALIGN_VCENTER|SSD_TEXT_SINGLE_LINE);
    else
        bg_text = ssd_text_new ("BgText", background_text, -1, SSD_ALIGN_VCENTER|SSD_TEXT_SINGLE_LINE);
    ssd_widget_set_offset(bg_text, 0, -2);
    ssd_widget_set_color(bg_text, "#C0C0C0",NULL);
    ssd_widget_add (text_box, bg_text);
    entry->context = ctx;

    if ((value != NULL) && (value[0] != 0))
        ssd_widget_hide(bg_text);

    ssd_widget_add (entry, text_box);

    /* Default keyboard params */
    ssd_entry_set_kb_params( entry, background_text, NULL, NULL, NULL, 0 );


    return entry;
}
예제 #15
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 ();

}
예제 #16
0
void ssd_widget_get_size (SsdWidget w, SsdSize *size, const SsdSize *max) {

   SsdSize pack_size = {0, 0};

   RoadMapGuiRect max_size = {0, 0, 0, 0};
   int total_height_below = 0;

   *size = w->size;

   if ((w->size.height >= 0) && (w->size.width >= 0)) {
      return;
   }

   if (!max && (w->cached_size.width < 0)) {
       static SsdSize canvas_size;

       canvas_size.width   = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
 	   canvas_size.height  = roadmap_canvas_height() ;
#else
       canvas_size.height  = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
       max = &canvas_size;
   }
   else{
   	if (!max)
   		max = &w->cached_size;
   }



   if ((w->cached_size.width >= 0) && (w->cached_size.height >= 0)) {
      *size = w->cached_size;
      return;
   }
   /* Comment by AGA. THere is no assignment for this flag
   if (size->height == SSD_MAX_SIZE) {
      // Check if other siblings exists and should be placed below this one
      SsdWidget below_w = w->next;


      while (below_w) {

         if (below_w->flags & SSD_ORDER_LAST) {
            SsdSize s;
            ssd_widget_get_size (below_w, &s, max);

            total_height_below += s.height;
         }
         below_w = below_w->next;
      }

   }
   */

   if ((w->flags & SSD_DIALOG_FLOAT) && !(w->flags & SSD_DIALOG_TRANSPARENT)){
      if ((size->width == SSD_MAX_SIZE) && ((max->width >= roadmap_canvas_width()) || (max->width >= roadmap_canvas_height()))){
         if (roadmap_canvas_width() > roadmap_canvas_height())
            size->width = roadmap_canvas_height();
         else
            size->width = roadmap_canvas_width()- ADJ_SCALE(20);
#ifdef IPHONE
         size->width = ADJ_SCALE(320);
#endif

      }else
         if (size->width == SSD_MAX_SIZE) size->width = max->width -ADJ_SCALE(20);
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;

   } else {

      if (size->width == SSD_MAX_SIZE) size->width = max->width;
      if (size->height== SSD_MAX_SIZE) size->height= max->height - total_height_below;
   }

#ifdef IPHONE_NATIVE
   if (size->width > ADJ_SCALE(320))
      size->width = ADJ_SCALE(320);
#endif //IPHONE

   if ((size->height >= 0) && (size->width >= 0)) {
      w->cached_size = *size;
      return;
   }

   if (size->width >= 0)  {
      max_size.maxx = size->width - 1;
   } else {
      if (!max){
                static SsdSize canvas_size;
                canvas_size.width = roadmap_canvas_width();
#ifdef TOUCH_SCREEN
				canvas_size.height = roadmap_canvas_height();
#else
                canvas_size.height = roadmap_canvas_height() - roadmap_bar_bottom_height();
#endif
                max = &canvas_size;
      }
      max_size.maxx = max->width - 1;
   }

   if (size->height >= 0) {
      max_size.maxy = size->height - 1;
   } else {
      max_size.maxy = max->height - 1;
   }

   if (!(w->flags & SSD_VAR_SIZE) && w->children) {
      RoadMapGuiRect container_rect = max_size;
      int container_width;
      int container_height;

      w->draw (w, &max_size, SSD_GET_SIZE);

      container_width  = max_size.minx - container_rect.minx +
                         container_rect.maxx - max_size.maxx;
      container_height = max_size.miny - container_rect.miny +
                         container_rect.maxy - max_size.maxy;

      calc_pack_size (w->children, &max_size, &pack_size);

      pack_size.width  += container_width;
      pack_size.height += container_height;

   } else {
      w->draw (w, &max_size, SSD_GET_SIZE);
      pack_size.width  = max_size.maxx - max_size.minx + 1;
      pack_size.height = max_size.maxy - max_size.miny + 1;
   }

   if (size->height< 0) size->height = pack_size.height;
   if (size->width < 0) size->width  = pack_size.width;

   w->cached_size = *size;
}