diff options
author | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
commit | eed0eb6a476d54ce19aeff137984aa981d9e3976 (patch) | |
tree | 807891636efd2f87dcbd261e971216269973ae07 /iup/src/win/iupwin_frame.c | |
parent | ccc8261e4d48de89da4ddfe7b55e378ae0cd6f47 (diff) |
Upgrading to iup 3.1
Diffstat (limited to 'iup/src/win/iupwin_frame.c')
-rwxr-xr-x | iup/src/win/iupwin_frame.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/iup/src/win/iupwin_frame.c b/iup/src/win/iupwin_frame.c index 0949b5d..3f56aed 100755 --- a/iup/src/win/iupwin_frame.c +++ b/iup/src/win/iupwin_frame.c @@ -47,6 +47,27 @@ void iupdrvFrameGetDecorOffset(Ihandle* ih, int *x, int *y) } } +static char* winFrameGetBgColorAttrib(Ihandle* ih) +{ + if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR")) + return NULL; + else + return iupBaseNativeParentGetBgColorAttrib(ih); +} + +static int winFrameSetBgColorAttrib(Ihandle* ih, const char* value) +{ + (void)value; + + if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR")) + { + IupUpdate(ih); /* post a redraw */ + return 1; + } + else + return 0; +} + static void winFrameDrawText(HDC hDC, const char* text, int x, int y, COLORREF fgcolor) { COLORREF oldcolor; @@ -126,6 +147,16 @@ static void winFrameDrawItem(Ihandle* ih, DRAWITEMSTRUCT *drawitem) DrawEdge(hDC, &drawitem->rcItem, EDGE_SUNKEN, BF_RECT); else DrawEdge(hDC, &drawitem->rcItem, EDGE_ETCHED, BF_RECT); + + if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR")) + { + unsigned char r=0, g=0, b=0; + char* color = iupAttribGetStr(ih, "BGCOLOR"); + iupStrToRGB(color, &r, &g, &b); + SetDCBrushColor(hDC, RGB(r,g,b)); + InflateRect(&drawitem->rcItem, -2, -2); + FillRect(hDC, &drawitem->rcItem, (HBRUSH)GetStockObject(DC_BRUSH)); + } } iupwinDrawDestroyBitmapDC(&bmpDC); @@ -169,11 +200,13 @@ static int winFrameMapMethod(Ihandle* ih) title = iupAttribGet(ih, "TITLE"); if (title) iupAttribSetStr(ih, "_IUPFRAME_HAS_TITLE", "1"); - - if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED")) - dwExStyle |= WS_EX_COMPOSITED; else - dwStyle |= WS_CLIPCHILDREN; + { + if (iupAttribGet(ih, "BGCOLOR")) + iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1"); + } + + iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (!iupwinCreateWindowEx(ih, "BUTTON", dwExStyle, dwStyle)) return IUP_ERROR; @@ -195,7 +228,7 @@ void iupdrvFrameInitClass(Iclass* ic) /* Driver Dependent Attribute functions */ /* Visual */ - iupClassRegisterAttribute(ic, "BGCOLOR", iupBaseNativeParentGetBgColorAttrib, NULL, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT); + iupClassRegisterAttribute(ic, "BGCOLOR", winFrameGetBgColorAttrib, winFrameSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT); /* Special */ iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "DLGFGCOLOR", IUPAF_NOT_MAPPED); |