]>
git.saurik.com Git - wxWidgets.git/blob - src/html/mod_links.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtml module for links & anchors
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
12 #include <wx/html/forcelink.h>
13 #include <wx/html/mod_templ.h>
14 #include <wx/wxhtml.h>
16 FORCE_LINK_ME(mod_links
)
19 class wxHtmlAnchorCell
: public wxHtmlCell
22 wxString m_AnchorName
;
25 wxHtmlAnchorCell(const wxString
& name
) : wxHtmlCell() {m_AnchorName
= name
;}
26 virtual const wxHtmlCell
* Find(int condition
, const void* param
) const
28 if ((condition
== HTML_COND_ISANCHOR
) && (m_AnchorName
== (*((const wxString
*)param
))))
31 return wxHtmlCell::Find(condition
, param
);
37 TAG_HANDLER_BEGIN(A
, "A")
41 if (tag
.HasParam("NAME")) {
42 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag
.GetParam("NAME")));
45 if (tag
.HasParam("HREF")) {
46 wxString oldlnk
= m_WParser
-> GetLink();
47 wxColour oldclr
= m_WParser
-> GetActualColor();
48 int oldund
= m_WParser
-> GetFontUnderlined();
50 m_WParser
-> SetActualColor(m_WParser
-> GetLinkColor());
51 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser
-> GetLinkColor()));
52 m_WParser
-> SetFontUnderlined(TRUE
);
53 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
54 m_WParser
-> SetLink(tag
.GetParam("HREF"));
58 m_WParser
-> SetLink(oldlnk
);
59 m_WParser
-> SetFontUnderlined(oldund
);
60 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
61 m_WParser
-> SetActualColor(oldclr
);
62 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr
));
73 TAGS_MODULE_BEGIN(Links
)
77 TAGS_MODULE_END(Links
)