]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_links.cpp
c4a7107d89989edb2b0eb8b2df449f78757f8dba
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtml module for links & anchors
4 // Author: Vaclav Slavik
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows Licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation
14 #include <wx/wxprec.h>
27 #include "wx/html/forcelnk.h"
28 #include "wx/html/m_templ.h"
31 FORCE_LINK_ME(mod_links
)
34 class wxHtmlAnchorCell
: public wxHtmlCell
37 wxString m_AnchorName
;
40 wxHtmlAnchorCell(const wxString
& name
) : wxHtmlCell() {m_AnchorName
= name
;}
41 virtual const wxHtmlCell
* Find(int condition
, const void* param
) const
43 if ((condition
== wxHTML_COND_ISANCHOR
) && (m_AnchorName
== (*((const wxString
*)param
))))
46 return wxHtmlCell::Find(condition
, param
);
52 TAG_HANDLER_BEGIN(A
, "A")
56 if (tag
.HasParam("NAME")) {
57 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag
.GetParam("NAME")));
60 if (tag
.HasParam("HREF")) {
61 wxString oldlnk
= m_WParser
-> GetLink();
62 wxColour oldclr
= m_WParser
-> GetActualColor();
63 int oldund
= m_WParser
-> GetFontUnderlined();
65 m_WParser
-> SetActualColor(m_WParser
-> GetLinkColor());
66 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser
-> GetLinkColor()));
67 m_WParser
-> SetFontUnderlined(TRUE
);
68 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
69 m_WParser
-> SetLink(tag
.GetParam("HREF"));
73 m_WParser
-> SetLink(oldlnk
);
74 m_WParser
-> SetFontUnderlined(oldund
);
75 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser
-> CreateCurrentFont()));
76 m_WParser
-> SetActualColor(oldclr
);
77 m_WParser
-> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr
));
88 TAGS_MODULE_BEGIN(Links
)
92 TAGS_MODULE_END(Links
)