static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Base *basePtr = recordPtr; Tcl_Obj *textVarName = basePtr->base.textVariableObj; Ttk_TraceHandle *vt = 0; Ttk_ImageSpec *imageSpec = NULL; if (textVarName != NULL && *Tcl_GetString(textVarName) != '\0') { vt = Ttk_TraceVariable(interp,textVarName,TextVariableChanged,basePtr); if (!vt) return TCL_ERROR; } if (basePtr->base.imageObj) { imageSpec = TtkGetImageSpec( interp, basePtr->core.tkwin, basePtr->base.imageObj); if (!imageSpec) { goto error; } } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { error: if (imageSpec) TtkFreeImageSpec(imageSpec); if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } if (basePtr->base.textVariableTrace) { Ttk_UntraceVariable(basePtr->base.textVariableTrace); } basePtr->base.textVariableTrace = vt; if (basePtr->base.imageSpec) { TtkFreeImageSpec(basePtr->base.imageSpec); } basePtr->base.imageSpec = imageSpec; if (mask & STATE_CHANGED) { TtkCheckStateOption(&basePtr->core, basePtr->base.stateObj); } return TCL_OK; }
static int ImageSetup( ImageElement *image, Tk_Window tkwin, Ttk_State state) { if (!image->imageObj) { return 0; } image->imageSpec = TtkGetImageSpec(NULL, tkwin, image->imageObj); if (!image->imageSpec) { return 0; } image->tkimg = TtkSelectImage(image->imageSpec, state); if (!image->tkimg) { TtkFreeImageSpec(image->imageSpec); return 0; } Tk_SizeOfImage(image->tkimg, &image->width, &image->height); return 1; }