]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_span.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/m_span.cpp
3 // Purpose: wxHtml module for span handling
6 // Copyright: wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
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"
27 TAG_HANDLER_BEGIN(SPAN
, "SPAN" )
30 wxArrayString m_Faces
;
32 TAG_HANDLER_CONSTR(SPAN
) { }
36 wxColour oldclr
= m_WParser
->GetActualColor();
37 int oldsize
= m_WParser
->GetFontSize();
38 int oldbold
= m_WParser
->GetFontBold();
40 // Load any style parameters
41 wxHtmlStyleParams
styleParams(tag
);
45 str
= styleParams
.GetParam(wxS("color"));
49 if ( wxHtmlTag::ParseAsColour(str
, &clr
) )
51 m_WParser
->SetActualColor(clr
);
52 m_WParser
->GetContainer()->InsertCell(new wxHtmlColourCell(clr
));
56 str
= styleParams
.GetParam(wxS("font-size"));
60 int foundIndex
= str
.Find(wxS("pt"));
61 if (foundIndex
!= wxNOT_FOUND
)
63 str
.Truncate(foundIndex
);
66 if (str
.ToLong(&sizeValue
) == true)
69 m_WParser
->SetFontPointSize(sizeValue
);
70 m_WParser
->GetContainer()->InsertCell(
71 new wxHtmlFontCell(m_WParser
->CreateCurrentFont()));
74 // else: check for other ways of specifying size (TODO)
77 str
= styleParams
.GetParam(wxS("font-weight"));
80 // Only bold and normal supported just now
81 if ( str
== wxS("bold") )
83 m_WParser
->SetFontBold(true);
84 m_WParser
->GetContainer()->InsertCell(
85 new wxHtmlFontCell(m_WParser
->CreateCurrentFont()));
87 else if ( str
== wxS("normal") )
89 m_WParser
->SetFontBold(false);
90 m_WParser
->GetContainer()->InsertCell(
91 new wxHtmlFontCell(m_WParser
->CreateCurrentFont()));
97 if (oldbold
!= m_WParser
->GetFontBold())
99 m_WParser
->SetFontBold(oldbold
);
100 m_WParser
->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser
->CreateCurrentFont()));
102 if (oldsize
!= m_WParser
->GetFontSize())
104 m_WParser
->SetFontSize(oldsize
);
105 m_WParser
->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser
->CreateCurrentFont()));
107 if (oldclr
!= m_WParser
->GetActualColor())
109 m_WParser
->SetActualColor(oldclr
);
110 m_WParser
->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr
));
116 TAG_HANDLER_END(SPAN
)
119 TAGS_MODULE_BEGIN(Spans
)
121 TAGS_MODULE_ADD(SPAN
)
123 TAGS_MODULE_END(Spans
)