static void mac_updatelicence(WindowPtr window) { Handle h; int len; long fondsize; Rect textrect; SetPort((GrafPtr)GetWindowPort(window)); BeginUpdate(window); fondsize = GetScriptVariable(smRoman, smScriptSmallFondSize); TextFont(HiWord(fondsize)); TextSize(LoWord(fondsize)); h = Get1Resource('TEXT', wLicence); len = GetResourceSizeOnDisk(h); #if TARGET_API_MAC_CARBON GetPortBounds(GetWindowPort(window), &textrect); #else textrect = window->portRect; #endif if (h != NULL) { HLock(h); TETextBox(*h, len, &textrect, teFlushDefault); HUnlock(h); } EndUpdate(window); }
static void DrawInstrumentName(int ch, char *comm) { char buf[80]; RGBColor black={0,0,0}; Rect box; SetPortWindowPort(win.ref); RGBForeColor(&black); //channel number MoveTo(2, UPPER_MERGIN+CHANNEL_HIGHT*(ch+1)-1); snprintf(buf, 80,"%2d", ch+1); DrawText(buf, 0, strlen(buf)); //InstrumentName box.top=UPPER_MERGIN+CHANNEL_HIGHT*ch; box.left=20; box.bottom=box.top+12; box.right=LEFT_MERGIN-10; if( !comm || !*comm ) EraseRect(&box); else TETextBox(comm, strlen(comm), &box, teFlushDefault); }
static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; char *text__in__; long text__len__; int text__in_len__; Rect box; short just; #ifndef TETextBox PyMac_PRECHECK(TETextBox); #endif if (!PyArg_ParseTuple(_args, "s#O&h", &text__in__, &text__in_len__, PyMac_GetRect, &box, &just)) return NULL; text__len__ = text__in_len__; TETextBox(text__in__, text__len__, &box, just); Py_INCREF(Py_None); _res = Py_None; return _res; }
static void DrawTimeStr() { SetPortWindowPort(win.ref); TETextBox(timeStr, strlen(timeStr), &rTime, teCenter); }
static void DrawFileStr() { SetPortWindowPort(win.ref); TETextBox(fileStr, strlen(fileStr), &rFileName, teCenter); }
// -------------------------------------------------------------------------------------- static void drawIconListCell(ListHandle theList, const Rect *cellRect, IconListCellDataRec *theCellData, Boolean selected) { GrafPtr savedPort; CGrafPtr listPort; ThemeDrawingState savedState; Boolean active; Rect iconRect, textRect; short savedFont, savedSize; Style savedFace; CFStringRef cellName; GetPort(&savedPort); listPort = GetListPort(theList); SetPort((GrafPtr)listPort); GetThemeDrawingState(&savedState); if (selected) // we don't need to change the background { // color if this Cell isn't highlighted Pattern whitePattern; RGBColor highlightColor; GetQDGlobalsWhite(&whitePattern); // set the background pattern so that BackPat(&whitePattern); // the color is properly set as a solid color LMGetHiliteRGB(&highlightColor); RGBBackColor(&highlightColor); // set the background to the highlight color } EraseRect(cellRect); calculateDrawingBounds(cellRect, &iconRect, &textRect); // get the drawing Rects active = GetListActive(theList); // draw the IconRef using Icon Services PlotIconRef(&iconRect, kAlignNone, active ? kTransformNone : kTransformDisabled, kIconServicesNormalUsageFlag, theCellData->icon); #if TARGET_API_MAC_OS8 // draw TextEdit text in Classic #pragma unused (cellName) savedFont = GetPortTextFont(listPort); // Get/SetThemeDrawingState doesn't save or savedFace = GetPortTextFace(listPort); // restore these savedSize = GetPortTextSize(listPort); UseThemeFont(kThemeViewsFont, smCurrentScript); TETextBox(&theCellData->name[1], theCellData->name[0], &textRect, teCenter); TextFont(savedFont); TextFace(savedFace); TextSize(savedSize); #else // draw Appearance text in Carbon #pragma unused (savedFont, savedSize, savedFace) cellName = CFStringCreateWithPascalString(kCFAllocatorDefault, theCellData->name, GetApplicationTextEncoding()); DrawThemeTextBox(cellName, kThemeViewsFont, active ? kThemeStateActive : kThemeStateInactive, true, &textRect, teCenter, NULL); CFRelease(cellName); #endif SetThemeDrawingState(savedState, true); SetPort(savedPort); } // drawIconListCell
/* VARARGS ARGSUSED */ void TclpPanic TCL_VARARGS_DEF(CONST char *, format) { va_list varg; char msg[256]; WindowRef macWinPtr, foundWinPtr; Rect macRect; Rect buttonRect = PANIC_BUTTON_RECT; Rect iconRect = PANIC_ICON_RECT; Rect textRect = PANIC_TEXT_RECT; ControlHandle okButtonHandle; EventRecord event; Handle stopIconHandle; int part; Boolean done = false; va_start(varg, format); vsprintf(msg, format, varg); va_end(varg); /* * Put up an alert without using the Resource Manager (there may * be no resources to load). Use the Window and Control Managers instead. * We want the window centered on the main monitor. The following * should be tested with multiple monitors. Look and see if there is a way * not using qd.screenBits. */ macRect.top = (qd.screenBits.bounds.top + qd.screenBits.bounds.bottom) / 2 - (PANICHEIGHT / 2); macRect.bottom = (qd.screenBits.bounds.top + qd.screenBits.bounds.bottom) / 2 + (PANICHEIGHT / 2); macRect.left = (qd.screenBits.bounds.left + qd.screenBits.bounds.right) / 2 - (PANICWIDTH / 2); macRect.right = (qd.screenBits.bounds.left + qd.screenBits.bounds.right) / 2 + (PANICWIDTH / 2); macWinPtr = NewWindow(NULL, &macRect, "\p", true, dBoxProc, (WindowRef) -1, false, 0); if (macWinPtr == NULL) { goto exitNow; } okButtonHandle = NewControl(macWinPtr, &buttonRect, "\pOK", true, 0, 0, 1, pushButProc, 0); if (okButtonHandle == NULL) { CloseWindow(macWinPtr); goto exitNow; } SelectWindow(macWinPtr); SetCursor(&qd.arrow); stopIconHandle = GetIcon(kStopIcon); while (!done) { if (WaitNextEvent(mDownMask | keyDownMask | updateMask, &event, 0, NULL)) { switch(event.what) { case mouseDown: part = FindWindow(event.where, &foundWinPtr); if ((foundWinPtr != macWinPtr) || (part != inContent)) { SysBeep(1); } else { SetPortWindowPort(macWinPtr); GlobalToLocal(&event.where); part = FindControl(event.where, macWinPtr, &okButtonHandle); if ((kControlButtonPart == part) && (TrackControl(okButtonHandle, event.where, NULL))) { done = true; } } break; case keyDown: switch (event.message & charCodeMask) { case ENTERCODE: case RETURNCODE: HiliteControl(okButtonHandle, 1); HiliteControl(okButtonHandle, 0); done = true; } break; case updateEvt: SetPortWindowPort(macWinPtr); TextFont(systemFont); BeginUpdate(macWinPtr); if (stopIconHandle != NULL) { PlotIcon(&iconRect, stopIconHandle); } TETextBox(msg, strlen(msg), &textRect, teFlushDefault); DrawControls(macWinPtr); EndUpdate(macWinPtr); } } } CloseWindow(macWinPtr); exitNow: #ifdef TCL_DEBUG Debugger(); #else abort(); #endif }