libui/unix/progressbar.c

35 lines
711 B
C

// 11 june 2015
#include "uipriv_unix.h"
struct uiProgressBar {
uiUnixControl c;
GtkWidget *widget;
GtkProgressBar *pbar;
};
uiUnixDefineControl(
uiProgressBar, // type name
uiProgressBarType // type function
)
void uiProgressBarSetValue(uiProgressBar *p, int value)
{
if (value < 0 || value > 100)
complain("value %d out of range in progressbarSetValue()", value);
gtk_progress_bar_set_fraction(p->pbar, ((gdouble) value) / 100);
}
uiProgressBar *uiNewProgressBar(void)
{
uiProgressBar *p;
p = (uiProgressBar *) uiNewControl(uiProgressBarType());
p->widget = gtk_progress_bar_new();
p->pbar = GTK_PROGRESS_BAR(p->widget);
uiUnixFinishNewControl(p, uiProgressBar);
return p;
}