ply-progress-bar: Allow caller to specify the widgets width and height

Before this commit ply_progress_bar_show would take coordinates for where
to show the progress-bar but the width and height were hardcodec. This
commit adds width and height parametes, so that the caller can specify
the width and height too.

This commit does not change behavior for existing users (tested with the
spinfinity theme).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2019-02-08 14:38:44 +01:00
parent 78bb39da5c
commit e33c1f3a06
3 changed files with 12 additions and 9 deletions

View file

@ -51,10 +51,6 @@
#include "ply-image.h"
#include "ply-utils.h"
#ifndef BAR_HEIGHT
#define BAR_HEIGHT 16
#endif
struct _ply_progress_bar
{
ply_pixel_display_t *display;
@ -134,15 +130,17 @@ void
ply_progress_bar_show (ply_progress_bar_t *progress_bar,
ply_pixel_display_t *display,
long x,
long y)
long y,
unsigned long width,
unsigned long height)
{
assert (progress_bar != NULL);
progress_bar->display = display;
progress_bar->area.x = x;
progress_bar->area.y = y;
progress_bar->area.height = BAR_HEIGHT;
progress_bar->area.width = ply_pixel_display_get_width (display);
progress_bar->area.height = height;
progress_bar->area.width = width;
progress_bar->is_hidden = false;
ply_progress_bar_draw (progress_bar);

View file

@ -40,7 +40,9 @@ void ply_progress_bar_free (ply_progress_bar_t *bar);
void ply_progress_bar_show (ply_progress_bar_t *bar,
ply_pixel_display_t *display,
long x,
long y);
long y,
unsigned long width,
unsigned long height);
void ply_progress_bar_hide (ply_progress_bar_t *bar);
void ply_progress_bar_draw (ply_progress_bar_t *bar);
void ply_progress_bar_draw_area (ply_progress_bar_t *bar,

View file

@ -316,7 +316,10 @@ view_start_animation (view_t *view)
view->logo_area.y + view->logo_area.height + height / 2);
ply_progress_bar_show (view->progress_bar,
view->display,
0, screen_height - ply_progress_bar_get_height (view->progress_bar));
0,
screen_height - BAR_HEIGHT,
screen_width,
BAR_HEIGHT);
view_redraw (view);
}