struct wxTextLayoutAttr { wxFont font; wxColour bgcolor; wxColour fgcolor;}struct wxTextLayoutRunCoords { size_t start; size_t end;}WX_DECLARE_HASH_MAP(runcoords, wxTextLayoutAttr, wxTextAttributes);class wxTextLayout { public: wxTextLayout(const wxString &textrun=wxEmptyString, wxTextAttributes &attributes=wxDefaultAttributes); //Set an attribute on a range of text void SetAttribute(wxTextLayoutAttr, const wxTextLayoutRange ⦥); // Wrap the text in the layout object to the given width, in pixels. If wrap is -1, don't // wrap to a width, just wrap any embedded newlines. void Wrap(wxDC &dc, int width); //Given a point (assumed to be normalized such that (0,0) is the origin of the //text in the layout), return True and set offset if the point is within the text bool HitTest(const wxPoint& pt, size_t &offset); //render the layout into the provided DC. void RenderLayout(const wxPoint &origin, wxDC &dc); // Just render one line void RenderLine(const wxPoint &origin, wxDC &dc, size_t line); // Render a range of characters void RenderRange(const wxPoint &origin, wxDC&dc, const wxTextLayoutRange &range); //the number of lines of text in the layout. Don't rely on \n or other newlines within the //text to be counted unless Wrap() has been called. size_t GetLineCount(); //Return the range within the buffer that corresponds to a line wxTextLayoutRange GetLineOffset(size_t line); //return a wxRect for the character at offset in the string wxRect GetRectForChar(size_t offset); //return a wxRect for a full line wxRect GetRectForLine(size_t line); //return a wxRect for a range of characters within the layout wxRect GetRectForRange(const wxTextLayoutRange &range);};