Exemplo n.º 1
0
static void set_softkey(void){

	ssd_widget_set_left_softkey_callback(dialog->parent, report_irrelevant);
	ssd_widget_set_left_softkey_text(dialog->parent, roadmap_lang_get("Not there"));
	ssd_widget_set_right_softkey_text(dialog->parent, roadmap_lang_get("Hide"));
	ssd_widget_set_right_softkey_callback(dialog->parent, hide);
}
static void set_soft_keys(SsdWidget dialog, const char * textYes, const char *textNo){

	ssd_widget_set_right_softkey_text(dialog,textNo);
	ssd_widget_set_right_softkey_callback(dialog,no_softkey_callback);
	ssd_widget_set_left_softkey_text(dialog, textYes);
	ssd_widget_set_left_softkey_callback(dialog,yes_softkey_callback);
}
Exemplo n.º 3
0
SsdWidget ssd_dialog_new (const char *name, const char *title,
                          PFN_ON_DIALOG_CLOSED on_dialog_closed, int flags)
{
   SsdDialog   dialog;

   int width   = SSD_MAX_SIZE;
   int height  = SSD_MAX_SIZE;

   dialog = (SsdDialog)calloc( sizeof( struct ssd_dialog_item), 1);
   roadmap_check_allocated(dialog);

   dialog->name                  = strdup(name);
   dialog->on_dialog_closed      = on_dialog_closed;
   dialog->in_focus              = NULL;
   dialog->tab_order_sorted      = FALSE;
   dialog->gui_tab_order_sorted  = FALSE;
   dialog->use_gui_tab_order     = (SSD_DIALOG_GUI_TAB_ORDER & flags)? TRUE: FALSE;
   dialog->ntv_kb_action = _ntv_kb_action_hide;
   memset( &dialog->ntv_kb_params, 0, sizeof( RMNativeKBParams ) );

   if (flags & SSD_DIALOG_FLOAT) {
      if (flags & SSD_DIALOG_VERTICAL)
         width = SSD_MIN_SIZE;
      else
         width = SSD_MAX_SIZE;
      height = SSD_MIN_SIZE;
   }

   if (flags & SSD_DIALOG_NO_SCROLL) {
      flags &= ~SSD_DIALOG_NO_SCROLL;
      dialog->scroll = FALSE;
   }
   else{
      dialog->scroll = TRUE;
   }

   dialog->container = ssd_container_new (name, title, width, height, flags);
   dialog->next      = RoadMapDialogWindows;

   if (!(flags & SSD_DIALOG_FLOAT)){
      dialog->scroll_container = ssd_container_new (name, title, width, SSD_MIN_SIZE, 0);
      ssd_widget_set_color(dialog->scroll_container, NULL, NULL);
      ssd_widget_add(dialog->container, dialog->scroll_container);
      dialog->stop_offset = 0;
   }

   RoadMapDialogWindows = dialog;

   ssd_widget_set_right_softkey_text(dialog->container, roadmap_lang_get("Back_key"));
   ssd_widget_set_left_softkey_text (dialog->container, roadmap_lang_get("Exit_key"));

   if (!(flags & SSD_DIALOG_FLOAT))
      return dialog->scroll_container;
   else
      return dialog->container;
}
Exemplo n.º 4
0
static void update_button(void){
   char button_txt[20];
   SsdWidget button = ssd_widget_get(dialog, "Hide");
   if (g_seconds != -1)
      sprintf(button_txt, "%s (%d)", roadmap_lang_get ("Hide"), g_seconds);
   else
      sprintf(button_txt, "%s", roadmap_lang_get ("Hide"));
#ifdef TOUCH_SCREEN
   if (button)
      ssd_button_change_text(button,button_txt );
#else
   ssd_widget_set_right_softkey_text(dialog->parent, button_txt);
   ssd_dialog_refresh_current_softkeys();
#endif
   if (!roadmap_screen_refresh())
      roadmap_screen_redraw();
}
Exemplo n.º 5
0
// create the intro screen
static void create_intro_screen(){
	SsdWidget dialog;
	SsdWidget group;
	int tab_flag=0;
	int         width = roadmap_canvas_width() - 10;
	const char* system_lang;
#ifndef TOUCH_SCREEN
    tab_flag = SSD_WS_TABSTOP;
#endif
	system_lang = roadmap_lang_get("lang");
	dialog = ssd_dialog_new ("Intro_screen",
                            roadmap_lang_get ("Hi there!"),
                            NULL,
                            SSD_CONTAINER_TITLE|SSD_DIALOG_NO_BACK);
   group = ssd_container_new ("Welcome", NULL,
            width, SSD_MIN_SIZE,SSD_WIDGET_SPACE|SSD_ALIGN_CENTER|SSD_ALIGN_VCENTER|SSD_END_ROW|SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE);
   ssd_widget_set_color (group, NULL,NULL);
   ssd_widget_add (group, space(8));
   add_intro_texts(group, tab_flag);
#ifdef TOUCH_SCREEN
   ssd_widget_add (group,
   ssd_button_label ("Next", roadmap_lang_get ("Next"),
                     SSD_WS_TABSTOP|SSD_ALIGN_CENTER|SSD_START_NEW_ROW, intro_screen_buttons_callback));

#else
   ssd_widget_set_right_softkey_text       ( dialog, roadmap_lang_get("Next"));
   ssd_widget_set_right_softkey_callback   ( dialog, callGlobalCallback);

   ssd_widget_set_left_softkey_text       ( dialog, roadmap_lang_get(""));
   ssd_widget_set_left_softkey_callback   ( dialog, intro_screen_left_key_callback);

#endif

   ssd_widget_add (group, space(20));
   ssd_widget_add( dialog, group);
   ssd_dialog_activate ("Intro_screen", NULL);
}
Exemplo n.º 6
0
static void draw (SsdWidget widget, RoadMapGuiRect *rect, int flags) {


   RoadMapGuiPoint points[5];
   int count = 5;
#ifdef OPENGL
   RoadMapGuiPoint position;
   RoadMapGuiPoint sign_bottom, sign_top;
   static RoadMapImage focus_image;
#endif
   const char* background = widget->bg_color;


   if (!(flags & SSD_GET_SIZE)) {


      if (widget->in_focus && widget->focus_highlight )
		 background = "#b0d504";
      else if (widget->background_focus)
         background = "#8a8a8a";

      if (background) {
      	if (widget->flags & SSD_ROUNDED_CORNERS){
      		RoadMapGuiRect erase_rect;
			erase_rect.minx = rect->minx + SSD_ROUNDED_CORNER_WIDTH;
      		erase_rect.miny = rect->miny + SSD_ROUNDED_CORNER_HEIGHT;
      		erase_rect.maxx = rect->maxx - SSD_ROUNDED_CORNER_WIDTH;
      		erase_rect.maxy = rect->maxy - SSD_ROUNDED_CORNER_HEIGHT;

      		roadmap_canvas_select_pen (bg);
         	roadmap_canvas_set_foreground (background);
	        //roadmap_canvas_erase_area (&erase_rect);

  	  	 }
  	  	 else{
  	  	    if (!(widget->flags & SSD_DIALOG_TRANSPARENT)){

         	roadmap_canvas_select_pen (bg);
         	roadmap_canvas_set_foreground (background);
            if ((widget->flags & SSD_CONTAINER_TXT_BOX) || (widget->flags & SSD_CONTAINER_SEARCH_BOX)){
      			rect->minx += 10;
      			rect->maxx -= 10;
            }
            else
               roadmap_canvas_erase_area (rect);
#if defined(OPENGL) && !defined(_WIN32)
            if (widget->in_focus && widget->focus_highlight ){
               if (!focus_image)
                  focus_image = roadmap_res_get( RES_BITMAP, RES_SKIN, "focus" );

               if (focus_image){
                  sign_top.x = rect->minx;
                  sign_top.y = rect->miny;
                  position.x = roadmap_canvas_image_width(focus_image)/2;
                  position.y = roadmap_canvas_image_height(focus_image) / 2;
                  sign_bottom.x = rect->maxx;
                  sign_bottom.y = rect->maxy;
                  roadmap_canvas_draw_image_stretch( focus_image, &sign_top, &sign_bottom, &position, 0, IMAGE_NORMAL );
               }

            }
#endif
  	  	    }
  	  	 }
      }
      if ((widget->flags & SSD_SHADOW_BG) )
      {
            draw_shadow_bg();
      }

      if ((widget->flags & SSD_CONTAINER_TITLE) &&
    		  !(widget->flags & SSD_DIALOG_FLOAT) &&
    		  !(widget->flags & SSD_DIALOG_TRANSPARENT) )
      {
   			draw_bg(rect);
      }
   }



   if (widget->flags & SSD_CONTAINER_BORDER) {

      points[0].x = rect->minx + 1;
#ifndef TOUCH_SCREEN
      points[0].y = rect->miny + 1;
      points[1].y = rect->miny + 1;
      points[4].y = rect->miny + 1;
#else
	  points[0].y = rect->miny;
	  points[1].y = rect->miny;
      points[4].y = rect->miny ;
#endif
      points[1].x = rect->maxx - 0;
      points[2].x = rect->maxx - 0;
      points[2].y = rect->maxy - 0;
      points[3].x = rect->minx + 1;
      points[3].y = rect->maxy - 0;
      points[4].x = rect->minx + 1;


      if (!(flags & SSD_GET_SIZE)) {
         const char *color = default_fg;
	 RoadMapPosition *position = NULL;

         roadmap_canvas_select_pen (border);
         if (widget->fg_color) color = widget->fg_color;
         roadmap_canvas_set_foreground (color);

		 if (widget->flags & SSD_ROUNDED_CORNERS){
		 	int pointer_type = POINTER_NONE;
		 	int header_type = HEADER_NONE;
		 	int style = STYLE_NORMAL;
		 	int position_offset = widget->offset_y;

#ifdef TOUCH_SCREEN
			widget->flags &=  ~SSD_POINTER_MENU;
#endif
		 	if (widget->flags & SSD_POINTER_MENU){

		 		pointer_type = POINTER_MENU;
#ifndef OPENGL
		 		points[2].y -= 17;
#endif
		 	}

		 	else if (widget->flags & SSD_POINTER_COMMENT){
		 		pointer_type = POINTER_COMMENT;
#ifdef OPENGL
		 		points[2].y += 20;		/* The height of the pointer */
#else
		 		points[2].y -= 7;
#endif
		 	}
		 	else if (widget->flags & SSD_POINTER_NONE){
		 		pointer_type = POINTER_NONE;
		 		if (!((widget->flags & SSD_ROUNDED_WHITE) || (widget->flags & SSD_ROUNDED_BLACK)))
		 			points[2].y -= 10;
		 	}

		 	if (widget->in_focus  && widget->focus_highlight )
				background = "#b0d504";
         	else if ((widget->flags & SSD_POINTER_COMMENT) | (widget->flags & SSD_POINTER_MENU) |  (widget->flags & SSD_POINTER_NONE))
         		background = "#e4f1f9";
         	else
         		background = "#f3f3f5";

		 	background = "#d2dfef";
	 	   header_type = HEADER_NONE;

			if (widget->flags & SSD_ROUNDED_WHITE){
				style = STYLE_WHITE;
				if (widget->in_focus  && widget->focus_highlight )
					background = "#b0d504";
        		else
					background = "#ffffff";
			}

			if (widget->flags & SSD_ROUNDED_BLACK){
            style = STYLE_BLACK;
            if (widget->in_focus  && widget->focus_highlight )
               background = "#b0d504";
            else
               background = "#000000";
         }

			if (widget->flags & SSD_POINTER_LOCATION){
				if (widget->context != NULL){
					pointer_type = POINTER_POSITION;
					position = (RoadMapPosition *)widget->context;
					//position_offset = ADJ_SCALE(-40);
				}
			}

			if (widget->flags & SSD_POINTER_FIXED_LOCATION){
            if (widget->context != NULL){
               pointer_type = POINTER_FIXED_POSITION;
               position = (RoadMapPosition *)widget->context;
            }
         }

			roadmap_display_border(style, header_type, pointer_type, &points[2], &points[0], background, position, position_offset);

		 }
		 else
	        roadmap_canvas_draw_multiple_lines (1, &count, points, 1);
      }

	  if (widget->flags & SSD_ROUNDED_CORNERS){
	  	if (widget->flags & SSD_ROUNDED_WHITE){
	      	rect->minx += 4;
    	  	rect->miny += 4;
      		rect->maxx -= 4;
      		rect->maxy -= 4;
	  	}
	  	else{
			rect->minx += 10;
			if ((widget->flags & SSD_CONTAINER_TITLE) || (widget->flags & SSD_POINTER_MENU) ||  (widget->flags & SSD_POINTER_NONE))
      			rect->miny += 10;
      		else
      			rect->miny += 4;
      		rect->maxx -= 10;
      		rect->maxy -= 10;
	  	}
  	  }
	  else{
      	rect->minx += 2;
      	rect->miny += 2;
      	rect->maxx -= 2;
      	rect->maxy -= 2;
	  }

   }

   if (widget->flags & SSD_CONTAINER_TXT_BOX){
      	if (!(flags & SSD_GET_SIZE)){
      		if (background){
      			rect->minx -= 10;
      			rect->maxx += 10;
      		}
   			draw_text_box(widget, rect);
      	}
      	rect->minx += 20;
      	rect->miny += 10;
      	rect->maxx -= 20;
      	rect->maxy -= 10;

   }

   if (widget->flags & SSD_CONTAINER_SEARCH_BOX){
         if (!(flags & SSD_GET_SIZE)){
            if (background){
               rect->minx -= 10;
               rect->maxx += 10;
            }
            draw_search_box(widget, rect);
         }
         rect->minx += 20;
         rect->miny += 10;
         rect->maxx -= 20;
         rect->maxy -= 10;

   }
   if (widget->flags & SSD_CONTAINER_TITLE){
   		ssd_widget_set_left_softkey_text(widget, widget->left_softkey);
   		ssd_widget_set_right_softkey_text(widget, widget->right_softkey);
   }

   if ((flags & SSD_GET_CONTAINER_SIZE) &&
       (widget->flags & SSD_CONTAINER_TITLE)) {
      SsdWidget title;

      title = ssd_widget_get (widget, "title_bar");

      if (title) {
         SsdSize title_size;
         SsdSize max_size;
         max_size.width = rect->maxx - rect->minx + 1;
         max_size.height = rect->maxy - rect->miny + 1;

         ssd_widget_get_size (title, &title_size, &max_size);
         rect->miny += title_size.height;

      }

   }
}
static void roadmap_geo_location_dialog(void){
   SsdWidget dialog;
   SsdWidget group;
   SsdWidget progress;
   SsdWidget text;
   SsdWidget container;
   SsdWidget title;
   
   int width = roadmap_canvas_width() - 20;
   dialog = ssd_dialog_new ("geo_location_info",
                            roadmap_lang_get ("waze status in your area"),
                            NULL,
                            SSD_CONTAINER_TITLE|SSD_DIALOG_NO_BACK);
   
   group = ssd_container_new ("geo_location_group", NULL,
            width, SSD_MIN_SIZE,SSD_WIDGET_SPACE|SSD_ALIGN_CENTER|SSD_END_ROW|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE|SSD_CONTAINER_BORDER);
   ssd_widget_set_color (group, NULL,NULL);
   ssd_widget_add (group, space(5));
   text = ssd_text_new ("Metro", g_geo_info.metroplolitan, 28,SSD_ALIGN_CENTER);
   ssd_widget_add (group, text);
   text = ssd_text_new ("Label_label", roadmap_lang_get("Metro"), 28,SSD_ALIGN_CENTER|SSD_END_ROW);
   ssd_widget_add (group, text);
   ssd_widget_add (group, space(5));

   title = ssd_container_new ("title_gr", NULL,
            SSD_MIN_SIZE, SSD_MIN_SIZE,SSD_ALIGN_CENTER|SSD_END_ROW);
   ssd_widget_set_color(title, NULL, NULL);
   
   text = ssd_text_new ("Label_status", roadmap_lang_get("Status:   "), 20, 0);
   ssd_widget_add (title, text);
   text = ssd_text_new ("Status", g_geo_info.state, 20,SSD_END_ROW);
   ssd_widget_set_color(text, "#4886b7", "#4886b7");
   ssd_widget_add (title, text);
   ssd_widget_add (group, title);
   ssd_widget_add (group, space(15));

   text = ssd_text_new ("What you get label", roadmap_lang_get("What you get:"), 18,SSD_ALIGN_CENTER|SSD_END_ROW);
   ssd_widget_add (group, text);
   
   ssd_widget_add (group, space(5));
   text = ssd_text_new ("Map_label", roadmap_lang_get("Navigable map:   "), 14,0);
   ssd_widget_add (group, text);
   text = ssd_text_new ("Map_label_value", g_geo_info.map_score, 14,SSD_END_ROW);
   ssd_widget_set_color(text, "#4886b7", "#4886b7");
   ssd_widget_add (group, text);

   
   ssd_widget_add (group, space(5));
   
   text = ssd_text_new ("Traffic_label", roadmap_lang_get("Real-Time traffic:  "), 14, 0);
   ssd_widget_add (group, text);
   text = ssd_text_new ("Traffic_label_value", g_geo_info.traffic_score, 14,SSD_END_ROW);
   ssd_widget_set_color(text, "#4886b7", "#4886b7");
   ssd_widget_add (group, text);
   ssd_widget_add (group, space(5));
   
   text = ssd_text_new ("Usage_label", roadmap_lang_get("Community alerts:   "), 14,0);
   ssd_widget_add (group, text);
   text = ssd_text_new ("Usage_label", g_geo_info.usage_score, 14,SSD_END_ROW);
   ssd_widget_set_color(text, "#4886b7", "#4886b7");
   ssd_widget_add (group, text);
   ssd_widget_add (group, space(5));
   
   ssd_widget_add (group, space(20));
   progress = ssd_progress_new("progress",SSD_MAX_SIZE, 0);
   ssd_progress_set_value(progress, g_geo_info.overall_score);
   ssd_widget_add(group, progress);
   
   
   //ssd_widget_add (group, space(5));
   
   container = ssd_container_new ("text_cont", NULL,
            80, SSD_MIN_SIZE,SSD_WIDGET_SPACE);
   text = ssd_text_new ("Early building", roadmap_lang_get("Early Building"), -1, SSD_ALIGN_CENTER);
   ssd_widget_add (container, text);
   ssd_widget_add (group, container);
   
   container = ssd_container_new ("text_cont", NULL,
            80, SSD_MIN_SIZE,SSD_WIDGET_SPACE|SSD_ALIGN_CENTER);
   text = ssd_text_new ("Partial Value", roadmap_lang_get("Partial Value"), -1, SSD_ALIGN_CENTER);
   ssd_widget_add (container, text);
   ssd_widget_add (group, container);

   container = ssd_container_new ("text_cont", NULL,
            40, SSD_MIN_SIZE,SSD_WIDGET_SPACE|SSD_END_ROW);
   text = ssd_text_new ("Full Value", roadmap_lang_get("Full Value"), -1, SSD_ALIGN_CENTER);
   ssd_widget_add (container, text);
   ssd_widget_add (group, container);

#ifdef TOUCH_SCREEN   
   ssd_widget_add (group, space(15));
   ssd_widget_add (group,
                   ssd_button_label ("Let me in", roadmap_lang_get ("Let me in"),
                        SSD_WS_TABSTOP|SSD_ALIGN_CENTER|SSD_START_NEW_ROW, button_callback));
#else
   ssd_widget_set_right_softkey_text      ( dialog, roadmap_lang_get("Let me in"));
   ssd_widget_set_right_softkey_callback  ( dialog, on_softkey);

#endif
   ssd_widget_add (group, space(5));
   ssd_widget_add( dialog, group);
   ssd_dialog_activate ("geo_location_info", NULL);
}