Adds uiProgressBarValue() in unix

This commit is contained in:
emersion 2016-06-15 18:51:12 +02:00
parent 6270af8cf9
commit e07a7b3d05
2 changed files with 8 additions and 1 deletions

4
ui.h
View File

@ -187,8 +187,10 @@ _UI_EXTERN uiSlider *uiNewSlider(int min, int max);
typedef struct uiProgressBar uiProgressBar; typedef struct uiProgressBar uiProgressBar;
#define uiProgressBar(this) ((uiProgressBar *) (this)) #define uiProgressBar(this) ((uiProgressBar *) (this))
// TODO uiProgressBarValue() _UI_EXTERN int uiProgressBarValue(uiProgressBar *p);
_UI_EXTERN void uiProgressBarSetValue(uiProgressBar *p, int n); _UI_EXTERN void uiProgressBarSetValue(uiProgressBar *p, int n);
_UI_EXTERN int uiProgressBarIndeterminate(uiProgressBar *p);
_UI_EXTERN void uiProgressBarSetindeterminate(uiProgressBar *p, int indeterminate);
_UI_EXTERN uiProgressBar *uiNewProgressBar(void); _UI_EXTERN uiProgressBar *uiNewProgressBar(void);
typedef struct uiSeparator uiSeparator; typedef struct uiSeparator uiSeparator;

View File

@ -9,6 +9,11 @@ struct uiProgressBar {
uiUnixControlAllDefaults(uiProgressBar) uiUnixControlAllDefaults(uiProgressBar)
int uiProgressBarValue(uiProgressBar *p)
{
return (int) (gtk_progress_bar_get_fraction(p->pbar) * 100);
}
void uiProgressBarSetValue(uiProgressBar *p, int value) void uiProgressBarSetValue(uiProgressBar *p, int value)
{ {
if (value < 0 || value > 100) if (value < 0 || value > 100)