Lines Matching refs:msgPtr

177 static void		ComputeMessageGeometry _ANSI_ARGS_((Message *msgPtr));
179 Message *msgPtr, int argc, char **argv,
211 register Message *msgPtr;
226 msgPtr = (Message *) ckalloc(sizeof(Message));
227 msgPtr->tkwin = new;
228 msgPtr->display = Tk_Display(new);
229 msgPtr->interp = interp;
230 msgPtr->widgetCmd = Tcl_CreateCommand(interp, Tk_PathName(msgPtr->tkwin),
231 MessageWidgetCmd, (ClientData) msgPtr, MessageCmdDeletedProc);
232 msgPtr->string = NULL;
233 msgPtr->numChars = 0;
234 msgPtr->textVarName = NULL;
235 msgPtr->border = NULL;
236 msgPtr->borderWidth = 0;
237 msgPtr->relief = TK_RELIEF_FLAT;
238 msgPtr->highlightWidth = 0;
239 msgPtr->highlightBgColorPtr = NULL;
240 msgPtr->highlightColorPtr = NULL;
241 msgPtr->inset = 0;
242 msgPtr->fontPtr = NULL;
243 msgPtr->fgColorPtr = NULL;
244 msgPtr->textGC = None;
245 msgPtr->padX = 0;
246 msgPtr->padY = 0;
247 msgPtr->anchor = TK_ANCHOR_CENTER;
248 msgPtr->width = 0;
249 msgPtr->aspect = 150;
250 msgPtr->lineLength = 0;
251 msgPtr->msgHeight = 0;
252 msgPtr->justify = TK_JUSTIFY_LEFT;
253 msgPtr->cursor = None;
254 msgPtr->takeFocus = NULL;
255 msgPtr->flags = 0;
257 Tk_SetClass(msgPtr->tkwin, "Message");
258 Tk_CreateEventHandler(msgPtr->tkwin,
260 MessageEventProc, (ClientData) msgPtr);
261 if (ConfigureMessage(interp, msgPtr, argc-2, argv+2, 0) != TCL_OK) {
265 interp->result = Tk_PathName(msgPtr->tkwin);
269 Tk_DestroyWindow(msgPtr->tkwin);
299 register Message *msgPtr = (Message *) clientData;
318 return Tk_ConfigureValue(interp, msgPtr->tkwin, configSpecs,
319 (char *) msgPtr, argv[2], 0);
323 return Tk_ConfigureInfo(interp, msgPtr->tkwin, configSpecs,
324 (char *) msgPtr, (char *) NULL, 0);
326 return Tk_ConfigureInfo(interp, msgPtr->tkwin, configSpecs,
327 (char *) msgPtr, argv[2], 0);
329 return ConfigureMessage(interp, msgPtr, argc-2, argv+2,
362 register Message *msgPtr = (Message *) memPtr;
370 if (msgPtr->textVarName != NULL) {
371 Tcl_UntraceVar(msgPtr->interp, msgPtr->textVarName,
373 MessageTextVarProc, (ClientData) msgPtr);
375 if (msgPtr->textGC != None) {
376 Tk_FreeGC(msgPtr->display, msgPtr->textGC);
378 Tk_FreeOptions(configSpecs, (char *) msgPtr, msgPtr->display, 0);
379 ckfree((char *) msgPtr);
398 * etc. get set for msgPtr; old resources get freed, if there
405 ConfigureMessage(interp, msgPtr, argc, argv, flags)
407 register Message *msgPtr; /* Information about widget; may or may
420 if (msgPtr->textVarName != NULL) {
421 Tcl_UntraceVar(interp, msgPtr->textVarName,
423 MessageTextVarProc, (ClientData) msgPtr);
426 if (Tk_ConfigureWidget(interp, msgPtr->tkwin, configSpecs,
427 argc, argv, (char *) msgPtr, flags) != TCL_OK) {
437 if (msgPtr->textVarName != NULL) {
440 value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
442 Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string,
445 if (msgPtr->string != NULL) {
446 ckfree(msgPtr->string);
448 msgPtr->string = (char *) ckalloc((unsigned) (strlen(value) + 1));
449 strcpy(msgPtr->string, value);
451 Tcl_TraceVar(interp, msgPtr->textVarName,
453 MessageTextVarProc, (ClientData) msgPtr);
462 msgPtr->numChars = strlen(msgPtr->string);
464 Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border);
466 if (msgPtr->highlightWidth < 0) {
467 msgPtr->highlightWidth = 0;
470 gcValues.font = msgPtr->fontPtr->fid;
471 gcValues.foreground = msgPtr->fgColorPtr->pixel;
472 newGC = Tk_GetGC(msgPtr->tkwin, GCForeground|GCFont,
474 if (msgPtr->textGC != None) {
475 Tk_FreeGC(msgPtr->display, msgPtr->textGC);
477 msgPtr->textGC = newGC;
479 if (msgPtr->padX == -1) {
480 msgPtr->padX = msgPtr->fontPtr->ascent/2;
483 if (msgPtr->padY == -1) {
484 msgPtr->padY = msgPtr->fontPtr->ascent/4;
492 ComputeMessageGeometry(msgPtr);
493 if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin)
494 && !(msgPtr->flags & REDRAW_PENDING)) {
495 Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
496 msgPtr->flags |= REDRAW_PENDING;
523 ComputeMessageGeometry(msgPtr)
524 register Message *msgPtr; /* Information about window. */
531 msgPtr->inset = msgPtr->borderWidth + msgPtr->highlightWidth;
537 aspect = msgPtr->aspect/10;
541 lowerBound = msgPtr->aspect - aspect;
542 upperBound = msgPtr->aspect + aspect;
553 if (msgPtr->width > 0) {
554 width = msgPtr->width;
557 width = WidthOfScreen(Tk_Screen(msgPtr->tkwin))/2;
562 for (numLines = 1, p = msgPtr->string; ; numLines++) {
567 p += TkMeasureChars(msgPtr->fontPtr, p,
568 msgPtr->numChars - (p - msgPtr->string), 0, width, 0,
591 height = numLines * (msgPtr->fontPtr->ascent
592 + msgPtr->fontPtr->descent) + 2*msgPtr->inset
593 + 2*msgPtr->padY;
597 aspect = (100*(maxWidth + 2*msgPtr->inset + 2*msgPtr->padX))/height;
606 msgPtr->lineLength = maxWidth;
607 msgPtr->msgHeight = numLines * (msgPtr->fontPtr->ascent
608 + msgPtr->fontPtr->descent);
609 Tk_GeometryRequest(msgPtr->tkwin,
610 maxWidth + 2*msgPtr->inset + 2*msgPtr->padX, height);
611 Tk_SetInternalBorder(msgPtr->tkwin, msgPtr->inset);
635 register Message *msgPtr = (Message *) clientData;
636 register Tk_Window tkwin = msgPtr->tkwin;
640 msgPtr->flags &= ~REDRAW_PENDING;
641 if ((msgPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
644 Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), msgPtr->border, 0, 0,
652 switch (msgPtr->anchor) {
654 y = msgPtr->inset + msgPtr->padY;
657 y = ((int) (Tk_Height(tkwin) - msgPtr->msgHeight))/2;
660 y = Tk_Height(tkwin) - msgPtr->inset - msgPtr->padY
661 - msgPtr->msgHeight;
664 y += msgPtr->fontPtr->ascent;
673 for (p = msgPtr->string, charsLeft = msgPtr->numChars; *p != 0;
674 y += msgPtr->fontPtr->ascent + msgPtr->fontPtr->descent) {
680 numChars = TkMeasureChars(msgPtr->fontPtr, p, charsLeft, 0,
681 msgPtr->lineLength, 0, TK_WHOLE_WORDS|TK_AT_LEAST_ONE,
683 switch (msgPtr->anchor) {
685 x = msgPtr->inset + msgPtr->padX;
688 x = ((int) (Tk_Width(tkwin) - msgPtr->lineLength))/2;
691 x = Tk_Width(tkwin) - msgPtr->inset - msgPtr->padX
692 - msgPtr->lineLength;
695 if (msgPtr->justify == TK_JUSTIFY_CENTER) {
696 x += (msgPtr->lineLength - lineLength)/2;
697 } else if (msgPtr->justify == TK_JUSTIFY_RIGHT) {
698 x += msgPtr->lineLength - lineLength;
700 TkDisplayChars(msgPtr->display, Tk_WindowId(tkwin),
701 msgPtr->textGC, msgPtr->fontPtr, p, numChars, x, y, x, 0);
720 if (msgPtr->relief != TK_RELIEF_FLAT) {
721 Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), msgPtr->border,
722 msgPtr->highlightWidth, msgPtr->highlightWidth,
723 Tk_Width(tkwin) - 2*msgPtr->highlightWidth,
724 Tk_Height(tkwin) - 2*msgPtr->highlightWidth,
725 msgPtr->borderWidth, msgPtr->relief);
727 if (msgPtr->highlightWidth != 0) {
730 if (msgPtr->flags & GOT_FOCUS) {
731 gc = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin));
733 gc = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
735 Tk_DrawFocusHighlight(tkwin, gc, msgPtr->highlightWidth,
764 Message *msgPtr = (Message *) clientData;
770 if (msgPtr->tkwin != NULL) {
771 msgPtr->tkwin = NULL;
772 Tcl_DeleteCommand(msgPtr->interp,
773 Tcl_GetCommandName(msgPtr->interp, msgPtr->widgetCmd));
775 if (msgPtr->flags & REDRAW_PENDING) {
776 Tcl_CancelIdleCall(DisplayMessage, (ClientData) msgPtr);
778 Tcl_EventuallyFree((ClientData) msgPtr, DestroyMessage);
781 msgPtr->flags |= GOT_FOCUS;
782 if (msgPtr->highlightWidth > 0) {
788 msgPtr->flags &= ~GOT_FOCUS;
789 if (msgPtr->highlightWidth > 0) {
797 if ((msgPtr->tkwin != NULL) && !(msgPtr->flags & REDRAW_PENDING)) {
798 Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
799 msgPtr->flags |= REDRAW_PENDING;
826 Message *msgPtr = (Message *) clientData;
827 Tk_Window tkwin = msgPtr->tkwin;
837 msgPtr->tkwin = NULL;
870 register Message *msgPtr = (Message *) clientData;
880 Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string,
882 Tcl_TraceVar(interp, msgPtr->textVarName,
889 value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
893 if (msgPtr->string != NULL) {
894 ckfree(msgPtr->string);
896 msgPtr->numChars = strlen(value);
897 msgPtr->string = (char *) ckalloc((unsigned) (msgPtr->numChars + 1));
898 strcpy(msgPtr->string, value);
899 ComputeMessageGeometry(msgPtr);
901 if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin)
902 && !(msgPtr->flags & REDRAW_PENDING)) {
903 Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr);
904 msgPtr->flags |= REDRAW_PENDING;