libui/unix/progressbar.c

30 lines
585 B
C
Raw Normal View History

2015-06-11 18:07:06 -05:00
// 11 june 2015
#include "uipriv_unix.h"
2015-08-27 22:00:34 -05:00
struct uiProgressBar {
uiUnixControl c;
2015-06-11 18:07:06 -05:00
GtkWidget *widget;
2015-06-27 18:46:11 -05:00
GtkProgressBar *pbar;
2015-06-11 18:07:06 -05:00
};
uiUnixControlAllDefaults(uiProgressBar)
2015-06-11 18:07:06 -05:00
2015-08-27 22:00:34 -05:00
void uiProgressBarSetValue(uiProgressBar *p, int value)
2015-06-11 18:07:06 -05:00
{
if (value < 0 || value > 100)
2016-05-13 20:00:12 -05:00
userbug("Value %d is out of range for a uiProgressBar.", value);
gtk_progress_bar_set_fraction(p->pbar, ((gdouble) value) / 100);
2015-06-11 18:07:06 -05:00
}
uiProgressBar *uiNewProgressBar(void)
{
2015-08-27 22:00:34 -05:00
uiProgressBar *p;
2015-06-11 18:07:06 -05:00
uiUnixNewControl(uiProgressBar, p);
2015-06-11 18:07:06 -05:00
2015-06-27 18:46:11 -05:00
p->widget = gtk_progress_bar_new();
p->pbar = GTK_PROGRESS_BAR(p->widget);
2015-06-11 18:07:06 -05:00
2015-08-27 22:00:34 -05:00
return p;
2015-06-11 18:07:06 -05:00
}