]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/gfxmenu/gui_list.c: New options for scrollbar padding:
authorVladimir Testov <vladimir.testov@rosalab.ru>
Wed, 9 Oct 2013 12:55:16 +0000 (16:55 +0400)
committerVladimir Testov <vladimir.testov@rosalab.ru>
Wed, 9 Oct 2013 12:55:16 +0000 (16:55 +0400)
       scrollbar_left_pad, scrollbar_right_pad, scrollbar_top_pad,
       scrollbar_bottom_pad
       * docs/grub.texi: Likewise.

ChangeLog
docs/grub.texi
grub-core/gfxmenu/gui_list.c

index 2794bad2db0ea9384826e64cad053b3672ceb258..5bc393d17adce5be390ba366e49bb727548f4c18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-09  Vladimir Testov  <vladimir.testov@rosalab.ru>
+
+       * grub-core/gfxmenu/gui_list.c: New options for scrollbar padding:
+       scrollbar_left_pad, scrollbar_right_pad, scrollbar_top_pad,
+       scrollbar_bottom_pad
+       * docs/grub.texi: Likewise.
+
 2013-10-09  Vladimir Testov  <vladimir.testov@rosalab.ru>
 
        * grub-core/gfxmenu/gui_list.c (list_destroy): Fixed memory leak.
index d1ebbde88899f64f211fd04686405f9a37bc78f1..a97ede3292e197d15848b2bed234ee93e736ae38 100644 (file)
@@ -2092,6 +2092,16 @@ The following is a list of the components and the properties they support.
       b) If the scrollbar won't be drawn then the boot menu entry's width
       is the width of the center slice.
       c) We don't necessary need the menu pixmap box to display the scrollbar.
+   @item scrollbar_left_pad
+      @tab The left scrollbar padding in pixels.
+      Unused if ``scrollbar_slice`` is ``west``.
+   @item scrollbar_right_pad
+      @tab The right scrollbar padding in pixels.
+      Unused if ``scrollbar_slice`` is ``east``.
+   @item scrollbar_top_pad
+      @tab The top scrollbar padding in pixels.
+   @item scrollbar_bottom_pad
+      @tab The bottom scrollbar padding in pixels.
    @item max_items_shown
       @tab The maximum number of items to show on the menu.  If there are more than
       *max_items_shown* items in the menu, the list will scroll to make all
index 9fee16f9290b8f15514993f9d58e4fe553bf3ad2..10c670d49ca776c22f7bd6ca01adaeb39a9eecdd 100644 (file)
@@ -61,6 +61,10 @@ struct grub_gui_list_impl
   grub_gfxmenu_box_t scrollbar_thumb;
   int scrollbar_width;
   enum scrollbar_slice_mode scrollbar_slice;
+  int scrollbar_left_pad;
+  int scrollbar_right_pad;
+  int scrollbar_top_pad;
+  int scrollbar_bottom_pad;
 
   int first_shown_index;
 
@@ -384,15 +388,16 @@ list_paint (void *vself, const grub_video_rect_t *region)
     switch (self->scrollbar_slice)
       {
         case SCROLLBAR_SLICE_WEST:
-          content_rect.x += 2;
-          content_rect.width -= 2;
+          content_rect.x += self->scrollbar_right_pad;
+          content_rect.width -= self->scrollbar_right_pad;
           break;
         case SCROLLBAR_SLICE_CENTER:
           if (drawing_scrollbar)
-            content_rect.width -= scrollbar_width + 2;
+            content_rect.width -= scrollbar_width + self->scrollbar_left_pad
+                                  + self->scrollbar_right_pad;
           break;
         case SCROLLBAR_SLICE_EAST:
-          content_rect.width -= 2;
+          content_rect.width -= self->scrollbar_left_pad;
           break;
       }
 
@@ -402,6 +407,9 @@ list_paint (void *vself, const grub_video_rect_t *region)
 
     if (drawing_scrollbar)
       {
+        content_rect.y += self->scrollbar_top_pad;
+        content_rect.height -= self->scrollbar_top_pad
+                               + self->scrollbar_bottom_pad;
         content_rect.width = scrollbar_width;
         switch (self->scrollbar_slice)
           {
@@ -419,7 +427,7 @@ list_paint (void *vself, const grub_video_rect_t *region)
               break;
             case SCROLLBAR_SLICE_CENTER:
               content_rect.x = self->bounds.width - box_right_pad
-                               - scrollbar_width;
+                               - scrollbar_width - self->scrollbar_right_pad;
               content_rect.width = scrollbar_width;
               break;
             case SCROLLBAR_SLICE_EAST:
@@ -507,13 +515,14 @@ list_get_minimal_size (void *vself, unsigned *width, unsigned *height)
       switch (self->scrollbar_slice)
         {
           case SCROLLBAR_SLICE_WEST:
-            *width += 2;
+            *width += self->scrollbar_right_pad;
             break;
           case SCROLLBAR_SLICE_CENTER:
-            *width += self->scrollbar_width + 2;
+            *width += self->scrollbar_width + self->scrollbar_left_pad
+                      + self->scrollbar_right_pad;
             break;
           case SCROLLBAR_SLICE_EAST:
-            *width += 2;
+            *width += self->scrollbar_left_pad;
             break;
         }
 
@@ -653,6 +662,22 @@ list_set_property (void *vself, const char *name, const char *value)
       else if (grub_strcmp (value, "east") == 0)
         self->scrollbar_slice = SCROLLBAR_SLICE_EAST;
     }
+  else if (grub_strcmp (name, "scrollbar_left_pad") == 0)
+    {
+      self->scrollbar_left_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_right_pad") == 0)
+    {
+      self->scrollbar_right_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_top_pad") == 0)
+    {
+      self->scrollbar_top_pad = grub_strtol (value, 0, 10);
+    }
+  else if (grub_strcmp (name, "scrollbar_bottom_pad") == 0)
+    {
+      self->scrollbar_bottom_pad = grub_strtol (value, 0, 10);
+    }
   else if (grub_strcmp (name, "scrollbar") == 0)
     {
       self->draw_scrollbar = grub_strcmp (value, "false") != 0;
@@ -755,6 +780,10 @@ grub_gui_list_new (void)
   self->scrollbar_thumb_pattern = 0;
   self->scrollbar_width = 16;
   self->scrollbar_slice = SCROLLBAR_SLICE_EAST;
+  self->scrollbar_left_pad = 2;
+  self->scrollbar_right_pad = 0;
+  self->scrollbar_top_pad = 0;
+  self->scrollbar_bottom_pad = 0;
 
   self->first_shown_index = 0;