/* ** This routine is called when an image changes. If the size of the ** images changes, then we need to completely redo the layout. If ** only the appearance changes, then this works like an expose event. */ static void ImageChangeProc( ClientData clientData, /* Pointer to an HtmlImage structure */ int x, /* Left edge of region that changed */ int y, /* Top edge of region that changed */ int w, /* Width of region that changes. Maybe 0 */ int h, /* Height of region that changed. Maybe 0 */ int newWidth, /* New width of the image */ int newHeight /* New height of the image */ ){ HtmlImage *pImage; HtmlWidget *htmlPtr; HtmlElement *pElem; pImage = (HtmlImage*)clientData; htmlPtr = pImage->htmlPtr; if( pImage->w!=newWidth || pImage->h!=newHeight ){ /* We have to completely redo the layout after adjusting the size ** of the images */ for(pElem = pImage->pList; pElem; pElem = pElem->image.pNext){ pElem->image.w = newWidth; pElem->image.h = newHeight; TestPoint(0); } htmlPtr->flags |= RELAYOUT; pImage->w = newWidth; pImage->h = newHeight; HtmlRedrawEverything(htmlPtr); }else{ for(pElem = pImage->pList; pElem; pElem = pElem->image.pNext){ pElem->image.redrawNeeded = 1; } htmlPtr->flags |= REDRAW_IMAGES; HtmlScheduleRedraw(htmlPtr); } }
/* ** This routine is called when another entity takes over geometry ** management for a widget corresponding to an input element. */ static void HtmlInputLostSlaveProc(ClientData clientData, Tk_Window tkwin){ HtmlElement *pElem = (HtmlElement*)clientData; if( pElem->base.type!=Html_INPUT ){ CANT_HAPPEN; return; } if( pElem->input.tkwin!=tkwin ){ CANT_HAPPEN; return; } EmptyInput(pElem); if( pElem->input.htmlPtr && pElem->input.htmlPtr->tkwin!=0 ){ pElem->input.htmlPtr->flags |= RELAYOUT; HtmlScheduleRedraw(pElem->input.htmlPtr); } }
/* ** This routine catches DestroyNotify events on a INPUT window so ** that we will know the window is been deleted. */ static void HtmlInputEventProc(ClientData clientData, XEvent *eventPtr){ HtmlElement *pElem = (HtmlElement*)clientData; /* if( pElem->base.type!=Html_INPUT ){ CANT_HAPPEN; return; } */ if( eventPtr->type==DestroyNotify ){ EmptyInput(pElem); if( pElem->input.htmlPtr && pElem->input.htmlPtr->tkwin!=0 ){ pElem->input.htmlPtr->flags |= RELAYOUT; HtmlScheduleRedraw(pElem->input.htmlPtr); } } }
/* ** This routine is called when one of the child windows for a form ** wants to change its size. */ static void HtmlInputRequestProc(ClientData clientData, Tk_Window tkwin){ HtmlElement *pElem = (HtmlElement*)clientData; if( pElem->base.type!=Html_INPUT ){ CANT_HAPPEN; return; } if( pElem->input.tkwin!=tkwin ){ CANT_HAPPEN; return; } pElem->input.w = Tk_ReqWidth(tkwin); pElem->input.h = Tk_ReqHeight(tkwin); if( pElem->input.htmlPtr && pElem->input.htmlPtr->tkwin!=0 ){ pElem->input.htmlPtr->flags |= RELAYOUT; HtmlScheduleRedraw(pElem->input.htmlPtr); } }