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/win/iupwin_canvas.c | 54 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'iup/src/win/iupwin_canvas.c') diff --git a/iup/src/win/iupwin_canvas.c b/iup/src/win/iupwin_canvas.c index bb88b8a..b865160 100755 --- a/iup/src/win/iupwin_canvas.c +++ b/iup/src/win/iupwin_canvas.c @@ -45,7 +45,7 @@ static void winCanvasSetScrollInfo(HWND hWnd, int imin, int imax, int ipos, int static int winCanvasSetBgColorAttrib(Ihandle *ih, const char *value) { (void)value; - iupdrvDisplayUpdate(ih); + iupdrvPostRedraw(ih); return 1; } @@ -220,7 +220,7 @@ static void winCanvasUpdateHorScroll(Ihandle* ih, WORD winop) xmax = iupAttribGetFloat(ih,"XMAX"); xmin = iupAttribGetFloat(ih,"XMIN"); - winCanvasGetScrollInfo(ih->handle, &iposx, &ipagex, SB_HORZ, winop==SB_THUMBTRACK? 1: 0); + winCanvasGetScrollInfo(ih->handle, &iposx, &ipagex, SB_HORZ, winop==SB_THUMBTRACK||winop==SB_THUMBPOSITION? 1: 0); if (!iupAttribGet(ih,"LINEX")) { @@ -296,7 +296,7 @@ static void winCanvasUpdateVerScroll(Ihandle* ih, WORD winop) ymax = iupAttribGetFloat(ih,"YMAX"); ymin = iupAttribGetFloat(ih,"YMIN"); - winCanvasGetScrollInfo(ih->handle, &iposy, &ipagey, SB_VERT, winop==SB_THUMBTRACK? 1: 0); + winCanvasGetScrollInfo(ih->handle, &iposy, &ipagey, SB_VERT, winop==SB_THUMBTRACK||winop==SB_THUMBPOSITION? 1: 0); if (!iupAttribGet(ih, "LINEY")) { @@ -372,6 +372,10 @@ static int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r GetClientRect(ih->handle, &rect); FillRect(hdc, &rect, iupwinBrushGet(color)); } + else + InvalidateRect(ih->handle,NULL,FALSE); /* This will invalidate all area. + Necessary in XP, or overlapping windows will have the effect of partial redrawing. */ + /* always return non zero value */ *result = 1; return 1; @@ -382,7 +386,7 @@ static int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r { PAINTSTRUCT ps; HDC hdc = BeginPaint(ih->handle, &ps); - iupAttribSetStr(ih, "HDC_WMPAINT", (char*)&hdc); + iupAttribSetStr(ih, "HDC_WMPAINT", (char*)hdc); iupAttribSetStrf(ih, "CLIPRECT", "%d %d %d %d", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top); cb(ih, ih->data->posx, ih->data->posy); @@ -542,27 +546,13 @@ static int winCanvasProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *r return iupwinBaseProc(ih, msg, wp, lp, result); } -static void winCanvasRegisterClass(void) -{ - WNDCLASS wndclass; - ZeroMemory(&wndclass, sizeof(WNDCLASS)); - - wndclass.hInstance = iupwin_hinstance; - wndclass.lpszClassName = "IupCanvas"; - wndclass.lpfnWndProc = (WNDPROC)iupwinBaseWinProc; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; /* using CS_OWNDC will minimize the work of cdActivate in the CD library */ - wndclass.hbrBackground = NULL; /* remove the background to optimize redraw */ - - RegisterClass(&wndclass); -} - static int winCanvasMapMethod(Ihandle* ih) { CLIENTCREATESTRUCT clientstruct; void *clientdata = NULL; char *classname; - DWORD dwStyle = WS_CHILD, dwExStyle = 0; + DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS, + dwExStyle = 0; if (!ih->parent) return IUP_ERROR; @@ -574,14 +564,7 @@ static int winCanvasMapMethod(Ihandle* ih) } if (ih->firstchild) /* can be a container */ - { - dwStyle |= WS_CLIPSIBLINGS; - - if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED")) - dwExStyle |= WS_EX_COMPOSITED; - else - dwStyle |= WS_CLIPCHILDREN; - } + iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (iupAttribGetBoolean(ih, "MDICLIENT")) { @@ -693,6 +676,21 @@ static void winCanvasReleaseMethod(Iclass* ic) UnregisterClass("IupCanvas", iupwin_hinstance); } +static void winCanvasRegisterClass(void) +{ + WNDCLASS wndclass; + ZeroMemory(&wndclass, sizeof(WNDCLASS)); + + wndclass.hInstance = iupwin_hinstance; + wndclass.lpszClassName = "IupCanvas"; + wndclass.lpfnWndProc = (WNDPROC)iupwinBaseWinProc; + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; /* using CS_OWNDC will minimize the work of cdActivate in the CD library */ + wndclass.hbrBackground = NULL; /* remove the background to optimize redraw */ + + RegisterClass(&wndclass); +} + void iupdrvCanvasInitClass(Iclass* ic) { if (!iupwinClassExist("IupCanvas")) -- cgit v1.2.3