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