]> git.saurik.com Git - wxWidgets.git/blame - include/wx/private/stattext.h
Bakefile and other changes for new locations of STC and wxSVGFileDC.
[wxWidgets.git] / include / wx / private / stattext.h
CommitLineData
39bc0347
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: include/wx/private/stattext.h
3// Purpose: Internal declarations for dlgcmn.cpp and stattextcmn.cpp
4// Author: Francesco Montorsi
5// Created: 2007-01-07 (extracted from dlgcmn.cpp)
6// RCS-ID: $Id$
7// Copyright: (c) 1999 Vadim Zeitlin
8// (c) 2007 wxWidgets team
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PRIVATE_STATTEXT_H_
13#define _WX_PRIVATE_STATTEXT_H_
14
523b9ce4
VZ
15#include "wx/window.h"
16
39bc0347
VZ
17#if wxUSE_STATTEXT
18
19// ----------------------------------------------------------------------------
20// wxTextWrapper
21// ----------------------------------------------------------------------------
22
23// this class is used to wrap the text on word boundary: wrapping is done by
24// calling OnStartLine() and OnOutputLine() functions
25class wxTextWrapper
26{
27public:
28 wxTextWrapper() { m_eol = false; }
29
30 // win is used for getting the font, text is the text to wrap, width is the
31 // max line width or -1 to disable wrapping
32 void Wrap(wxWindow *win, const wxString& text, int widthMax);
33
34 // we don't need it, but just to avoid compiler warnings
35 virtual ~wxTextWrapper() { }
36
37protected:
38 // line may be empty
39 virtual void OnOutputLine(const wxString& line) = 0;
40
41 // called at the start of every new line (except the very first one)
42 virtual void OnNewLine() { }
43
44private:
45 // call OnOutputLine() and set m_eol to true
46 void DoOutputLine(const wxString& line)
47 {
48 OnOutputLine(line);
49
50 m_eol = true;
51 }
52
53 // this function is a destructive inspector: when it returns true it also
54 // resets the flag to false so calling it again woulnd't return true any
55 // more
56 bool IsStartOfNewLine()
57 {
58 if ( !m_eol )
59 return false;
60
61 m_eol = false;
62
63 return true;
64 }
65
66
67 bool m_eol;
68};
69
70enum
71{
72 wxMARKUP_ENTITY_AMP,
73 wxMARKUP_ENTITY_LT,
74 wxMARKUP_ENTITY_GT,
75 wxMARKUP_ENTITY_APOS,
76 wxMARKUP_ENTITY_QUOT,
77 wxMARKUP_ENTITY_MAX
78};
79
80enum
81{
82 wxMARKUP_ELEMENT_NAME,
83 wxMARKUP_ELEMENT_VALUE,
84 wxMARKUP_ELEMENT_MAX
85};
86
87// these are the only entities treated in a special way by wxStaticText::SetLabel()
88// when the wxST_MARKUP style is used; use as:
89//
90// wxMarkupEntities[wxMARKUP_ELEMENT_NAME][wxMARKUP_ENTITY_GT] == ">"
91// wxMarkupEntities[wxMARKUP_ELEMENT_VALUE][wxMARKUP_ENTITY_GT] == ">"
92//
93extern const wxChar *wxMarkupEntities[wxMARKUP_ELEMENT_MAX][wxMARKUP_ENTITY_MAX];
94
95#endif // wxUSE_STATTEXT
96
97#endif // _WX_PRIVATE_STATTEXT_H_