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.
This commit is contained in:
parent
e74b3947af
commit
abc474ef4b
4 changed files with 25 additions and 2 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
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):
|
||||
|
|
|
@ -248,8 +248,10 @@ draw_menu (list_impl_t self, int num_shown_items)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -178,6 +178,13 @@ set_content_size (grub_gfxmenu_box_t self,
|
|||
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)
|
||||
{
|
||||
|
@ -288,6 +295,8 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix,
|
|||
|
||||
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;
|
||||
|
|
|
@ -36,6 +36,7 @@ struct grub_gfxmenu_box
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue