From be46128d75ff8f2739b856dcc4ec41bebb90a666 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 9 Sep 2010 10:47:04 -0700 Subject: Adding the SetRedraw() directive - only for Windows. --- iup/include/iup.h | 1 + iup/src/gtk/iupgtk_common.c | 6 ++++++ iup/src/iup_drv.h | 4 ++++ iup/src/iup_layout.c | 10 ++++++++++ iup/src/mot/iupmot_common.c | 6 ++++++ iup/src/win/iupwin_common.c | 5 +++++ iup/srclua3/iuplua_api.c | 6 ++++++ iup/srclua5/iuplua_api.c | 7 +++++++ 8 files changed, 45 insertions(+) (limited to 'iup') diff --git a/iup/include/iup.h b/iup/include/iup.h index 572d88c..e94dbd9 100755 --- a/iup/include/iup.h +++ b/iup/include/iup.h @@ -46,6 +46,7 @@ void IupExitLoop (void); void IupUpdate (Ihandle* ih); void IupUpdateChildren(Ihandle* ih); void IupRedraw (Ihandle* ih, int children); +void IupSetRedraw (Ihandle* ih, int value); void IupRefresh (Ihandle* ih); char* IupMapFont (const char *iupfont); diff --git a/iup/src/gtk/iupgtk_common.c b/iup/src/gtk/iupgtk_common.c index d84c1c8..a27087e 100755 --- a/iup/src/gtk/iupgtk_common.c +++ b/iup/src/gtk/iupgtk_common.c @@ -107,6 +107,12 @@ void iupdrvRedrawNow(Ihandle *ih) gdk_window_process_updates(window, FALSE); } +void iupdrvSetRedraw(Ihandle *ih, int value) +{ + (void)ih; + (void)value; +} + void iupdrvScreenToClient(Ihandle* ih, int *x, int *y) { gint win_x = 0, win_y = 0; diff --git a/iup/src/iup_drv.h b/iup/src/iup_drv.h index 1071347..ec8a253 100755 --- a/iup/src/iup_drv.h +++ b/iup/src/iup_drv.h @@ -66,6 +66,10 @@ void iupdrvPostRedraw(Ihandle *ih); * \ingroup drv */ void iupdrvRedrawNow(Ihandle *ih); +/** Sets if a control is drawable or not. + * \ingroup drv */ +void iupdrvSetRedraw(Ihandle *ih, int value); + /** Reparent the native control. * \ingroup drv */ void iupdrvReparent(Ihandle* ih); diff --git a/iup/src/iup_layout.c b/iup/src/iup_layout.c index 9387135..fc9dcf6 100755 --- a/iup/src/iup_layout.c +++ b/iup/src/iup_layout.c @@ -91,6 +91,16 @@ void IupRedraw(Ihandle* ih, int children) iLayoutDisplayRedrawChildren(ih); } +void IupSetRedraw(Ihandle* ih, int value) +{ + iupASSERT(iupObjectCheck(ih)); + if (!iupObjectCheck(ih)) + return; + + if (ih->handle && ih->iclass->nativetype != IUP_TYPEVOID) + iupdrvSetRedraw(ih, value); +} + void iupLayoutUpdate(Ihandle* ih) { Ihandle* child; diff --git a/iup/src/mot/iupmot_common.c b/iup/src/mot/iupmot_common.c index 286e075..554504f 100755 --- a/iup/src/mot/iupmot_common.c +++ b/iup/src/mot/iupmot_common.c @@ -235,6 +235,12 @@ void iupdrvRedrawNow(Ihandle *ih) XmUpdateDisplay(ih->handle); } +void iupdrvSetRedraw(Ihandle *ih, int value) +{ + (void)ih; + (void)value; +} + void iupdrvScreenToClient(Ihandle* ih, int *x, int *y) { Window child; diff --git a/iup/src/win/iupwin_common.c b/iup/src/win/iupwin_common.c index 0f53e68..afa4235 100755 --- a/iup/src/win/iupwin_common.c +++ b/iup/src/win/iupwin_common.c @@ -100,6 +100,11 @@ void iupdrvRedrawNow(Ihandle *ih) RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_UPDATENOW); } +void iupdrvRedrawNow(Ihandle *ih, int value) +{ + SendMessage(ih->handle, WM_SETREDRAW, value ? TRUE : FALSE, 0); +} + void iupdrvPostRedraw(Ihandle *ih) { /* Post a REDRAW */ diff --git a/iup/srclua3/iuplua_api.c b/iup/srclua3/iuplua_api.c index a9acf1d..f9c6b30 100755 --- a/iup/srclua3/iuplua_api.c +++ b/iup/srclua3/iuplua_api.c @@ -269,6 +269,11 @@ static void Redraw(void) IupRedraw(iuplua_checkihandle(1), luaL_check_int(2)); } +static void SetRedraw(void) +{ + IupSetRedraw(iuplua_checkihandle(1), luaL_check_int(2)); +} + static void VersionNumber(void) { lua_pushnumber(IupVersionNumber()); @@ -682,6 +687,7 @@ int iupluaapi_open(void) { "IupUpdate", Update }, { "IupUpdateChildren", UpdateChildren }, { "IupRedraw", Redraw }, + { "IupSetRedraw", SetRedraw }, { "IupVersionNumber", VersionNumber }, { "IupShowXY", ShowXY }, { "IupHide", Hide }, diff --git a/iup/srclua5/iuplua_api.c b/iup/srclua5/iuplua_api.c index 27adffe..3fc73a1 100755 --- a/iup/srclua5/iuplua_api.c +++ b/iup/srclua5/iuplua_api.c @@ -725,6 +725,12 @@ static int Redraw(lua_State *L) return 0; } +static int SetRedraw(lua_State *L) +{ + IupSetRedraw(iuplua_checkihandle(L,1), luaL_checkinteger(L, 2)); + return 0; +} + static int ShowXY(lua_State *L) { Ihandle *ih = iuplua_checkihandle(L,1); @@ -864,6 +870,7 @@ void iupluaapi_open(lua_State * L) {"UpdateChildren", UpdateChildren}, {"SaveImageAsText", SaveImageAsText}, {"Redraw", Redraw}, + {"SetRedraw", SetRedraw}, {"ShowXY", ShowXY}, {"StoreAttribute", StoreAttribute}, {"StoreGlobal", StoreGlobal}, -- cgit v1.2.3