Esempio n. 1
0
static void ssd_widget_draw_one (SsdWidget w, int x, int y, int height) {

   RoadMapGuiRect rect;
   SsdSize size;

   ssd_widget_get_size (w, &size, NULL);

   if (w->flags & SSD_ALIGN_VCENTER) {
      y += (height - size.height) / 2;
   }

   w->position.x = x;
   w->position.y = y;


   if (size.width && size.height) {
      rect.minx = x;
      rect.miny = y;
      rect.maxx = x + size.width - 1;
      rect.maxy = y + size.height - 1;

#if 0
      if (!w->parent) printf("****** start draw ******\n");
      printf("draw - %s:%s x=%d-%d y=%d-%d ofset_x=%d ofset_y=%d \n", w->_typeid, w->name, rect.minx, rect.maxx, rect.miny, rect.maxy, w->offset_x, w->offset_y);
#endif
      if (!RecalculateWidgets && ssd_widget_rect_in_screen(&rect))
           w->draw(w, &rect, 0);

      if (w->children) ssd_widget_draw (w->children, &rect, w->flags);
   }
}
Esempio n. 2
0
void ssd_widget_container_size (SsdWidget dialog, SsdSize *size) {

   SsdSize max_size;

   /* Calculate size recurisvely */
   if (dialog->parent) {
      ssd_widget_container_size (dialog->parent, size);
      max_size.width = size->width;
      max_size.height = size->height;

   } else {
      max_size.width = roadmap_canvas_width ();
#ifdef TOUCH_SCREEN
      max_size.height = roadmap_canvas_height ();
#else
      max_size.height = roadmap_canvas_height () - roadmap_bar_bottom_height();
#endif
   }

   ssd_widget_get_size (dialog, size, &max_size);

   if (dialog->draw) {
      RoadMapGuiRect rect;
      rect.minx = 0;
      rect.miny = 0;
      rect.maxx = size->width - 1;
      rect.maxy = size->height - 1;

      dialog->draw (dialog, &rect, SSD_GET_SIZE|SSD_GET_CONTAINER_SIZE);

      size->width = rect.maxx - rect.minx + 1;
      size->height = rect.maxy - rect.miny + 1;
   }
}
Esempio n. 3
0
static void get_size(SsdWidget w, SsdSize * pack_size, RoadMapGuiRect * max_size){
	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;
	}
}
Esempio n. 4
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;
}
Esempio n. 5
0
static void draw_dialog (SsdDialog dialog) {

   if (!dialog) {
      return;

   } else {
      RoadMapGuiRect rect;
      rect.minx = 0;
#ifndef TOUCH_SCREEN
      if (is_screen_wide())
         rect.miny = 1;
      else
         rect.miny = roadmap_bar_top_height()+1;
      rect.maxx = roadmap_canvas_width() -1;
#else
      rect.miny = 1;
      rect.maxx = roadmap_canvas_width() -1;
#endif

#ifdef TOUCH_SCREEN
      rect.maxy = roadmap_canvas_height() - 1;
#else
      rect.maxy = roadmap_canvas_height() - 1 - roadmap_bar_bottom_height() ;
#endif

      ssd_widget_reset_cache (dialog->container);
      ssd_widget_draw (dialog->container, &rect, 0);

      if ((dialog->container->flags & SSD_CONTAINER_TITLE) && (dialog->scroll_container != NULL) && (dialog->scroll_container->offset_y < 0)){
         SsdWidget title;
         SsdSize size;
         title = ssd_widget_get (dialog->container, "title_bar");
         ssd_widget_get_size(title, &size, NULL);
#ifndef TOUCH_SCREEN
        if (!is_screen_wide()){
           rect.miny = roadmap_bar_top_height();
        }
        else{
           rect.miny = 0;
        }
#else
        rect.miny = 1;
#endif
        rect.maxy = rect.miny + size.height-1 ;
        title->draw(title, &rect, 0);
        rect.miny +=1;
        ssd_widget_draw(title->children, &rect, 0);
      }


#ifndef TOUCH_SCREEN
      roadmap_bar_draw_bottom_bar(TRUE);
      if ((dialog->container->flags & SSD_CONTAINER_TITLE) && (dialog->scroll_container != NULL) && (dialog->scroll_container->offset_y < 0))
        if (!is_screen_wide())
           roadmap_bar_draw_top_bar(TRUE);
#endif

      ssd_dialog_sort_tab_order( dialog);
      ssd_dialog_sort_tab_order_by_gui_position();
   }
}