]> git.saurik.com Git - wxWidgets.git/blame - src/html/m_links.cpp
Updated configure (not only configure.in)
[wxWidgets.git] / src / html / m_links.cpp
CommitLineData
5526e819
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: mod_links.cpp
3// Purpose: wxHtml module for links & anchors
4// Author: Vaclav Slavik
69941f05 5// RCS-ID: $Id$
5526e819
VS
6// Copyright: (c) 1999 Vaclav Slavik
7// Licence: wxWindows Licence
8/////////////////////////////////////////////////////////////////////////////
9
3364ab79
RS
10#ifdef __GNUG__
11#pragma implementation
12#endif
13
14#include <wx/wxprec.h>
15
5526e819
VS
16#if wxUSE_HTML
17
3364ab79
RS
18#ifdef __BORDLANDC__
19#pragma hdrstop
20#endif
21
22#ifndef WXPRECOMP
23#include <wx/wx.h>
24#endif
25
26
69941f05
VS
27#include "wx/html/forcelnk.h"
28#include "wx/html/m_templ.h"
f42b1601 29
5526e819
VS
30
31FORCE_LINK_ME(mod_links)
32
33
34class wxHtmlAnchorCell : public wxHtmlCell
35{
36 private:
37 wxString m_AnchorName;
f42b1601 38
5526e819
VS
39 public:
40 wxHtmlAnchorCell(const wxString& name) : wxHtmlCell() {m_AnchorName = name;}
41 virtual const wxHtmlCell* Find(int condition, const void* param) const
42 {
43 if ((condition == HTML_COND_ISANCHOR) && (m_AnchorName == (*((const wxString*)param))))
44 return this;
f42b1601 45 else
5526e819 46 return wxHtmlCell::Find(condition, param);
f42b1601 47 }
5526e819
VS
48};
49
50
51
52TAG_HANDLER_BEGIN(A, "A")
53
54 TAG_HANDLER_PROC(tag)
55 {
56 if (tag.HasParam("NAME")) {
57 m_WParser -> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
58 }
f42b1601 59
5526e819
VS
60 if (tag.HasParam("HREF")) {
61 wxString oldlnk = m_WParser -> GetLink();
62 wxColour oldclr = m_WParser -> GetActualColor();
63 int oldund = m_WParser -> GetFontUnderlined();
64
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"));
70
71 ParseInner(tag);
72
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));
78
79 return TRUE;
80 }
81 else return FALSE;
82 }
83
84TAG_HANDLER_END(A)
85
86
87
88TAGS_MODULE_BEGIN(Links)
89
90 TAGS_MODULE_ADD(A)
91
92TAGS_MODULE_END(Links)
93
94
95#endif