~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to gfxmenu/gui_list.c

Tags: upstream-1.98+20100705
ImportĀ upstreamĀ versionĀ 1.98+20100705

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
 
211
211
/* Draw the list of items.  */
212
212
static void
213
 
draw_menu (list_impl_t self, int width, int num_shown_items)
 
213
draw_menu (list_impl_t self, int num_shown_items)
214
214
{
215
215
  if (! self->menu_box || ! self->selected_item_box)
216
216
    return;
227
227
 
228
228
  grub_gfxmenu_box_t selbox = self->selected_item_box;
229
229
  int sel_leftpad = selbox->get_left_pad (selbox);
230
 
  int item_top = boxpad;
231
 
  int item_left = boxpad + sel_leftpad;
 
230
  int sel_toppad = selbox->get_top_pad (selbox);
 
231
  int item_top = sel_toppad;
232
232
  int menu_index;
233
233
  int visible_index;
 
234
  struct grub_video_rect oviewport;
 
235
 
 
236
  grub_video_get_viewport (&oviewport.x, &oviewport.y,
 
237
                           &oviewport.width, &oviewport.height);
 
238
  grub_video_set_viewport (oviewport.x + boxpad, 
 
239
                           oviewport.y + boxpad,
 
240
                           oviewport.width - 2 * boxpad,
 
241
                           oviewport.height - 2 * boxpad);
234
242
 
235
243
  for (visible_index = 0, menu_index = self->first_shown_index;
236
244
       visible_index < num_shown_items && menu_index < self->view->menu->size;
240
248
 
241
249
      if (is_selected)
242
250
        {
243
 
          int sel_toppad = selbox->get_top_pad (selbox);
244
 
          selbox->set_content_size (selbox, (width - 2 * boxpad), item_height);
245
 
          selbox->draw (selbox, item_left - sel_leftpad,
 
251
          selbox->set_content_size (selbox, oviewport.width - 2 * boxpad - 2,
 
252
                                    item_height - 1);
 
253
          selbox->draw (selbox, 0,
246
254
                        item_top - sel_toppad);
247
255
        }
248
256
 
249
257
      struct grub_video_bitmap *icon;
250
258
      if ((icon = get_item_icon (self, menu_index)) != 0)
251
259
        grub_video_blit_bitmap (icon, GRUB_VIDEO_BLIT_BLEND,
252
 
                                item_left,
 
260
                                sel_leftpad,
253
261
                                item_top + (item_height - self->icon_height) / 2,
254
262
                                0, 0, self->icon_width, self->icon_height);
255
263
 
266
274
      grub_font_draw_string (item_title,
267
275
                             font,
268
276
                             grub_gui_map_color (text_color),
269
 
                             item_left + self->icon_width + icon_text_space,
 
277
                             sel_leftpad + self->icon_width + icon_text_space,
270
278
                             (item_top + (item_height - (ascent + descent))
271
279
                              / 2 + ascent));
272
280
 
273
281
      item_top += item_height + item_vspace;
274
282
    }
 
283
  grub_video_set_viewport (oviewport.x,
 
284
                           oviewport.y,
 
285
                           oviewport.width,
 
286
                           oviewport.height);
275
287
}
276
288
 
277
289
static void
313
325
    box->draw (box, 0, 0);
314
326
 
315
327
    grub_gui_set_viewport (&content_rect, &vpsave2);
316
 
    draw_menu (self, content_rect.width, num_shown_items);
 
328
    draw_menu (self, num_shown_items);
317
329
    grub_gui_restore_viewport (&vpsave2);
318
330
 
319
331
    if (drawing_scrollbar)
322
334
                      0, self->view->menu->size,
323
335
                      self->bounds.width - box_right_pad
324
336
                      + self->scrollbar_width,
325
 
                      box_top_pad + self->item_padding,
 
337
                      box_top_pad,
326
338
                      self->bounds.height - box_top_pad - box_bottom_pad);
327
339
  }
328
340
 
375
387
      int box_right_pad = box->get_right_pad (box);
376
388
      int box_bottom_pad = box->get_bottom_pad (box);
377
389
      unsigned width_s;
 
390
 
 
391
      grub_gfxmenu_box_t selbox = self->selected_item_box;
 
392
      int sel_toppad = selbox->get_top_pad (selbox);
378
393
      
379
394
      *width = grub_font_get_string_width (self->item_font, "Typical OS");
380
395
      width_s = grub_font_get_string_width (self->selected_item_font,
388
403
      *height = (item_height * num_items
389
404
                 + item_vspace * (num_items - 1)
390
405
                 + 2 * boxpad
391
 
                 + box_top_pad + box_bottom_pad);
 
406
                 + box_top_pad + box_bottom_pad + sel_toppad);
392
407
    }
393
408
  else
394
409
    {