1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/html/m_dflist.cpp
3 // Purpose:     wxHtml module for definition lists (DL,DT,DD)
4 // Author:      Vaclav Slavik
5 // Copyright:   (c) 1999 Vaclav Slavik
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 #include "wx/wxprec.h"
10 
11 
12 #if wxUSE_HTML && wxUSE_STREAMS
13 
14 #ifndef WX_PRECOMP
15 #endif
16 
17 #include "wx/html/forcelnk.h"
18 #include "wx/html/m_templ.h"
19 
20 #include "wx/html/htmlcell.h"
21 
22 FORCE_LINK_ME(m_dflist)
23 
24 
25 
26 
27 TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD" )
28 
TAG_HANDLER_CONSTR(DEFLIST)29     TAG_HANDLER_CONSTR(DEFLIST) { }
30 
TAG_HANDLER_PROC(tag)31     TAG_HANDLER_PROC(tag)
32     {
33         wxHtmlContainerCell *c;
34 
35 
36         if (tag.GetName() == wxT("DL"))
37         {
38             if (m_WParser->GetContainer()->GetFirstChild() != NULL)
39             {
40                 m_WParser->CloseContainer();
41                 m_WParser->OpenContainer();
42             }
43             m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
44 
45             ParseInner(tag);
46 
47             if (m_WParser->GetContainer()->GetFirstChild() != NULL)
48             {
49                 m_WParser->CloseContainer();
50                 m_WParser->OpenContainer();
51             }
52             m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
53 
54             return true;
55         }
56         else if (tag.GetName() == wxT("DT"))
57         {
58             m_WParser->CloseContainer();
59             c = m_WParser->OpenContainer();
60             c->SetAlignHor(wxHTML_ALIGN_LEFT);
61             c->SetMinHeight(m_WParser->GetCharHeight());
62             return false;
63         }
64         else // "DD"
65         {
66             m_WParser->CloseContainer();
67             c = m_WParser->OpenContainer();
68             c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
69             return false;
70         }
71     }
72 
73 TAG_HANDLER_END(DEFLIST)
74 
75 
76 TAGS_MODULE_BEGIN(DefinitionList)
77 
78     TAGS_MODULE_ADD(DEFLIST)
79 
80 TAGS_MODULE_END(DefinitionList)
81 
82 #endif
83