]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_links.cpp
c3220d063bb216aad0d94ef86c523fd7c5d5665a
   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" 
  28 #include "wx/html/forcelnk.h" 
  29 #include "wx/html/m_templ.h" 
  32 FORCE_LINK_ME(m_links
) 
  35 class wxHtmlAnchorCell 
: public wxHtmlCell
 
  38         wxString m_AnchorName
; 
  41         wxHtmlAnchorCell(const wxString
& name
) : wxHtmlCell() {m_AnchorName 
= name
;} 
  42         virtual const wxHtmlCell
* Find(int condition
, const void* param
) const 
  44             if ((condition 
== wxHTML_COND_ISANCHOR
) && (m_AnchorName 
== (*((const wxString
*)param
)))) 
  47                 return wxHtmlCell::Find(condition
, param
); 
  53 TAG_HANDLER_BEGIN(A
, "A") 
  57         if (tag
.HasParam("NAME")) { 
  58             m_WParser 
-> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag
.GetParam("NAME"))); 
  61         if (tag
.HasParam("HREF")) { 
  62             wxString oldlnk 
= m_WParser 
-> GetLink(); 
  63             wxColour oldclr 
= m_WParser 
-> GetActualColor(); 
  64             int oldund 
= m_WParser 
-> GetFontUnderlined(); 
  66             m_WParser 
-> SetActualColor(m_WParser 
-> GetLinkColor()); 
  67             m_WParser 
-> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser 
-> GetLinkColor())); 
  68             m_WParser 
-> SetFontUnderlined(TRUE
); 
  69             m_WParser 
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser 
-> CreateCurrentFont())); 
  70             m_WParser 
-> SetLink(tag
.GetParam("HREF")); 
  74             m_WParser 
-> SetLink(oldlnk
); 
  75             m_WParser 
-> SetFontUnderlined(oldund
); 
  76             m_WParser 
-> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser 
-> CreateCurrentFont())); 
  77             m_WParser 
-> SetActualColor(oldclr
); 
  78             m_WParser 
-> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr
)); 
  89 TAGS_MODULE_BEGIN(Links
) 
  93 TAGS_MODULE_END(Links
)