Texas Instruments TI-89 Developer's Manual page 1205

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Appendix A: System Routines — Windows
WinCharXY
(continued)
Example:
/* Draw a string to a window, wrapping on spaces or newlines. Return the height in
pixels of the text just drawn. If wwFlags.WWF_DRAW is not set then just returns
height and does not draw. Set wwFlags.WWWF_WRAP_ON_COMMAS to also wrap on commas.
*/
enum winWriteFlags { WWF_DRAW = 0x01, WWF_WRAP_ON_COMMAS=0x2 };
short WinStrXYWrap( WINDOW *w, WIN_COORDS x, WIN_COORDS y, char *Str, WORD wwFlags )
{
char *bStr, c;
short numChars, pixWid, startX, SysFontY;
startX = x;
SysFontY = ((w->CurFont == F_4x6) ? 6 : (w->CurFont == F_6x8 ? 8 : 10));
do {
bStr = Str;
numChars = 0;
while (c = *bStr) {
if (0xA == c)
break;
if (' ' == c)
if (numChars)
break;
numChars++;
if ((wwFlags & WWF_WRAP_ON_COMMAS) && ',' == c)
break;
bStr++;
}
if (numChars) {
pixWid = DrawStrWidthP( Str, numChars, w->CurFont );
if (x + pixWid >= WinWidth(w)) {
x = startX;
y += SysFontY;
if (' ' == *Str)
if (numChars)
numChars--;
Str++;
}
}
while (numChars--) {
c = *Str++;
if (wwFlags & WWF_DRAW)
WinCharXY( w, x, y, c, 1 );
x += FontCharWidth( c );
}
}
else {
x = startX;
y += SysFontY;
Str++;
}
}
while (*bStr);
return y;
}
TI-89 / TI-92 Plus Developer Guide
{
Not for Distribution
1163
Beta Version January 26, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents