Example #1
0
/* initialize a premade window as a TextEdit window with options
 */
void NATEinit(na_win *winp, long flags, short docwidth, Ptr data, long len)
{
	Rect		rtemp, vtemp;
	
	winp->flags = (winp->flags & ~NATE_FLAGS) | flags;
	if (!docwidth)	docwidth = DOCWIDTH;
	teinfo->docwidth = docwidth;
	rtemp = winp->pwin->portRect;
	rtemp.top += teinfo->topoff;
	vtemp = rtemp;
	if (!(flags & NATE_NOHSCROLL)) {
		vtemp.right = vtemp.left + docwidth;
	}
	if (!(flags & NATE_READONLY)) {
		winp->keyp = NATEkeyp;
	}
	if (!(flags & NATE_NOMOUSE)) {	
		winp->mousep = NATEmousep;
		winp->idlep = NATEidlep;
	}
	winp->menup = NATEmenup;
	winp->activep = NATEactivep;
	winp->updatep = NATEupdatep;
	winp->ctrlp = NATEctrlp;
	winp->closep = NATEclosep;
	winp->cursorRgn = NewRgn();
	teinfo->vctrl = teinfo->hctrl = NULL;
	
	TEAutoView(true, teinfo->hTE = TENew(&vtemp, &rtemp));	
	if (len > 0 && data != (Ptr) NULL) {
		TESetText(data, len, teinfo->hTE);
		TESetSelect(0, 0, teinfo->hTE);
	}
	teinfo->lheight = (*teinfo->hTE)->lineHeight;
}
Example #2
0
static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    Boolean fAuto;
#ifndef TEAutoView
    PyMac_PRECHECK(TEAutoView);
#endif
    if (!PyArg_ParseTuple(_args, "b",
                          &fAuto))
        return NULL;
    TEAutoView(fAuto,
               _self->ob_itself);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}