]>
Commit | Line | Data |
---|---|---|
f68e16c5 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/html/m_span.cpp | |
3 | // Purpose: wxHtml module for span handling | |
4 | // Author: Nigel Paton | |
f68e16c5 VZ |
5 | // Copyright: wxWidgets team |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #include "wx/wxprec.h" | |
10 | ||
11 | #ifdef __BORLANDC__ | |
12 | #pragma hdrstop | |
13 | #endif | |
14 | ||
15 | #if wxUSE_HTML | |
16 | ||
17 | #include "wx/html/forcelnk.h" | |
18 | #include "wx/html/m_templ.h" | |
19 | #include "wx/fontenum.h" | |
20 | #include "wx/tokenzr.h" | |
21 | #include "wx/html/styleparams.h" | |
22 | ||
23 | FORCE_LINK_ME(m_span) | |
24 | ||
25 | ||
26 | TAG_HANDLER_BEGIN(SPAN, "SPAN" ) | |
27 | ||
28 | TAG_HANDLER_VARS | |
29 | wxArrayString m_Faces; | |
30 | ||
31 | TAG_HANDLER_CONSTR(SPAN) { } | |
32 | ||
33 | TAG_HANDLER_PROC(tag) | |
34 | { | |
35 | wxColour oldclr = m_WParser->GetActualColor(); | |
f5413b87 VZ |
36 | wxColour oldbackclr = m_WParser->GetActualBackgroundColor(); |
37 | int oldbackmode = m_WParser->GetActualBackgroundMode(); | |
f68e16c5 VZ |
38 | int oldsize = m_WParser->GetFontSize(); |
39 | int oldbold = m_WParser->GetFontBold(); | |
3e65f74e VZ |
40 | int olditalic = m_WParser->GetFontItalic(); |
41 | int oldunderlined = m_WParser->GetFontUnderlined(); | |
42 | wxString oldfontface = m_WParser->GetFontFace(); | |
f68e16c5 VZ |
43 | |
44 | // Load any style parameters | |
45 | wxHtmlStyleParams styleParams(tag); | |
46 | ||
0d7acfb9 | 47 | ApplyStyle(styleParams); |
3e65f74e VZ |
48 | |
49 | ParseInner(tag); | |
50 | ||
51 | m_WParser->SetFontSize(oldsize); | |
52 | m_WParser->SetFontBold(oldbold); | |
53 | m_WParser->SetFontUnderlined(oldunderlined); | |
54 | m_WParser->SetFontFace(oldfontface); | |
55 | m_WParser->SetFontItalic(olditalic); | |
56 | m_WParser->GetContainer()->InsertCell( | |
57 | new wxHtmlFontCell(m_WParser->CreateCurrentFont())); | |
58 | ||
f68e16c5 VZ |
59 | if (oldclr != m_WParser->GetActualColor()) |
60 | { | |
61 | m_WParser->SetActualColor(oldclr); | |
3e65f74e VZ |
62 | m_WParser->GetContainer()->InsertCell( |
63 | new wxHtmlColourCell(oldclr)); | |
f68e16c5 VZ |
64 | } |
65 | ||
f5413b87 VZ |
66 | if (oldbackmode != m_WParser->GetActualBackgroundMode() || |
67 | oldbackclr != m_WParser->GetActualBackgroundColor()) | |
68 | { | |
69 | m_WParser->SetActualBackgroundMode(oldbackmode); | |
70 | m_WParser->SetActualBackgroundColor(oldbackclr); | |
71 | m_WParser->GetContainer()->InsertCell( | |
1f4bb1d7 | 72 | new wxHtmlColourCell(oldbackclr, oldbackmode == wxTRANSPARENT ? wxHTML_CLR_TRANSPARENT_BACKGROUND : wxHTML_CLR_BACKGROUND)); |
f5413b87 VZ |
73 | } |
74 | ||
f68e16c5 VZ |
75 | return true; |
76 | } | |
77 | ||
78 | TAG_HANDLER_END(SPAN) | |
79 | ||
80 | ||
81 | TAGS_MODULE_BEGIN(Spans) | |
82 | ||
83 | TAGS_MODULE_ADD(SPAN) | |
84 | ||
85 | TAGS_MODULE_END(Spans) | |
86 | ||
87 | #endif // wxUSE_HTML |