Lines Matching refs:squarePtr

93 			    Square *squarePtr, int argc, char **argv,
97 static void KeepInWindow _ANSI_ARGS_((Square *squarePtr));
130 Square *squarePtr;
149 squarePtr = (Square *) ckalloc(sizeof(Square));
150 squarePtr->tkwin = tkwin;
151 squarePtr->display = Tk_Display(tkwin);
152 squarePtr->interp = interp;
153 squarePtr->widgetCmd = Tcl_CreateCommand(interp,
154 Tk_PathName(squarePtr->tkwin), SquareWidgetCmd,
155 (ClientData) squarePtr, SquareCmdDeletedProc);
156 squarePtr->x = 0;
157 squarePtr->y = 0;
158 squarePtr->size = 20;
159 squarePtr->borderWidth = 0;
160 squarePtr->bgBorder = NULL;
161 squarePtr->fgBorder = NULL;
162 squarePtr->relief = TK_RELIEF_FLAT;
163 squarePtr->gc = None;
164 squarePtr->doubleBuffer = 1;
165 squarePtr->updatePending = 0;
167 Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask,
168 SquareEventProc, (ClientData) squarePtr);
169 if (SquareConfigure(interp, squarePtr, argc-2, argv+2, 0) != TCL_OK) {
170 Tk_DestroyWindow(squarePtr->tkwin);
174 interp->result = Tk_PathName(squarePtr->tkwin);
204 Square *squarePtr = (Square *) clientData;
214 Tcl_Preserve((ClientData) squarePtr);
225 result = Tk_ConfigureValue(interp, squarePtr->tkwin, configSpecs,
226 (char *) squarePtr, argv[2], 0);
230 result = Tk_ConfigureInfo(interp, squarePtr->tkwin, configSpecs,
231 (char *) squarePtr, (char *) NULL, 0);
233 result = Tk_ConfigureInfo(interp, squarePtr->tkwin, configSpecs,
234 (char *) squarePtr, argv[2], 0);
236 result = SquareConfigure(interp, squarePtr, argc-2, argv+2,
246 if ((Tk_GetPixels(interp, squarePtr->tkwin, argv[2],
247 &squarePtr->x) != TCL_OK) || (Tk_GetPixels(interp,
248 squarePtr->tkwin, argv[3], &squarePtr->y) != TCL_OK)) {
251 KeepInWindow(squarePtr);
253 sprintf(interp->result, "%d %d", squarePtr->x, squarePtr->y);
263 if (Tk_GetPixels(interp, squarePtr->tkwin, argv[2], &i) != TCL_OK) {
271 squarePtr->size = i;
272 KeepInWindow(squarePtr);
274 sprintf(interp->result, "%d", squarePtr->size);
281 if (!squarePtr->updatePending) {
282 Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
283 squarePtr->updatePending = 1;
285 Tcl_Release((ClientData) squarePtr);
289 Tcl_Release((ClientData) squarePtr);
309 * etc. get set for squarePtr; old resources get freed,
316 SquareConfigure(interp, squarePtr, argc, argv, flags)
318 Square *squarePtr; /* Information about widget. */
324 if (Tk_ConfigureWidget(interp, squarePtr->tkwin, configSpecs,
325 argc, argv, (char *) squarePtr, flags) != TCL_OK) {
334 Tk_SetWindowBackground(squarePtr->tkwin,
335 Tk_3DBorderColor(squarePtr->bgBorder)->pixel);
336 if ((squarePtr->gc == None) && (squarePtr->doubleBuffer)) {
340 squarePtr->gc = Tk_GetGC(squarePtr->tkwin,
349 Tk_GeometryRequest(squarePtr->tkwin, 200, 150);
350 Tk_SetInternalBorder(squarePtr->tkwin, squarePtr->borderWidth);
351 if (!squarePtr->updatePending) {
352 Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
353 squarePtr->updatePending = 1;
382 Square *squarePtr = (Square *) clientData;
385 if (!squarePtr->updatePending) {
386 Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
387 squarePtr->updatePending = 1;
390 KeepInWindow(squarePtr);
391 if (!squarePtr->updatePending) {
392 Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
393 squarePtr->updatePending = 1;
396 if (squarePtr->tkwin != NULL) {
397 squarePtr->tkwin = NULL;
398 Tcl_DeleteCommand(squarePtr->interp,
399 Tcl_GetCommandName(squarePtr->interp,
400 squarePtr->widgetCmd));
402 if (squarePtr->updatePending) {
403 Tcl_CancelIdleCall(SquareDisplay, (ClientData) squarePtr);
405 Tcl_EventuallyFree((ClientData) squarePtr, SquareDestroy);
432 Square *squarePtr = (Square *) clientData;
433 Tk_Window tkwin = squarePtr->tkwin;
443 squarePtr->tkwin = NULL;
471 Square *squarePtr = (Square *) clientData;
472 Tk_Window tkwin = squarePtr->tkwin;
476 squarePtr->updatePending = 0;
485 if (squarePtr->doubleBuffer) {
498 Tk_Fill3DRectangle(tkwin, d, squarePtr->bgBorder, 0, 0, Tk_Width(tkwin),
499 Tk_Height(tkwin), squarePtr->borderWidth, squarePtr->relief);
505 Tk_Fill3DRectangle(tkwin, d, squarePtr->fgBorder, squarePtr->x,
506 squarePtr->y, squarePtr->size, squarePtr->size,
507 squarePtr->borderWidth, TK_RELIEF_RAISED);
513 if (squarePtr->doubleBuffer) {
514 XCopyArea(Tk_Display(tkwin), pm, Tk_WindowId(tkwin), squarePtr->gc,
544 Square *squarePtr = (Square *) memPtr;
546 Tk_FreeOptions(configSpecs, (char *) squarePtr, squarePtr->display, 0);
547 if (squarePtr->gc != None) {
548 Tk_FreeGC(squarePtr->display, squarePtr->gc);
550 ckfree((char *) squarePtr);
573 KeepInWindow(squarePtr)
574 register Square *squarePtr; /* Pointer to widget record. */
578 if (squarePtr->relief != TK_RELIEF_FLAT) {
579 bd = squarePtr->borderWidth;
581 i = (Tk_Width(squarePtr->tkwin) - bd) - (squarePtr->x + squarePtr->size);
583 squarePtr->x += i;
585 i = (Tk_Height(squarePtr->tkwin) - bd) - (squarePtr->y + squarePtr->size);
587 squarePtr->y += i;
589 if (squarePtr->x < bd) {
590 squarePtr->x = bd;
592 if (squarePtr->y < bd) {
593 squarePtr->y = bd;