* grub-core/gfxmenu/widget-box.c (get_border_width): New function.
(grub_gfxmenu_create_box): Register get_border_width.
* grub-core/gfxmenu/gui_list.c (draw_menu): Use get_border_width
if available.
* include/grub/gfxwidgets.h (grub_gfxmenu_box): New member
get_border_width.
+2011-04-19 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Take into account the decorations the computing menu entry width.
+
+ * grub-core/gfxmenu/widget-box.c (get_border_width): New function.
+ (grub_gfxmenu_create_box): Register get_border_width.
+ * grub-core/gfxmenu/gui_list.c (draw_menu): Use get_border_width
+ if available.
+ * include/grub/gfxwidgets.h (grub_gfxmenu_box): New member
+ get_border_width.
+
2011-04-18 Endres Puschner <code@e7p.de>
* grub-core/gfxmenu/icon_manager.c (grub_gfxmenu_icon_manager_get_icon):
if (is_selected)
{
- selbox->set_content_size (selbox, oviewport.width - 2 * boxpad - 2,
- item_height - 1);
+ int cwidth = oviewport.width - 2 * boxpad - 2;
+ if (selbox->get_border_width)
+ cwidth -= selbox->get_border_width (selbox);
+ selbox->set_content_size (selbox, cwidth, item_height - 1);
selbox->draw (selbox, 0,
item_top - sel_toppad);
}
return;
}
+static int
+get_border_width (grub_gfxmenu_box_t self)
+{
+ return (get_width (self->raw_pixmaps[BOX_PIXMAP_E])
+ + get_width (self->raw_pixmaps[BOX_PIXMAP_W]));
+}
+
static int
get_left_pad (grub_gfxmenu_box_t self)
{
box->draw = draw;
box->set_content_size = set_content_size;
+ box->get_border_width = get_border_width;
+
box->get_left_pad = get_left_pad;
box->get_top_pad = get_top_pad;
box->get_right_pad = get_right_pad;
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
void (*set_content_size) (grub_gfxmenu_box_t self,
int width, int height);
+ int (*get_border_width) (grub_gfxmenu_box_t self);
int (*get_left_pad) (grub_gfxmenu_box_t self);
int (*get_top_pad) (grub_gfxmenu_box_t self);
int (*get_right_pad) (grub_gfxmenu_box_t self);