Re-added uiControlContainerShow() and uiControlContainerHide(). This is needed on Windows for uiTab.

This commit is contained in:
Pietro Gagliardi 2015-05-15 18:34:17 -04:00
parent 883db84eaf
commit 7ea67007fc
4 changed files with 51 additions and 17 deletions

View File

@ -38,3 +38,4 @@ notes to self
- note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide - note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide
- note that type mixing == undefined behavior - note that type mixing == undefined behavior
- note that handling of multiple consecutive separators in menus, leading separators in menus, and trailing separators in menus are all implementation-defined - note that handling of multiple consecutive separators in menus, leading separators in menus, and trailing separators in menus are all implementation-defined
- note that ContainerVisible() returns true if both user and container not hidden; container use only

View File

@ -50,9 +50,11 @@ interface Control {
func QueueResize(void); func QueueResize(void);
func GetSizing(d *Sizing); func GetSizing(d *Sizing);
func ComputeChildSize(x *intmax_t, y *intmax_t, width *intmax_t, height *intmax_t, d *Sizing); func ComputeChildSize(x *intmax_t, y *intmax_t, width *intmax_t, height *intmax_t, d *Sizing);
func Visible(void) int; func ContainerVisible(void) int;
func Show(void); func Show(void);
func Hide(void); func Hide(void);
func ContainerShow(void);
func ContainerHide(void);
func Enable(void); func Enable(void);
func Disable(void); func Disable(void);
func ContainerEnable(void); func ContainerEnable(void);

View File

@ -8,7 +8,8 @@ struct singleHWND {
void (*onDestroy)(void *); void (*onDestroy)(void *);
void *onDestroyData; void *onDestroyData;
uiContainer *parent; uiContainer *parent;
int hidden; int userHidden;
int containerHidden;
int userDisabled; int userDisabled;
int containerDisabled; int containerDisabled;
}; };
@ -76,19 +77,20 @@ static void singleComputeChildSize(uiControl *c, intmax_t *x, intmax_t *y, intma
complain("attempt to call uiControlComputeChildSize() on a non-container"); complain("attempt to call uiControlComputeChildSize() on a non-container");
} }
static int singleVisible(uiControl *c) static int singleContainerVisible(uiControl *c)
{ {
struct singleHWND *s = (struct singleHWND *) (c->Internal); struct singleHWND *s = (struct singleHWND *) (c->Internal);
return !s->hidden; return !s->userHidden && !s->containerHidden;
} }
static void singleShow(uiControl *c) static void singleShow(uiControl *c)
{ {
struct singleHWND *s = (struct singleHWND *) (c->Internal); struct singleHWND *s = (struct singleHWND *) (c->Internal);
ShowWindow(s->hwnd, SW_SHOW); s->userHidden = 0;
s->hidden = 0; if (!s->containerHidden)
ShowWindow(s->hwnd, SW_SHOW);
if (s->parent != NULL) if (s->parent != NULL)
uiContainerUpdate(s->parent); uiContainerUpdate(s->parent);
} }
@ -97,8 +99,29 @@ static void singleHide(uiControl *c)
{ {
struct singleHWND *s = (struct singleHWND *) (c->Internal); struct singleHWND *s = (struct singleHWND *) (c->Internal);
s->userHidden = 1;
ShowWindow(s->hwnd, SW_HIDE);
if (s->parent != NULL)
uiContainerUpdate(s->parent);
}
static void singleContainerShow(uiControl *c)
{
struct singleHWND *s = (struct singleHWND *) (c->Internal);
s->containerHidden = 0;
if (!s->userHidden)
ShowWindow(s->hwnd, SW_SHOW);
if (s->parent != NULL)
uiContainerUpdate(s->parent);
}
static void singleContainerHide(uiControl *c)
{
struct singleHWND *s = (struct singleHWND *) (c->Internal);
s->containerHidden = 1;
ShowWindow(s->hwnd, SW_HIDE); ShowWindow(s->hwnd, SW_HIDE);
s->hidden = 1;
if (s->parent != NULL) if (s->parent != NULL)
uiContainerUpdate(s->parent); uiContainerUpdate(s->parent);
} }
@ -219,9 +242,11 @@ void uiWindowsMakeControl(uiControl *c, uiWindowsMakeControlParams *p)
uiControl(c)->QueueResize = singleQueueResize; uiControl(c)->QueueResize = singleQueueResize;
uiControl(c)->GetSizing = singleGetSizing; uiControl(c)->GetSizing = singleGetSizing;
uiControl(c)->ComputeChildSize = singleComputeChildSize; uiControl(c)->ComputeChildSize = singleComputeChildSize;
uiControl(c)->Visible = singleVisible; uiControl(c)->ContainerVisible = singleContainerVisible;
uiControl(c)->Show = singleShow; uiControl(c)->Show = singleShow;
uiControl(c)->Hide = singleHide; uiControl(c)->Hide = singleHide;
uiControl(c)->ContainerShow = singleContainerShow;
uiControl(c)->ContainerHide = singleContainerHide;
uiControl(c)->Enable = singleEnable; uiControl(c)->Enable = singleEnable;
uiControl(c)->Disable = singleDisable; uiControl(c)->Disable = singleDisable;
uiControl(c)->ContainerEnable = singleContainerEnable; uiControl(c)->ContainerEnable = singleContainerEnable;

View File

@ -8,7 +8,6 @@ struct window {
HWND hwnd; HWND hwnd;
HMENU menubar; HMENU menubar;
uiControl *child; uiControl *child;
int hidden;
BOOL shownOnce; BOOL shownOnce;
int (*onClosing)(uiWindow *, void *); int (*onClosing)(uiWindow *, void *);
void *onClosingData; void *onClosingData;
@ -156,11 +155,9 @@ static void windowComputeChildSize(uiControl *c, intmax_t *x, intmax_t *y, intma
} }
} }
static int windowVisible(uiControl *c) static int windowContainerVisible(uiControl *c)
{ {
struct window *w = (struct window *) c; complain("attempt to get container visibility state of uiWindow %p", c);
return !w->hidden;
} }
static void windowShow(uiControl *c) static void windowShow(uiControl *c)
@ -169,7 +166,6 @@ static void windowShow(uiControl *c)
if (w->shownOnce) { if (w->shownOnce) {
ShowWindow(w->hwnd, SW_SHOW); ShowWindow(w->hwnd, SW_SHOW);
w->hidden = 0;
return; return;
} }
w->shownOnce = TRUE; w->shownOnce = TRUE;
@ -178,7 +174,6 @@ static void windowShow(uiControl *c)
ShowWindow(w->hwnd, nCmdShow); ShowWindow(w->hwnd, nCmdShow);
if (UpdateWindow(w->hwnd) == 0) if (UpdateWindow(w->hwnd) == 0)
logLastError("error calling UpdateWindow() after showing uiWindow for the first time in windowShow()"); logLastError("error calling UpdateWindow() after showing uiWindow for the first time in windowShow()");
w->hidden = 0;
} }
static void windowHide(uiControl *c) static void windowHide(uiControl *c)
@ -186,7 +181,16 @@ static void windowHide(uiControl *c)
struct window *w = (struct window *) c; struct window *w = (struct window *) c;
ShowWindow(w->hwnd, SW_HIDE); ShowWindow(w->hwnd, SW_HIDE);
w->hidden = 1; }
static void windowContainerShow(uiControl *c)
{
complain("attempt to container show uiWindow %p", c);
}
static void windowContainerHide(uiControl *c)
{
complain("attempt to container hide uiWindow %p", c);
} }
static void windowEnable(uiControl *c) static void windowEnable(uiControl *c)
@ -357,9 +361,11 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
uiControl(w)->QueueResize = windowQueueResize uiControl(w)->QueueResize = windowQueueResize
uiControl(w)->GetSizing = windowGetSizing; uiControl(w)->GetSizing = windowGetSizing;
uiControl(w)->ComputeChildSize = windowComputeChildSize; uiControl(w)->ComputeChildSize = windowComputeChildSize;
uiControl(w)->Visible = windowVisible; uiControl(w)->ContainerVisible = windowContainerVisible;
uiControl(w)->Show = windowShow; uiControl(w)->Show = windowShow;
uiControl(w)->Hide = windowHide; uiControl(w)->Hide = windowHide;
uiControl(w)->ContainerShow = windowContainerShow;
uiControl(w)->ContainerHide = windowContainerHide;
uiControl(w)->Enable = windowEnable; uiControl(w)->Enable = windowEnable;
uiControl(w)->Disable = windowDisable; uiControl(w)->Disable = windowDisable;
uiControl(w)->ContainerEnable = windowContainerEnable; uiControl(w)->ContainerEnable = windowContainerEnable;