]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: htmlprep.h | |
3 | // Purpose: HTML processor | |
4 | // Author: Vaclav Slavik | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 2001 Vaclav Slavik | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_HTMLPREP_H_ | |
11 | #define _WX_HTMLPREP_H_ | |
12 | ||
13 | #include "wx/defs.h" | |
14 | ||
15 | #if wxUSE_HTML | |
16 | ||
17 | #include "wx/string.h" | |
18 | ||
19 | // Priority of preprocessor in the chain. The higher, the earlier it is used | |
20 | enum | |
21 | { | |
22 | wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this | |
23 | // priority | |
24 | wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals | |
25 | }; | |
26 | ||
27 | // Classes derived from this class serve as simple text processors for | |
28 | // wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered | |
29 | // processors before displaying it, thus allowing for on-the-fly | |
30 | // modifications of the markup. | |
31 | ||
32 | class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject | |
33 | { | |
34 | DECLARE_ABSTRACT_CLASS(wxHtmlProcessor) | |
35 | ||
36 | public: | |
37 | wxHtmlProcessor() : wxObject(), m_enabled(true) {} | |
38 | virtual ~wxHtmlProcessor() {} | |
39 | ||
40 | // Process input text and return processed result | |
41 | virtual wxString Process(const wxString& text) const = 0; | |
42 | ||
43 | // Return priority value of this processor. The higher, the sooner | |
44 | // is the processor applied to the text. | |
45 | virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; } | |
46 | ||
47 | // Enable/disable the processor. wxHtmlWindow won't use a disabled | |
48 | // processor even if it is in its processors queue. | |
49 | virtual void Enable(bool enable = true) { m_enabled = enable; } | |
50 | bool IsEnabled() const { return m_enabled; } | |
51 | ||
52 | protected: | |
53 | bool m_enabled; | |
54 | }; | |
55 | ||
56 | #endif // wxUSE_HTML | |
57 | ||
58 | #endif // _WX_HTMLPROC_H_ |