/* activate procedure for TextEdit */ short NATEactivep(na_win *winp, Boolean on) { if (on) { TEActivate(teinfo->hTE); } else { TEDeactivate(teinfo->hTE); } return (NA_NOTPROCESSED); }
static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; #ifndef TEActivate PyMac_PRECHECK(TEActivate); #endif if (!PyArg_ParseTuple(_args, "")) return NULL; TEActivate(_self->ob_itself); Py_INCREF(Py_None); _res = Py_None; return _res; }
static int open_LogWin() /*success-> return 0;*/ { open_window(&win, kLogWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); gLogTE=TENew(&win.ref->portRect, &win.ref->portRect); if( gLogTE==0 ) mac_ErrorExit("\ppCannot open LogWindow!"); TEFeatureFlag(teFAutoScroll, teBitSet, gLogTE); TEActivate(gLogTE); return 0; }
static int open_DocWin() /*success-> return 0;*/ { Rect r; open_window(&win, kDocWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); r=win.ref->portRect; r.right-=16; gDocTE=TENew(&r, &r); if( gDocTE==0 ) mac_ErrorExit("\pCannot open DocWindow!"); TEFeatureFlag(teFAutoScroll, teBitSet, gDocTE); TEActivate(gDocTE); return 0; }
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; } } } }