Beispiel #1
0
void 
InitScrollBar(ControlHandle sb)
{
	short		lines;
	short		max;
	short		height;
	TEPtr		te;
	TEHandle	currTE;
	
	switch(gCurrWin)
	{
		case kLicenseID:
			currTE = gControls->lw->licTxt;
			break;
		default:
			ErrorHandler(eUnknownDlgID, nil);
			break;
	}
	
	lines = TEGetHeight((**currTE).nLines,0,currTE) / kScrollAmount;
	te = *currTE;							// point to TERec for convenience

	height = te->viewRect.bottom - te->viewRect.top;
	max = lines - (height / kScrollAmount);
	if (height % kScrollAmount) max++;
	if ( max < 0 ) max = 0;

	SetControlMaximum(sb, max);
}
Beispiel #2
0
static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    long _rv;
    long endLine;
    long startLine;
#ifndef TEGetHeight
    PyMac_PRECHECK(TEGetHeight);
#endif
    if (!PyArg_ParseTuple(_args, "ll",
                          &endLine,
                          &startLine))
        return NULL;
    _rv = TEGetHeight(endLine,
                      startLine,
                      _self->ob_itself);
    _res = Py_BuildValue("l",
                         _rv);
    return _res;
}