This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.
There's no really easy way (such as a TEAddPict() call), and it will
be a nasty kludge if you do get it working, but if you can live with
that, here's how to do it. I do recommend that you take a look at Q
6.2, above.
Write an algorithm to get the position of a special marker character
[Teach/SimpleText uses option-space] or text attribute that the user
will insert wherever he wants a picture. Pass this position to a
function similar to the one below.
*code*
/*
TEDrawPicture
Draw a picture within TextEdit's text.
input:
pos - the position of the special character in the text where the user
wants a picture.
r - size of picture
output:
r - frame in which picture was drawn
*/
void TEDrawPicture(short pos,PicHandle pic,Rect &r,TEHandle theTE)
{
Point bottomLeft; //I think TT/ST uses topleft
bottomLeft = TEGetPoint(pos, theTE);
r.right = bottomLeft.h + (r.right - r.left);
r.top = bottomLeft.v - (r.bottom - r.top);
r.left = bottomLeft.h;
r.bottom = bottomLeft.v;
DrawPicture(pic, &r);
}
*end*
 
Continue to: