Commit | Line | Data |
---|---|---|
5526e819 | 1 | ///////////////////////////////////////////////////////////////////////////// |
69941f05 VS |
2 | // Name: m_templ.h |
3 | // Purpose: Modules template file | |
5526e819 | 4 | // Author: Vaclav Slavik |
69941f05 VS |
5 | // RCS-ID: $Id$ |
6 | // Copyright: (c) Vaclav Slavik | |
65571936 | 7 | // Licence: wxWindows licence |
5526e819 VS |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | /* | |
11 | ||
12 | DESCRIPTION: | |
13 | This is set of macros for easier writing of tag handlers. How to use it? | |
14 | See mod_fonts.cpp for example... | |
15 | ||
16 | Attention! This is quite strange C++ bastard. Before using it, | |
17 | I STRONGLY recommend reading and understanding these macros!! | |
18 | ||
19 | */ | |
20 | ||
21 | ||
69941f05 VS |
22 | #ifndef _WX_M_TEMPL_H_ |
23 | #define _WX_M_TEMPL_H_ | |
5526e819 VS |
24 | |
25 | #include "wx/defs.h" | |
5526e819 | 26 | |
04dbb646 | 27 | #if wxUSE_HTML |
5526e819 | 28 | |
69941f05 | 29 | #include "wx/html/winpars.h" |
5526e819 | 30 | |
5526e819 | 31 | #define TAG_HANDLER_BEGIN(name,tags) \ |
6848729f | 32 | class wxHTML_Handler_##name : public wxHtmlWinTagHandler \ |
5526e819 VS |
33 | { \ |
34 | public: \ | |
2b5f62a0 | 35 | wxString GetSupportedTags() {return wxT(tags);} |
5526e819 VS |
36 | |
37 | ||
38 | ||
39 | #define TAG_HANDLER_VARS \ | |
40 | private: | |
41 | ||
42 | #define TAG_HANDLER_CONSTR(name) \ | |
43 | public: \ | |
6848729f | 44 | wxHTML_Handler_##name () : wxHtmlWinTagHandler() |
5526e819 VS |
45 | |
46 | ||
47 | #define TAG_HANDLER_PROC(varib) \ | |
48 | public: \ | |
49 | bool HandleTag(const wxHtmlTag& varib) | |
50 | ||
51 | ||
52 | ||
53 | #define TAG_HANDLER_END(name) \ | |
54 | }; | |
55 | ||
56 | ||
57 | ||
58 | ||
59 | #define TAGS_MODULE_BEGIN(name) \ | |
6848729f | 60 | class wxHTML_Module##name : public wxHtmlTagsModule \ |
5526e819 | 61 | { \ |
6848729f | 62 | DECLARE_DYNAMIC_CLASS(wxHTML_Module##name ) \ |
5526e819 VS |
63 | public: \ |
64 | void FillHandlersTable(wxHtmlWinParser *parser) \ | |
65 | { | |
66 | ||
67 | ||
68 | ||
69 | ||
70 | #define TAGS_MODULE_ADD(handler) \ | |
6848729f | 71 | parser->AddTagHandler(new wxHTML_Handler_##handler); |
5526e819 VS |
72 | |
73 | ||
74 | ||
75 | ||
76 | #define TAGS_MODULE_END(name) \ | |
77 | } \ | |
78 | }; \ | |
6848729f | 79 | IMPLEMENT_DYNAMIC_CLASS(wxHTML_Module##name , wxHtmlTagsModule) |
5526e819 VS |
80 | |
81 | ||
82 | ||
83 | #endif | |
69941f05 | 84 | #endif |