]>
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 | ||
11 | #ifndef _WX_HTMLPREP_H_ | |
12 | #define _WX_HTMLPREP_H_ | |
13 | ||
14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
15 | #pragma interface "htmlproc.h" | |
16 | // (implementation is in htmlwin.cpp, there's no htmlprep.cpp!) | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #if wxUSE_HTML | |
22 | ||
23 | #include "wx/string.h" | |
24 | ||
25 | // Priority of preprocessor in the chain. The higher, the earlier it is used | |
26 | enum | |
27 | { | |
28 | wxHTML_PRIORITY_DONTCARE = 128, // if the order doesn't matter, use this | |
29 | // priority | |
30 | wxHTML_PRIORITY_SYSTEM = 256 // >=256 is only for wxHTML's internals | |
31 | }; | |
32 | ||
33 | // Classes derived from this class serve as simple text processors for | |
34 | // wxHtmlWindow. wxHtmlWindow runs HTML markup through all registered | |
35 | // processors before displaying it, thus allowing for on-the-fly | |
36 | // modifications of the markup. | |
37 | ||
38 | class WXDLLIMPEXP_HTML wxHtmlProcessor : public wxObject | |
39 | { | |
40 | DECLARE_ABSTRACT_CLASS(wxHtmlProcessor) | |
41 | ||
42 | public: | |
43 | wxHtmlProcessor() : wxObject(), m_enabled(true) {} | |
44 | virtual ~wxHtmlProcessor() {} | |
45 | ||
46 | // Process input text and return processed result | |
47 | virtual wxString Process(const wxString& text) const = 0; | |
48 | ||
49 | // Return priority value of this processor. The higher, the sooner | |
50 | // is the processor applied to the text. | |
51 | virtual int GetPriority() const { return wxHTML_PRIORITY_DONTCARE; } | |
52 | ||
53 | // Enable/disable the processor. wxHtmlWindow won't use a disabled | |
54 | // processor even if it is in its processors queue. | |
55 | virtual void Enable(bool enable = true) { m_enabled = enable; } | |
56 | bool IsEnabled() const { return m_enabled; } | |
57 | ||
58 | protected: | |
59 | bool m_enabled; | |
60 | }; | |
61 | ||
62 | #endif // wxUSE_HTML | |
63 | ||
64 | #endif // _WX_HTMLPROC_H_ |