]> git.saurik.com Git - wxWidgets.git/blob - include/wx/private/stattext.h
build fixes for wxUSE_IPV6==1 under Windows
[wxWidgets.git] / include / wx / private / stattext.h
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
15 #include "wx/window.h"
16
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
25 class wxTextWrapper
26 {
27 public:
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
37 protected:
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
44 private:
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
70 #endif // wxUSE_STATTEXT
71
72 enum
73 {
74 wxMARKUP_ENTITY_AMP,
75 wxMARKUP_ENTITY_LT,
76 wxMARKUP_ENTITY_GT,
77 wxMARKUP_ENTITY_APOS,
78 wxMARKUP_ENTITY_QUOT,
79 wxMARKUP_ENTITY_MAX
80 };
81
82 enum
83 {
84 wxMARKUP_ELEMENT_NAME,
85 wxMARKUP_ELEMENT_VALUE,
86 wxMARKUP_ELEMENT_MAX
87 };
88
89 // these are the only entities treated in a special way by wxStaticText::SetLabel()
90 // when the wxST_MARKUP style is used; use as:
91 //
92 // wxMarkupEntities[wxMARKUP_ELEMENT_NAME][wxMARKUP_ENTITY_GT] == ">"
93 // wxMarkupEntities[wxMARKUP_ELEMENT_VALUE][wxMARKUP_ENTITY_GT] == ">"
94 //
95 extern const wxChar *wxMarkupEntities[wxMARKUP_ELEMENT_MAX][wxMARKUP_ENTITY_MAX];
96
97 #endif // _WX_PRIVATE_STATTEXT_H_