[Motiftools-xmt-cvs] CVS: xmt/Xmt ExtWidgets.c,1.8,1.9 ExtWidgets.h,1.5,1.6
Brought to you by:
motiftools
From: Grant M. <grm...@us...> - 2003-08-14 02:38:13
|
Update of /cvsroot/motiftools/xmt/Xmt In directory sc8-pr-cvs1:/tmp/cvs-serv30287 Modified Files: ExtWidgets.c ExtWidgets.h Log Message: New XmtExtLabelSetPixmap function Index: ExtWidgets.c =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtWidgets.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** ExtWidgets.c 13 May 2003 02:15:34 -0000 1.8 --- ExtWidgets.c 14 Aug 2003 02:17:24 -0000 1.9 *************** *** 12,15 **** --- 12,18 ---- * * $Log$ + * Revision 1.9 2003/08/14 02:17:24 grmcdorman + * New XmtExtLabelSetPixmap function + * * Revision 1.8 2003/05/13 02:15:34 grmcdorman * New function: XmtExtLabelSetString, which efficiently (and with minimum flicker) sets the label string for the XmtExt* widgets. *************** *** 176,180 **** Pixmap background; Position bg_x, bg_y; - Widget pixmapOwner = (Widget) lw; int unusedmask = ~(GCFunction|GCPlaneMask|GCFillStyle| --- 179,182 ---- *************** *** 1187,1190 **** --- 1189,1246 ---- } lw->label._label = _XmStringCreate(string); + /* Resize if permitted. */ + if (lw->label.recompute_size) { + /* Compute wanted size */ + XmtIExtCalculateWantedSize(epart, (XmLabelWidget) lw, 0, 0); + if (epart->wanted_height != lw->core.height || + epart->wanted_width != lw->core.width) { + /* will call resize() if needed */ + XtResizeWidget(label, epart->wanted_width, epart->wanted_height, lw->core.border_width); + } + if (epart->buffer_pixmap != None && lw->core.window != None) { + XFreePixmap(lw->core.screen->display, epart->buffer_pixmap); + epart->buffer_pixmap = None; + } + } + + /* Relayout. */ + XmtIExtLayout(epart, (XmLabelWidget) lw); + + /* Redraw via a top-level expose callback. */ + (lw->core.widget_class->core_class.expose)((Widget) lw, NULL, NULL); + } + + /************************************************************/ + /* XmtExtLabelSetPixmap */ + /* This function quickly sets the pixmaps and mask on the */ + /* widget. This should prevent flicker, unless the */ + /* widget has to be resized. */ + /* It can also be called when the pixmaps have been */ + /* modified by the application drawing into them. */ + /************************************************************/ + #if NeedFunctionPrototypes + void XmtExtLabelSetPixmap(Widget label, Pixmap pixmap, Pixmap mask) + #else + void XmtExtLabelSetPixmap(label, pixmap, mask) + Widget label; + XmString string; + Pixmap pixmap; + Pixmap mask; + #endif + { + XmLabelWidget lw; + XmtExtPart *epart; + lw = (XmLabelWidget) label; + + epart = GetExtPart(label); + if (epart == NULL) { + XtAppWarning(XtWidgetToApplicationContext(label), + "Non-XmtExt widget passed to XmtExtLabelSetPixmap\n"); + return; + } + + lw->label.pixmap = pixmap; + epart->mask = mask; + /* Resize if permitted. */ if (lw->label.recompute_size) { Index: ExtWidgets.h =================================================================== RCS file: /cvsroot/motiftools/xmt/Xmt/ExtWidgets.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ExtWidgets.h 13 May 2003 02:15:35 -0000 1.5 --- ExtWidgets.h 14 Aug 2003 02:17:24 -0000 1.6 *************** *** 10,13 **** --- 10,16 ---- * * $Log$ + * Revision 1.6 2003/08/14 02:17:24 grmcdorman + * New XmtExtLabelSetPixmap function + * * Revision 1.5 2003/05/13 02:15:35 grmcdorman * New function: XmtExtLabelSetString, which efficiently (and with minimum flicker) sets the label string for the XmtExt* widgets. *************** *** 260,269 **** --- 263,280 ---- _XFUNCPROTOBEGIN + /* + * Common functions + * + * Use XmtExtLabelSetPixmap to cause a redraw if the pixmap's contents have changed, or + * if any mask's contents have changed. + */ #if NeedFunctionPrototypes extern void XmtGetBackgroundPixmap(Widget w, Pixmap *background, Position *x, Position *y); extern void XmtExtLabelSetString(Widget label, XmString string); + extern void XmtExtLabelSetPixmap(Widget label, Pixmap pixmap, Pixmap mask); #else extern void XmtExtLabelSetString(/*label, string*/); extern void XmtGetBackgroundPixmap(/*w, background, x, y*/); + extern void XmtExtLabelSetPixmap(/*label, pixmap, mask*/); #endif _XFUNCPROTOEND |