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