htmlproc.h 1.8 KB

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