summaryrefslogtreecommitdiff
path: root/iup/src/iup_dialog.c
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-06-15 00:59:57 -0700
committerPixel <pixel@nobis-crew.org>2010-06-15 00:59:57 -0700
commiteed0eb6a476d54ce19aeff137984aa981d9e3976 (patch)
tree807891636efd2f87dcbd261e971216269973ae07 /iup/src/iup_dialog.c
parentccc8261e4d48de89da4ddfe7b55e378ae0cd6f47 (diff)
Upgrading to iup 3.1
Diffstat (limited to 'iup/src/iup_dialog.c')
-rwxr-xr-xiup/src/iup_dialog.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/iup/src/iup_dialog.c b/iup/src/iup_dialog.c
index d70e12c..1aaf095 100755
--- a/iup/src/iup_dialog.c
+++ b/iup/src/iup_dialog.c
@@ -220,11 +220,19 @@ static void iDialogDestroyMethod(Ihandle* ih)
iupDlgListRemove(ih);
}
+static int iDialogSetMenuAttrib(Ihandle* ih, const char* value);
+
static void iDialogComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *expand)
{
int decorwidth, decorheight;
Ihandle* child = ih->firstchild;
+ /* if does not have a menu, but the attribute is defined,
+ try to update the menu before retrieving the decoration. */
+ char* value = iupAttribGet(ih, "MENU");
+ if (!ih->data->menu && value)
+ iDialogSetMenuAttrib(ih, value);
+
iupDialogGetDecorSize(ih, &decorwidth, &decorheight);
*w = decorwidth;
*h = decorheight;
@@ -278,20 +286,22 @@ static void iDialogAfterShow(Ihandle* ih)
{
Ihandle* old_focus;
IFni show_cb;
+ int show_state;
/* process all pending messages */
IupFlush();
old_focus = IupGetFocus();
+ show_state = ih->data->show_state;
show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
- if (show_cb && show_cb(ih, ih->data->show_state) == IUP_CLOSE)
+ if (show_cb && show_cb(ih, show_state) == IUP_CLOSE)
{
IupExitLoop();
return;
}
- if (ih->data->show_state == IUP_SHOW)
+ if (show_state == IUP_SHOW)
{
if (show_cb)
IupFlush(); /* again to update focus */
@@ -718,7 +728,8 @@ Iclass* iupDialogGetClass(void)
iupBaseRegisterVisualAttrib(ic);
/* Overwrite Visual */
- iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iDialogSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NO_INHERIT); /* the only case where VISIBLE default is NO */
+ /* the only case where VISIBLE default is NO, and must not be propagated to the dialog children */
+ iupClassRegisterAttribute(ic, "VISIBLE", iupBaseGetVisibleAttrib, iDialogSetVisibleAttrib, IUPAF_SAMEASSYSTEM, "NO", IUPAF_NO_INHERIT);
/* IupDialog only */
iupClassRegisterAttribute(ic, "MENU", NULL, iDialogSetMenuAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);