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