Started work on adding margined status to uiTab. Modified the IDL and the test program.

This commit is contained in:
Pietro Gagliardi 2015-04-30 15:24:27 -04:00
parent 437b895b53
commit a76afebf54
2 changed files with 16 additions and 7 deletions

View File

@ -36,6 +36,7 @@ void setSpaced(int spaced)
{
uintmax_t i;
void *p;
uintmax_t j, n;
for (i = 0; i < len; i++) {
p = things[i].ptr;
@ -47,7 +48,9 @@ void setSpaced(int spaced)
uiBoxSetPadded(uiBox(p), spaced);
break;
case tab:
// TODO
n = uiTabNumPages(uiTab(p));
for (j = 0; j < n; j++)
uiTabSetMargined(uiTab(p), j, spaced);
break;
}
}
@ -59,26 +62,29 @@ void querySpaced(char out[12]) // more than enough
int p = 0;
uintmax_t i;
void *pp;
uintmax_t j, n;
for (i = 0; i < len; i++) {
pp = things[i].ptr;
switch (things[i].type) {
case window:
m = uiWindowMargined(uiWindow(pp));
if (uiWindowMargined(uiWindow(pp)))
m++;
break;
case box:
p = uiBoxPadded(uiBox(pp));
break;
case tab:
n = uiTabNumPages(uiTab(pp));
for (j = 0; j < n; j++)
if (uiTabMargined(uiTab(pp), j))
m++;
}
if (m && p) // cheap attempt at breaking early
break;
}
out[0] = 'm';
out[1] = ' ';
out[2] = '0';
if (m)
out[2] = '1';
out[2] = '0' + m;
out[3] = ' ';
out[4] = 'p';
out[5] = ' ';

3
ui.idl
View File

@ -111,6 +111,9 @@ interface Tab from Control {
// TODO remove Page from these?
func AppendPage(name *const char, c *Control);
func DeletePage(index uintmax_t);
func NumPages(void) uintmax_t;
func Margined(page uintmax_t) int;
func SetMargined(page uintmax_t, margined int);
};
func NewTab(void) *Tab;