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; } } }
void roadmap_display_sign_pop_up(RoadMapSign *sign) { RoadMapGuiPoint text_position; RoadMapGuiPoint top, bottom; int text_height = 0; RoadMapGuiPoint icon_screen_point; int width, ascent, descent; int lines = 1; int screen_width; int sign_width; int i; int allign = ROADMAP_CANVAS_TOPLEFT; if (ssd_widget_rtl (NULL)) allign = ROADMAP_CANVAS_TOPRIGHT; roadmap_canvas_get_text_extents (sign->content, -1, &width, &ascent, &descent, NULL); text_height = ascent + descent + 5; screen_width = roadmap_canvas_width(); for (i = 0; sign->content[i] != '\0'; i++) if (sign->content[i]=='\n') lines++; if (lines < 2) lines = 2; sign->deadline = -1; top.x = 1; top.y = roadmap_bar_top_height()+1; bottom.x = screen_width; #ifdef TOUCH_SCREEN bottom.y = (lines) * 21 + top.y + 8; sign_width = roadmap_display_border(sign->style, sign->header_type, sign->pointer_type, &bottom, &top, "#d2dfef", &sign->position,0); #else bottom.y = (lines) * 21 + top.y; sign_width = roadmap_display_border(sign->style, sign->header_type, sign->pointer_type, &bottom, &top, "#e4f1f9", &sign->position,0); #endif if (sign->image != NULL){ RoadMapImage close; RoadMapImage image = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, sign->image); if (image){ if (ssd_widget_rtl (NULL)) icon_screen_point.x = top.x + 12; else icon_screen_point.x = top.x + sign_width - 12 - roadmap_canvas_image_width(image); icon_screen_point.y = bottom.y - roadmap_canvas_image_height(image) -12; roadmap_canvas_draw_image (image, &icon_screen_point, 0, IMAGE_NORMAL); } close = (RoadMapImage) roadmap_res_get(RES_BITMAP, RES_SKIN, "rm_quit"); if (close){ icon_screen_point.y = top.y + 4; if (ssd_widget_rtl (NULL)) icon_screen_point.x = top.x + 2; else icon_screen_point.x = top.x + sign_width - 12 - roadmap_canvas_image_width(close); roadmap_canvas_draw_image (close, &icon_screen_point, 0, IMAGE_NORMAL); } } roadmap_canvas_select_pen (sign->foreground); if (ssd_widget_rtl (NULL)) text_position.x = sign_width - 10 ; else text_position.x = 10; #ifdef TOUCH_SCREEN text_position.y = roadmap_bar_top_height() + 5 ; #else text_position.y = roadmap_bar_top_height() + 9 ; #endif roadmap_display_string (sign->content, lines, text_height, &text_position, allign); }