Helps wrap lines of text to given width.
This is a generic purpose class which can be used to wrap lines of text to the specified width. It doesn't do anything by itself but simply calls its virtual OnOutputLine() and OnNewLine() methods for each wrapped line of text, you need to implement them in your derived class to actually do something useful.
Here is an example function using this class which inserts hard line breaks into a string of text at the positions where it would be wrapped:
{
{
public:
{
Wrap(win, text, widthMax);
}
wxString const& GetWrapped()
const {
return m_wrapped; }
protected:
{
m_wrapped += line;
}
{
m_wrapped += '\n';
}
private:
};
HardBreakWrapper wrapper(win, text, widthMax);
return wrapper.GetWrapped();
}
Library: None; this class implementation is entirely header-based.