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:
virtual void OnOutputLine(
const wxString& line)
{
m_wrapped += line;
}
virtual void OnNewLine()
{
m_wrapped += '\n';
}
private:
};
HardBreakWrapper wrapper(win, text, widthMax);
return wrapper.GetWrapped();
}
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:315
Helps wrap lines of text to given width.
Definition: textwrapper.h:60
wxWindow is the base class for all windows and represents any visible object on screen.
Definition: window.h:346
Library: None; this class implementation is entirely header-based.