]>
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 /////////////////////////////////////////////////////////////////////////////
10 #pragma implementation
13 #include <wx/wxprec.h>
26 #include <wx/html/forcelink.h>
27 #include <wx/html/mod_templ.h>
30 FORCE_LINK_ME(mod_links
)
33 class wxHtmlAnchorCell
: public wxHtmlCell
36 wxString m_AnchorName
;
39 wxHtmlAnchorCell(const wxString
& name
) : wxHtmlCell() {m_AnchorName
= name
;}
40 virtual const wxHtmlCell
* Find(int condition
, const void* param
) const
42 if ((condition
== HTML_COND_ISANCHOR
) && (m_AnchorName
== (*((const wxString
*)param
))))
45 return wxHtmlCell::Find(condition
, param
);
51 TAG_HANDLER_BEGIN(A
, "A")
55 if (tag
.HasParam("NAME")) {
56 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag
.GetParam("NAME")));
59 if (tag
.HasParam("HREF")) {
60 wxString oldlnk
= m_WParser
-> GetLink();
61 wxColour oldclr
= m_WParser
-> GetActualColor();
62 int oldund
= m_WParser
-> GetFontUnderlined();
64 m_WParser
-> SetActualColor(m_WParser
-> GetLinkColor());
65 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser
-> GetLinkColor()));
66 m_WParser
-> SetFontUnderlined(TRUE
);
67 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
68 m_WParser
-> SetLink(tag
.GetParam("HREF"));
72 m_WParser
-> SetLink(oldlnk
);
73 m_WParser
-> SetFontUnderlined(oldund
);
74 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
75 m_WParser
-> SetActualColor(oldclr
);
76 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr
));
87 TAGS_MODULE_BEGIN(Links
)
91 TAGS_MODULE_END(Links
)