MCPcopy Create free account
hub / github.com/SimHacker/micropolis / ConfigureButton

Function ConfigureButton

micropolis-activity/src/tk/tkbutton.c:751–959  ·  view source on GitHub ↗
(interp, butPtr, argc, argv, flags)

Source from the content-addressed store, hash-verified

749 * etc. get set for butPtr; old resources get freed, if there
750 * were any. The button is redisplayed.
751 *
752 *----------------------------------------------------------------------
753 */
754
755static int
756ConfigureButton(interp, butPtr, argc, argv, flags)
757 Tcl_Interp *interp; /* Used for error reporting. */
758 register Button *butPtr; /* Information about widget; may or may
759 * not already have values for some fields. */
760 int argc; /* Number of valid entries in argv. */
761 char **argv; /* Arguments. */
762 int flags; /* Flags to pass to Tk_ConfigureWidget. */
763{
764 XGCValues gcValues;
765 GC newGC;
766 unsigned long mask;
767
768 /*
769 * Eliminate any existing trace on variables monitored by the button.
770 */
771
772 if (butPtr->textVarName != NULL) {
773 Tcl_UntraceVar(interp, butPtr->textVarName,
774 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
775 ButtonTextVarProc, (ClientData) butPtr);
776 }
777 if (butPtr->selVarName != NULL) {
778 Tcl_UntraceVar(interp, butPtr->selVarName,
779 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
780 ButtonVarProc, (ClientData) butPtr);
781 }
782
783 if (Tk_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
784 argc, argv, (char *) butPtr, flags) != TCL_OK) {
785 return TCL_ERROR;
786 }
787
788 /*
789 * A few options need special processing, such as setting the
790 * background from a 3-D border, or filling in complicated
791 * defaults that couldn't be specified to Tk_ConfigureWidget.
792 */
793
794 if (butPtr->state == tkActiveUid) {
795 Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->activeBorder);
796 } else {
797 Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->normalBorder);
798 if ((butPtr->state != tkNormalUid)
799 && (butPtr->state != tkDisabledUid)) {
800 Tcl_AppendResult(interp, "bad state value \"", butPtr->state,
801 "\": must be normal, active, or disabled", (char *) NULL);
802 butPtr->state = tkNormalUid;
803 return TCL_ERROR;
804 }
805 }
806
807 gcValues.font = butPtr->fontPtr->fid;
808 gcValues.foreground = butPtr->normalFg->pixel;

Callers 2

Tk_ButtonCmdFunction · 0.85
ButtonWidgetCmdFunction · 0.85

Calls 11

Tcl_UntraceVarFunction · 0.85
Tk_ConfigureWidgetFunction · 0.85
Tcl_AppendResultFunction · 0.85
Tk_GetGCFunction · 0.85
Tk_FreeGCFunction · 0.85
Tk_GetBitmapFunction · 0.85
Tk_GetUidFunction · 0.85
Tcl_TraceVarFunction · 0.85
ComputeButtonGeometryFunction · 0.85
Tk_CreateTimerHandlerFunction · 0.70

Tested by

no test coverage detected