1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/textwrapper.h
3 // Purpose: declaration of wxTextWrapper class
4 // Author: Vadim Zeitlin
5 // Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h)
7 // Copyright: (c) 1999, 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TEXTWRAPPER_H_
12 #define _WX_TEXTWRAPPER_H_
14 #include "wx/window.h"
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // this class is used to wrap the text on word boundary: wrapping is done by
21 // calling OnStartLine() and OnOutputLine() functions
22 class WXDLLIMPEXP_CORE wxTextWrapper
25 wxTextWrapper() { m_eol
= false; }
27 // win is used for getting the font, text is the text to wrap, width is the
28 // max line width or -1 to disable wrapping
29 void Wrap(wxWindow
*win
, const wxString
& text
, int widthMax
);
31 // we don't need it, but just to avoid compiler warnings
32 virtual ~wxTextWrapper() { }
36 virtual void OnOutputLine(const wxString
& line
) = 0;
38 // called at the start of every new line (except the very first one)
39 virtual void OnNewLine() { }
42 // call OnOutputLine() and set m_eol to true
43 void DoOutputLine(const wxString
& line
)
50 // this function is a destructive inspector: when it returns true it also
51 // resets the flag to false so calling it again wouldn't return true any
53 bool IsStartOfNewLine()
66 wxDECLARE_NO_COPY_CLASS(wxTextWrapper
);
69 #endif // _WX_TEXTWRAPPER_H_