]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: mod_templ.h | |
3 | // Purpose: wxHtml tags module generic "template" | |
4 | // Author: Vaclav Slavik | |
5 | // Copyright: (c) 1999 Vaclav Slavik | |
6 | // Licence: wxWindows Licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /* | |
10 | ||
11 | DESCRIPTION: | |
12 | This is set of macros for easier writing of tag handlers. How to use it? | |
13 | See mod_fonts.cpp for example... | |
14 | ||
15 | Attention! This is quite strange C++ bastard. Before using it, | |
16 | I STRONGLY recommend reading and understanding these macros!! | |
17 | ||
18 | */ | |
19 | ||
20 | ||
21 | #ifndef __MOD_TEMPL_H__ | |
22 | #define __MOD_TEMPL_H__ | |
23 | ||
24 | #include "wx/defs.h" | |
25 | #if wxUSE_HTML | |
26 | ||
27 | ||
28 | #ifdef __GNUG__ | |
29 | #pragma interface | |
30 | #pragma implementation | |
31 | #endif | |
32 | ||
33 | #include <wx/wxprec.h> | |
34 | ||
35 | #ifdef __BORDLANDC__ | |
36 | #pragma hdrstop | |
37 | #endif | |
38 | ||
39 | #ifndef WXPRECOMP | |
40 | #include <wx/wx.h> | |
41 | #endif | |
42 | ||
43 | ||
44 | ||
45 | ||
46 | #include <wx/html/htmlwinparser.h> | |
47 | ||
48 | ||
49 | #define TAG_HANDLER_BEGIN(name,tags) \ | |
50 | class HTML_Handler_##name : public wxHtmlWinTagHandler \ | |
51 | { \ | |
52 | public: \ | |
53 | wxString GetSupportedTags() {return tags;} | |
54 | ||
55 | ||
56 | ||
57 | #define TAG_HANDLER_VARS \ | |
58 | private: | |
59 | ||
60 | #define TAG_HANDLER_CONSTR(name) \ | |
61 | public: \ | |
62 | HTML_Handler_##name () : wxHtmlWinTagHandler() | |
63 | ||
64 | ||
65 | #define TAG_HANDLER_PROC(varib) \ | |
66 | public: \ | |
67 | bool HandleTag(const wxHtmlTag& varib) | |
68 | ||
69 | ||
70 | ||
71 | #define TAG_HANDLER_END(name) \ | |
72 | }; | |
73 | ||
74 | ||
75 | ||
76 | ||
77 | #define TAGS_MODULE_BEGIN(name) \ | |
78 | class HTML_Module##name : public wxHtmlTagsModule \ | |
79 | { \ | |
80 | DECLARE_DYNAMIC_CLASS(HTML_Module##name ) \ | |
81 | public: \ | |
82 | void FillHandlersTable(wxHtmlWinParser *parser) \ | |
83 | { | |
84 | ||
85 | ||
86 | ||
87 | ||
88 | #define TAGS_MODULE_ADD(handler) \ | |
89 | parser -> AddTagHandler(new HTML_Handler_##handler); | |
90 | ||
91 | ||
92 | ||
93 | ||
94 | #define TAGS_MODULE_END(name) \ | |
95 | } \ | |
96 | }; \ | |
97 | IMPLEMENT_DYNAMIC_CLASS(HTML_Module##name , wxHtmlTagsModule) | |
98 | ||
99 | ||
100 | ||
101 | #endif | |
102 | #endif |