From d6aeb3c0a76b3823844de640df3519950fcba935 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 7 May 2015 16:33:33 -0400 Subject: [PATCH] Added a test for controls that aren't initially visible. More TODOs. --- TODO.md | 4 ++-- box.c | 2 ++ test/page2.c | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 1ee8a990..7026274a 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,3 @@ -- 32-bit Mac OS X support (requires lots of code changes) -- add a test for hidden controls when a window is shown - SWP_NOCOPYBITS (or was it WS_CLIPCHILDREN?) - buttons not in tab get drawover issues - buttons in tab without transparent drawing code get copied into the label when stack shown and rehidden @@ -57,6 +55,8 @@ - we control resizes of all children so we can reliably update after a resize - we already need to do this in uiContainer :/ - make it so Windows API calls that do logLastError(), etc. abort whatever they're doing and not try to continue, just like wintable +- 32-bit Mac OS X support (requires lots of code changes) + - change the build system to be more receptive to arch changes ultimately: - add some sort of runtime type checking diff --git a/box.c b/box.c index 8918b2d7..5ab1e6c9 100644 --- a/box.c +++ b/box.c @@ -74,6 +74,7 @@ static void boxPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_ } // 1) initialize the desired rect with the needed padding + // TODO this is wrong if any controls are hidden if (b->vertical) *height = (b->len - 1) * ypadding; else @@ -145,6 +146,7 @@ static void boxResizeChildren(uiContainer *c, intmax_t x, intmax_t y, intmax_t w } // 0) inset the available rect by the needed padding + // TODO this is incorrect if any controls are hidden if (b->vertical) height -= (b->len - 1) * ypadding; else diff --git a/test/page2.c b/test/page2.c index 8385a8d9..fbbf015e 100644 --- a/test/page2.c +++ b/test/page2.c @@ -47,6 +47,7 @@ static void openAnotherWindow(uiButton *b, void *data) { \ uiControl ## Method(uiControl(data)); \ } +SHED(show, Show) SHED(enable, Enable) SHED(disable, Disable) @@ -71,6 +72,7 @@ uiBox *makePage2(void) uiTab *disabledTab; uiEntry *entry; uiEntry *readonly; + uiButton *button2; page2 = newVerticalBox(); @@ -162,5 +164,14 @@ uiBox *makePage2(void) uiBoxAppend(page2, uiControl(entry), 0); uiBoxAppend(page2, uiControl(readonly), 0); + hbox = newHorizontalBox(); + button = uiNewButton("Show Button 2"); + button2 = uiNewButton("Button 2"); + uiButtonOnClicked(button, showControl, button2); + uiControlHide(uiControl(button2)); + uiBoxAppend(hbox, uiControl(button), 1); + uiBoxAppend(hbox, uiControl(button2), 0); + uiBoxAppend(page2, uiControl(hbox), 0); + return page2; }