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();
}
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
virtual void OnOutputLine(const wxString &line)=0
Called by Wrap() for each wrapped line of text.
virtual void OnNewLine()
Called at the start of each subsequent line of text by Wrap().
void Wrap(wxWindow *win, const wxString &text, int widthMax)
Wrap the given text.
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.