2016-06-15 12:21:07 -05:00
|
|
|
// 15 june 2016
|
|
|
|
#include "test.h"
|
|
|
|
|
2016-06-15 21:28:44 -05:00
|
|
|
static uiSpinbox *width, *height;
|
2016-06-16 07:07:50 -05:00
|
|
|
static uiCheckbox *fullscreen;
|
2016-06-15 13:57:52 -05:00
|
|
|
|
2016-06-15 21:28:44 -05:00
|
|
|
static void sizeWidth(uiSpinbox *s, void *data)
|
|
|
|
{
|
|
|
|
uiWindow *w = uiWindow(data);
|
|
|
|
int xp, yp;
|
|
|
|
|
2016-06-15 21:52:35 -05:00
|
|
|
uiWindowContentSize(w, &xp, &yp);
|
2016-06-15 21:28:44 -05:00
|
|
|
xp = uiSpinboxValue(width);
|
|
|
|
uiWindowSetContentSize(w, xp, yp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sizeHeight(uiSpinbox *s, void *data)
|
|
|
|
{
|
|
|
|
uiWindow *w = uiWindow(data);
|
|
|
|
int xp, yp;
|
|
|
|
|
|
|
|
uiWindowContentSize(w, &xp, &yp);
|
|
|
|
yp = uiSpinboxValue(height);
|
|
|
|
uiWindowSetContentSize(w, xp, yp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void updatesize(uiWindow *w)
|
|
|
|
{
|
|
|
|
int xp, yp;
|
|
|
|
|
|
|
|
uiWindowContentSize(w, &xp, &yp);
|
|
|
|
uiSpinboxSetValue(width, xp);
|
|
|
|
uiSpinboxSetValue(height, yp);
|
2016-06-16 08:29:28 -05:00
|
|
|
// TODO on OS X this is updated AFTER sending the size change, not before
|
2016-06-16 07:07:50 -05:00
|
|
|
uiCheckboxSetChecked(fullscreen, uiWindowFullscreen(w));
|
2016-06-15 21:28:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void onSize(uiWindow *w, void *data)
|
|
|
|
{
|
2016-10-24 16:47:23 -05:00
|
|
|
printf("size\n");
|
2016-06-15 21:28:44 -05:00
|
|
|
updatesize(w);
|
2016-06-15 13:57:52 -05:00
|
|
|
}
|
2016-06-15 12:21:07 -05:00
|
|
|
|
2016-06-16 07:07:50 -05:00
|
|
|
void setFullscreen(uiCheckbox *cb, void *data)
|
|
|
|
{
|
|
|
|
uiWindow *w = uiWindow(data);
|
|
|
|
|
2016-06-16 08:29:28 -05:00
|
|
|
uiWindowSetFullscreen(w, uiCheckboxChecked(fullscreen));
|
2016-06-16 07:07:50 -05:00
|
|
|
updatesize(w);
|
|
|
|
}
|
|
|
|
|
2016-06-16 10:20:28 -05:00
|
|
|
static void borderless(uiCheckbox *c, void *data)
|
|
|
|
{
|
|
|
|
uiWindow *w = uiWindow(data);
|
|
|
|
|
|
|
|
uiWindowSetBorderless(w, uiCheckboxChecked(c));
|
|
|
|
}
|
|
|
|
|
2016-06-15 12:21:07 -05:00
|
|
|
uiBox *makePage15(uiWindow *w)
|
|
|
|
{
|
|
|
|
uiBox *page15;
|
|
|
|
uiBox *hbox;
|
2016-06-15 13:57:52 -05:00
|
|
|
uiButton *button;
|
2016-06-16 10:20:28 -05:00
|
|
|
uiCheckbox *checkbox;
|
2016-06-15 12:21:07 -05:00
|
|
|
|
|
|
|
page15 = newVerticalBox();
|
|
|
|
|
2016-06-15 21:28:44 -05:00
|
|
|
hbox = newHorizontalBox();
|
|
|
|
uiBoxAppend(page15, uiControl(hbox), 0);
|
|
|
|
|
|
|
|
uiBoxAppend(hbox, uiControl(uiNewLabel("Size")), 0);
|
|
|
|
width = uiNewSpinbox(INT_MIN, INT_MAX);
|
|
|
|
uiBoxAppend(hbox, uiControl(width), 1);
|
|
|
|
height = uiNewSpinbox(INT_MIN, INT_MAX);
|
|
|
|
uiBoxAppend(hbox, uiControl(height), 1);
|
2016-06-16 07:07:50 -05:00
|
|
|
fullscreen = uiNewCheckbox("Fullscreen");
|
|
|
|
uiBoxAppend(hbox, uiControl(fullscreen), 0);
|
2016-06-15 21:28:44 -05:00
|
|
|
|
|
|
|
uiSpinboxOnChanged(width, sizeWidth, w);
|
|
|
|
uiSpinboxOnChanged(height, sizeHeight, w);
|
2016-06-16 07:07:50 -05:00
|
|
|
uiCheckboxOnToggled(fullscreen, setFullscreen, w);
|
2016-06-15 21:28:44 -05:00
|
|
|
uiWindowOnContentSizeChanged(w, onSize, NULL);
|
|
|
|
updatesize(w);
|
2016-06-15 12:21:07 -05:00
|
|
|
|
2016-06-16 10:20:28 -05:00
|
|
|
checkbox = uiNewCheckbox("Borderless");
|
|
|
|
uiCheckboxOnToggled(checkbox, borderless, w);
|
|
|
|
uiBoxAppend(page15, uiControl(checkbox), 0);
|
|
|
|
|
2016-06-17 10:02:17 -05:00
|
|
|
hbox = newHorizontalBox();
|
|
|
|
uiBoxAppend(page15, uiControl(hbox), 1);
|
|
|
|
|
|
|
|
uiBoxAppend(hbox, uiControl(uiNewVerticalSeparator()), 0);
|
|
|
|
|
2016-06-15 12:21:07 -05:00
|
|
|
return page15;
|
|
|
|
}
|