#include <wx/textwrapper.h>
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 Member Functions | |
wxTextWrapper () | |
Trivial default constructor. | |
void | Wrap (wxWindow *win, const wxString &text, int widthMax) |
Wrap the given text. | |
Protected Member Functions | |
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(). | |
wxTextWrapper::wxTextWrapper | ( | ) |
Trivial default constructor.
|
protectedvirtual |
|
protectedpure virtual |
Wrap the given text.
This method will call OnOutputLine() for every line of wrapped text and OnNewLine() before the beginning of every new line after the first one (so it might be never called at all if the width of entire text is less than widthMax).
win | A non-NULL window used for measuring the text extents. |
text | The text to wrap. |
widthMax | Maximal width of each line of text or -1 to disable wrapping. |