/* key press procedure for TextEdit */ short NATEkeyp(na_win *winp, long c, short mods) { short status = NA_NOTPROCESSED; if (!(mods & cmdKey)) { status = NA_PROCESSED; ObscureCursor(); TEKey(c, teinfo->hTE); NATEsetscroll(winp, false, (Rect*) NULL, (Rect*) NULL); } return (status); }
static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; CharParameter key; #ifndef TEKey PyMac_PRECHECK(TEKey); #endif if (!PyArg_ParseTuple(_args, "h", &key)) return NULL; TEKey(key, _self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; }
void RunLoop() { EventRecord theEvent; WindowPtr whichWindow; Rect txRect; txRect = qd.thePort->portRect; InsetRect(&txRect,4,0); textH = TENew(&txRect,&txRect); while (!quit) { SystemTask(); TEIdle(textH); if (GetNextEvent(everyEvent, &theEvent)) { switch (theEvent.what) { case mouseDown: { switch (FindWindow(theEvent.where, &whichWindow)) { case inSysWindow: { SystemClick(&theEvent, whichWindow); break; } case inMenuBar: { DoCommand(MenuSelect(theEvent.where)); break; } case inDrag: { DragWindow(whichWindow, theEvent.where, &qd.screenBits.bounds); break; } case inContent: { if (whichWindow != FrontWindow()) { SelectWindow(whichWindow); } else { GlobalToLocal(&theEvent.where); if (theEvent.modifiers&shiftKey) isShift = true; TEClick(theEvent.where, isShift, textH); } break; } case inGoAway: { if (TrackGoAway(whichWindow, theEvent.where)) { quit = true; } break; } default: break; } break; } case autoKey: case keyDown: { char theChar = (theEvent.message&charCodeMask); if (theEvent.modifiers&cmdKey) { DoCommand(MenuKey(theChar)); if (theChar == 'm') { quit = true; } } else { TEKey(theChar, textH); } break; } case activateEvt: { if (theEvent.modifiers&activeFlag) { TEActivate(textH); } else { TEDeactivate(textH); } break; } case updateEvt: { BeginUpdate((WindowPtr)theEvent.message); EraseRect(&(qd.thePort->portRect)); TEUpdate(&(qd.thePort->portRect), textH); EndUpdate((WindowPtr)theEvent.message); break; } default: break; } } } }