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

3
ui.idl
View File

@ -111,6 +111,9 @@ interface Tab from Control {
// TODO remove Page from these? // TODO remove Page from these?
func AppendPage(name *const char, c *Control); func AppendPage(name *const char, c *Control);
func DeletePage(index uintmax_t); 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; func NewTab(void) *Tab;