From eed0eb6a476d54ce19aeff137984aa981d9e3976 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 15 Jun 2010 00:59:57 -0700 Subject: Upgrading to iup 3.1 --- iup/src/mot/iupmot_frame.c | 58 ++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 22 deletions(-) (limited to 'iup/src/mot/iupmot_frame.c') diff --git a/iup/src/mot/iupmot_frame.c b/iup/src/mot/iupmot_frame.c index 39de5d8..cfda44f 100755 --- a/iup/src/mot/iupmot_frame.c +++ b/iup/src/mot/iupmot_frame.c @@ -42,22 +42,33 @@ static int motFrameSetBgColorAttrib(Ihandle* ih, const char* value) { Pixel color; - /* ignore given value, must use only from parent */ - value = iupBaseNativeParentGetBgColor(ih); + if (!iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR")) + { + /* ignore given value, must use only from parent */ + value = iupBaseNativeParentGetBgColor(ih); + } color = iupmotColorGetPixelStr(value); if (color != (Pixel)-1) { Widget title_label, child_manager; - iupmotSetBgColor(ih->handle, color); + if (!iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR")) + { + iupmotSetBgColor(ih->handle, color); - child_manager = XtNameToWidget(ih->handle, "*child_manager"); - iupmotSetBgColor(child_manager, color); + child_manager = XtNameToWidget(ih->handle, "*child_manager"); + iupmotSetBgColor(child_manager, color); - title_label = XtNameToWidget(ih->handle, "*title_label"); - if (!title_label) return 1; - iupmotSetBgColor(title_label, color); + title_label = XtNameToWidget(ih->handle, "*title_label"); + if (!title_label) return 1; + iupmotSetBgColor(title_label, color); + } + else + { + child_manager = XtNameToWidget(ih->handle, "*child_manager"); + iupmotSetBgColor(child_manager, color); + } return 1; } @@ -171,22 +182,25 @@ static int motFrameMapMethod(Ihandle* ih) { char* value = iupAttribGetStr(ih, "SUNKEN"); if (iupStrBoolean(value)) - iupmotSetArg(args, num_args, XmNshadowType, XmSHADOW_IN); + iupMOT_SETARG(args, num_args, XmNshadowType, XmSHADOW_IN); else - iupmotSetArg(args, num_args, XmNshadowType, XmSHADOW_ETCHED_IN); + iupMOT_SETARG(args, num_args, XmNshadowType, XmSHADOW_ETCHED_IN); + + if (iupAttribGet(ih, "BGCOLOR")) + iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1"); } /* Core */ - iupmotSetArg(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ - iupmotSetArg(args, num_args, XmNx, 0); /* x-position */ - iupmotSetArg(args, num_args, XmNy, 0); /* y-position */ - iupmotSetArg(args, num_args, XmNwidth, 10); /* default width to avoid 0 */ - iupmotSetArg(args, num_args, XmNheight, 10); /* default height to avoid 0 */ + iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False); /* not visible when managed */ + iupMOT_SETARG(args, num_args, XmNx, 0); /* x-position */ + iupMOT_SETARG(args, num_args, XmNy, 0); /* y-position */ + iupMOT_SETARG(args, num_args, XmNwidth, 10); /* default width to avoid 0 */ + iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */ /* Manager */ - iupmotSetArg(args, num_args, XmNshadowThickness, 2); + iupMOT_SETARG(args, num_args, XmNshadowThickness, 2); /* Frame */ - iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* no shadow margins */ - iupmotSetArg(args, num_args, XmNmarginWidth, 0); /* no shadow margins */ + iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* no shadow margins */ + iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); /* no shadow margins */ ih->handle = XtCreateManagedWidget( iupDialogGetChildIdStr(ih), /* child identifier */ @@ -204,11 +218,11 @@ static int motFrameMapMethod(Ihandle* ih) Widget title_label; num_args = 0; /* Label */ - iupmotSetArg(args, num_args, XmNlabelType, XmSTRING); - iupmotSetArg(args, num_args, XmNmarginHeight, 0); /* default padding */ - iupmotSetArg(args, num_args, XmNmarginWidth, 0); + iupMOT_SETARG(args, num_args, XmNlabelType, XmSTRING); + iupMOT_SETARG(args, num_args, XmNmarginHeight, 0); /* default padding */ + iupMOT_SETARG(args, num_args, XmNmarginWidth, 0); /* Frame Constraint */ - iupmotSetArg(args, num_args, XmNchildType, XmFRAME_TITLE_CHILD); + iupMOT_SETARG(args, num_args, XmNchildType, XmFRAME_TITLE_CHILD); title_label = XtCreateManagedWidget("title_label", xmLabelWidgetClass, ih->handle, args, num_args); iupmotSetString(title_label, XmNlabelString, title); } -- cgit v1.2.3