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
|
|
|
};
|
|
|
|
|
2015-08-27 22:00:34 -05:00
|
|
|
uiUnixDefineControl(
|
2016-04-24 14:04:36 -05:00
|
|
|
uiProgressBar // type name
|
2015-08-27 22:00:34 -05:00
|
|
|
)
|
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)
|
|
|
|
complain("value %d out of range in progressbarSetValue()", value);
|
2015-07-01 10:21:06 -05:00
|
|
|
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
|
|
|
|
2016-04-24 15:59:46 -05:00
|
|
|
p = (uiProgressBar *) uiNewControl(uiProgressBar);
|
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
|
|
|
uiUnixFinishNewControl(p, uiProgressBar);
|
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
|
|
|
}
|