static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Frame *framePtr = recordPtr; int width, height; /* * Make sure -padding resource, if present, is correct: */ if (framePtr->frame.paddingObj) { Ttk_Padding unused; if (Ttk_GetPaddingFromObj(interp, framePtr->core.tkwin, framePtr->frame.paddingObj, &unused) != TCL_OK) { return TCL_ERROR; } } /* See <<NOTE-SIZE>> */ if ( TCL_OK != Tk_GetPixelsFromObj( interp,framePtr->core.tkwin,framePtr->frame.widthObj,&width) || TCL_OK != Tk_GetPixelsFromObj( interp,framePtr->core.tkwin,framePtr->frame.heightObj,&height) ) { return TCL_ERROR; } if ((width > 0 || height > 0) && (mask & GEOMETRY_CHANGED)) { Tk_GeometryRequest(framePtr->core.tkwin, width, height); } return TtkCoreConfigure(interp, recordPtr, mask); }
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; }
/* ScaleConfigure -- * Configuration hook. */ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Scale *scale = recordPtr; Tcl_Obj *varName = scale->scale.variableObj; Ttk_TraceHandle *vt = 0; if (varName != NULL && *Tcl_GetString(varName) != '\0') { vt = Ttk_TraceVariable(interp,varName, ScaleVariableChanged,recordPtr); if (!vt) return TCL_ERROR; } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { if (vt) Ttk_UntraceVariable(vt); return TCL_ERROR; } if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); } scale->scale.variableTrace = vt; return TCL_OK; }