// @(#)TextShape.h	3.7	7/28/92

#ifndef TextShape_First

#ifdef __GNUG__
#pragma interface
#endif

#define TextShape_First

#include "Shape.h"

//---- Text Shape Commands -----------------------------------------------------

class TextShapeSketcher: public ShapeSketcher {
    int lineHeight, baseHeight;
public:
    TextShapeSketcher(class DrawView*, class Shape *pro, SketchModes);
    void TrackConstrain(Point, Point, Point *np);
    Command *TrackMouse(TrackPhase, Point, Point, Point);
};

class TextShapeStretcher: public ShapeStretcher {
public:
    TextShapeStretcher(class DrawView*, class Shape *pro, int sq);
    void TrackConstrain(Point, Point, Point *np);
};

//---- Text Shape --------------------------------------------------------------


class TextShape : public Shape {
    class TextView *to;
    Shape *attachedTo;     // shape i am attached to
    bool captured;         // is the text captured ?? (otherwise paragraphed)
    static Font * defaultFont;
public:
    MetaDef(TextShape);
    
    TextShape();
    ~TextShape();
    
    bool IsGarbage();
    void SetContainer(VObject *vp);
    short *GetImage();
    GrCursor SketchCursor();
    Rectangle InvalRect();    // expand to make caret visible
    void InvalDiff(Rectangle r);
    void Init(Point, Point);
    void Draw(Rectangle);
    void SetFont(class RunArray*);
    void ResetProperty(ShapeProperties, Object*);
    void SetProperty(ShapeProperties, Object*);
    Object* GetProperty(ShapeProperties);
#ifdef ET25
#else
    void ApplyFont(StChangeStyle, StyleSpec);
#endif
    void SetSimpleProperty(ShapeProperties, int);
    int GetSimpleProperty(ShapeProperties);

    void Outline(Point p1, Point p2);
    void Highlight(HighlightState);
    class TextView *GetTextView()
	{ return to; }

    ShapeSketcher *NewSketcher(DrawView*, SketchModes);
    class ShapeStretcher *NewStretcher(DrawView*, int);

    void SetSpan(Rectangle);
    void Moveby(Point delta);
    void AreaChanged();

    void MakeDependentOn(Shape*);
    void DoObserve(int id, int p, void*, Object*);

#ifdef ET25
    OStream& PrintOn(OStream&);
    IStream& ReadFrom(IStream&);
#else
    ostream& PrintOn(ostream&);
    istream& ReadFrom(istream&);
#endif

    friend Font * TextShapeDefaultFont();
};

#endif TextShape_First
