## wxDrawnShape

Draws a pseduo-metafile shape, which can be loaded from a simple Windows metafile.

wxDrawnShape allows you to specify a different shape for each of four orientations (North, West, South and East). It also provides a set of drawing functions for programmatic drawing of a shape, so that during construction of the shape you can draw into it as if it were a device context.

Derived from

wxRectangleShape

See also wxRectangleShape.

Members

wxDrawnShape::wxDrawnShape
wxDrawnShape::~wxDrawnShape
wxDrawnShape::CalculateSize
wxDrawnShape::DestroyClippingRect
wxDrawnShape::DrawArc
wxDrawnShape::DrawAtAngle
wxDrawnShape::DrawEllipticArc
wxDrawnShape::DrawLine
wxDrawnShape::DrawLines
wxDrawnShape::DrawPoint
wxDrawnShape::DrawPolygon
wxDrawnShape::DrawRectangle
wxDrawnShape::DrawRoundedRectangle
wxDrawnShape::DrawSpline
wxDrawnShape::DrawText
wxDrawnShape::GetAngle
wxDrawnShape::GetMetaFile
wxDrawnShape::GetRotation
wxDrawnShape::LoadFromMetaFile
wxDrawnShape::Rotate
wxDrawnShape::SetClippingRect
wxDrawnShape::SetDrawnBackgroundColour
wxDrawnShape::SetDrawnBackgroundMode
wxDrawnShape::SetDrawnBrush
wxDrawnShape::SetDrawnFont
wxDrawnShape::SetDrawnPen
wxDrawnShape::SetDrawnTextColour
wxDrawnShape::Scale
wxDrawnShape::SetSaveToFile
wxDrawnShape::Translate

### wxDrawnShape::wxDrawnShape

wxDrawnShape()

Constructor.

### wxDrawnShape::~wxDrawnShape

~wxDrawnShape()

Destructor.

### wxDrawnShape::CalculateSize

void CalculateSize()

Calculates the wxDrawnShape size from the current metafile. Call this after you have drawn into the shape.

### wxDrawnShape::DestroyClippingRect

void DestroyClippingRect()

Destroys the clipping rectangle. See also wxDrawnShape::SetClippingRect.

### wxDrawnShape::DrawArc

void DrawArc(const wxPoint& centrePoint, const wxPoint& startPoint, const wxPoint& endPoint)

Draws an arc (see wxWindows documentation for details).

### wxDrawnShape::DrawAtAngle

void DrawAtAngle(int angle)

Sets the metafile for the given orientation, which can be one of:

- oglDRAWN_ANGLE_0
- oglDRAWN_ANGLE_90
- oglDRAWN_ANGLE_180
- oglDRAWN_ANGLE_270

See also wxDrawnShape::GetAngle.

### wxDrawnShape::DrawEllipticArc

void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle)

Draws an elliptic arc (see wxWindows documentation for details).

### wxDrawnShape::DrawLine

void DrawLine(const wxPoint& point1, const wxPoint& point2)

Draws a line from point1 to point2.

### wxDrawnShape::DrawLines

void DrawLines(int n, wxPoint& points[])

Draws n lines.

### wxDrawnShape::DrawPoint

void DrawPoint(const wxPoint& point)

Draws a point.

### wxDrawnShape::DrawPolygon

void DrawPolygon(int n, wxPoint& points[], int flags = 0)

Draws a polygon. flags can be one or more of oglMETAFLAGS_OUTLINE (use this polygon for the drag outline) and oglMETAFLAGS_ATTACHMENTS (use the vertices of this polygon for attachments).

### wxDrawnShape::DrawRectangle

void DrawRectangle(const wxRect& rect)

Draws a rectangle.

### wxDrawnShape::DrawRoundedRectangle

void DrawRoundedRectangle(const wxRect& rect, double radius)

Draws a rounded rectangle. radius is the corner radius. If radius is negative, it expresses the radius as a proportion of the smallest dimension of the rectangle.

### wxDrawnShape::DrawSpline

void DrawSpline(int n, wxPoint& points[])

Draws a spline curve.

### wxDrawnShape::DrawText

void DrawText(const wxString& text, const wxPoint& point)

Draws text at the given point.

### wxDrawnShape::GetAngle

int GetAngle() const

Returns the current orientation, which can be one of:

- oglDRAWN_ANGLE_0
- oglDRAWN_ANGLE_90
- oglDRAWN_ANGLE_180
- oglDRAWN_ANGLE_270

See also wxDrawnShape::DrawAtAngle.

### wxDrawnShape::GetMetaFile

wxPseudoMetaFile& GetMetaFile() const

Returns a reference to the internal 'pseudo-metafile'.

### wxDrawnShape::GetRotation

double GetRotation() const

Returns the current rotation of the shape in radians.

### wxDrawnShape::LoadFromMetaFile

bool LoadFromMetaFile(const wxString& filename)

Loads a (very simple) Windows metafile, created for example by Top Draw, the Windows shareware graphics package.

### wxDrawnShape::Rotate

void Rotate(double x, double y, double theta)

Rotate about the given axis by the given amount in radians.

### wxDrawnShape::SetClippingRect

void SetClippingRect(const wxRect& rect)

Sets the clipping rectangle. See also wxDrawnShape::DestroyClippingRect.

### wxDrawnShape::SetDrawnBackgroundColour

void SetDrawnBackgroundColour(const wxColour& colour)

Sets the current background colour for the current metafile.

### wxDrawnShape::SetDrawnBackgroundMode

void SetDrawnBackgroundMode(int mode)

Sets the current background mode for the current metafile.

### wxDrawnShape::SetDrawnBrush

void SetDrawnBrush(wxPen* pen, bool isOutline = FALSE)

Sets the pen for this metafile. If isOutline is TRUE, this pen is taken to indicate the outline (and if the outline pen is changed for the whole shape, the pen will be replaced with the outline pen).

### wxDrawnShape::SetDrawnFont

void SetDrawnFont(wxFont* font)

Sets the current font for the current metafile.

### wxDrawnShape::SetDrawnPen

void SetDrawnPen(wxPen* pen, bool isOutline = FALSE)

Sets the pen for this metafile. If isOutline is TRUE, this pen is taken to indicate the outline (and if the outline pen is changed for the whole shape, the pen will be replaced with the outline pen).

### wxDrawnShape::SetDrawnTextColour

void SetDrawnTextColour(const wxColour& colour)

Sets the current text colour for the current metafile.

### wxDrawnShape::Scale

void Scale(double sx, double sy)

Scales the shape by the given amount.

### wxDrawnShape::SetSaveToFile

void SetSaveToFile(bool save)

If save is TRUE, the image will be saved along with the shape's other attributes. The reason why this might not be desirable is that if there are many shapes with the same image, it would be more efficient for the application to save one copy, and not duplicate the information for every shape. The default is TRUE.

### wxDrawnShape::Translate

void Translate(double x, double y)

Translates the shape by the given amount.