* grub-core/gfxmenu/gui_list.c: New option scrollbar_thumb_overlay
.
* docs/grub.texi: Likewise.
This commit is contained in:
parent
3530bc9d90
commit
145e2369a7
3 changed files with 32 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-10-10 Vladimir Testov <vladimir.testov@rosalab.ru>
|
||||
|
||||
* grub-core/gfxmenu/gui_list.c: New option `scrollbar_thumb_overlay`.
|
||||
* docs/grub.texi: Likewise.
|
||||
|
||||
2013-10-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/getroot.c (make_device_name): Remove dos_part and bsd_part as
|
||||
|
|
|
@ -2151,6 +2151,14 @@ The following is a list of the components and the properties they support.
|
|||
@tab The image file pattern for the scroll bar thumb (the part of the scroll
|
||||
bar that moves as scrolling occurs).
|
||||
Example: ``scrollbar_thumb_*.png``
|
||||
@item scrollbar_thumb_overlay
|
||||
@tab If this option is set to ``true`` then the scrollbar thumb
|
||||
side slices (every slice except the center slice) will overlay the
|
||||
scrollbar frame side slices. And the center slice of the scrollbar_thumb
|
||||
can move all the way (from top to bottom), being drawn on the center
|
||||
slice of the scrollbar frame. That way we can make a scrollbar with
|
||||
round-shaped edges so there won't be a free space from the thumb to
|
||||
the frame in top and bottom scrollbar positions. Default is ``false``.
|
||||
@item scrollbar_slice
|
||||
@tab The menu frame styled box's slice in which the scrollbar will be
|
||||
drawn. Possible values are ``west``, ``center``, ``east`` (default).
|
||||
|
|
|
@ -59,6 +59,7 @@ struct grub_gui_list_impl
|
|||
char *scrollbar_thumb_pattern;
|
||||
grub_gfxmenu_box_t scrollbar_frame;
|
||||
grub_gfxmenu_box_t scrollbar_thumb;
|
||||
int scrollbar_thumb_overlay;
|
||||
int scrollbar_width;
|
||||
enum scrollbar_slice_mode scrollbar_slice;
|
||||
int scrollbar_left_pad;
|
||||
|
@ -222,6 +223,11 @@ draw_scrollbar (list_impl_t self,
|
|||
frame->set_content_size (frame,
|
||||
scrollbar_width - frame_horizontal_pad,
|
||||
tracklen);
|
||||
if (self->scrollbar_thumb_overlay)
|
||||
{
|
||||
tracklen += thumb_vertical_pad;
|
||||
tracktop -= thumb->get_top_pad (thumb);
|
||||
}
|
||||
int thumby = tracktop + tracklen * (value - min) / (max - min);
|
||||
int thumbheight = tracklen * extent / (max - min) + 1;
|
||||
/* Rare occasion: too many entries or too low height. */
|
||||
|
@ -231,12 +237,16 @@ draw_scrollbar (list_impl_t self,
|
|||
thumby = tracktop + ((tracklen - thumb_vertical_pad) * (value - min)
|
||||
/ (max - extent));
|
||||
}
|
||||
thumb->set_content_size (thumb,
|
||||
scrollbar_width - frame_horizontal_pad
|
||||
- thumb_horizontal_pad,
|
||||
int thumbx = frame->get_left_pad (frame);
|
||||
int thumbwidth = scrollbar_width - frame_horizontal_pad;
|
||||
if (!self->scrollbar_thumb_overlay)
|
||||
thumbwidth -= thumb_horizontal_pad;
|
||||
else
|
||||
thumbx -= thumb->get_left_pad (thumb);
|
||||
thumb->set_content_size (thumb, thumbwidth,
|
||||
thumbheight - thumb_vertical_pad);
|
||||
frame->draw (frame, 0, 0);
|
||||
thumb->draw (thumb, frame->get_left_pad (frame), thumby);
|
||||
thumb->draw (thumb, thumbx, thumby);
|
||||
}
|
||||
|
||||
/* Draw the list of items. */
|
||||
|
@ -649,6 +659,10 @@ list_set_property (void *vself, const char *name, const char *value)
|
|||
grub_free (self->scrollbar_thumb_pattern);
|
||||
self->scrollbar_thumb_pattern = value ? grub_strdup (value) : 0;
|
||||
}
|
||||
else if (grub_strcmp (name, "scrollbar_thumb_overlay") == 0)
|
||||
{
|
||||
self->scrollbar_thumb_overlay = grub_strcmp (value, "true") == 0;
|
||||
}
|
||||
else if (grub_strcmp (name, "scrollbar_width") == 0)
|
||||
{
|
||||
self->scrollbar_width = grub_strtol (value, 0, 10);
|
||||
|
@ -778,6 +792,7 @@ grub_gui_list_new (void)
|
|||
self->scrollbar_thumb = 0;
|
||||
self->scrollbar_frame_pattern = 0;
|
||||
self->scrollbar_thumb_pattern = 0;
|
||||
self->scrollbar_thumb_overlay = 0;
|
||||
self->scrollbar_width = 16;
|
||||
self->scrollbar_slice = SCROLLBAR_SLICE_EAST;
|
||||
self->scrollbar_left_pad = 2;
|
||||
|
|
Loading…
Reference in a new issue