/////////////////////////////////////////////////////////////////////////////
-// Name: htmlcell.cpp
+// Name: src/html/htmlcell.cpp
// Purpose: wxHtmlCell - basic element of HTML output
// Author: Vaclav Slavik
// RCS-ID: $Id$
#include "wx/wxprec.h"
-#include "wx/defs.h"
-
-#if wxUSE_HTML && wxUSE_STREAMS
-
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
+#if wxUSE_HTML && wxUSE_STREAMS
+
#ifndef WXPRECOMP
+ #include "wx/dynarray.h"
#include "wx/brush.h"
#include "wx/colour.h"
#include "wx/dc.h"
#include "wx/html/htmlwin.h"
#include "wx/settings.h"
#include "wx/module.h"
-#include "wx/dynarray.h"
#include <stdlib.h>
-//-----------------------------------------------------------------------------
-// Global variables
-//-----------------------------------------------------------------------------
-
-static wxCursor *gs_cursorLink = NULL;
-static wxCursor *gs_cursorText = NULL;
-
-
//-----------------------------------------------------------------------------
// Helper classes
//-----------------------------------------------------------------------------
#endif // WXWIN_COMPATIBILITY_2_6
}
-
+#if WXWIN_COMPATIBILITY_2_6
wxCursor wxHtmlCell::GetCursor() const
{
+ return wxNullCursor;
+}
+#endif // WXWIN_COMPATIBILITY_2_6
+
+wxCursor wxHtmlCell::GetMouseCursor(wxHtmlWindowInterface *window) const
+{
+#if WXWIN_COMPATIBILITY_2_6
+ // NB: Older versions of wx used GetCursor() virtual method in place of
+ // GetMouseCursor(interface). This code ensures that user code that
+ // overriden GetCursor() continues to work. The trick is that the base
+ // wxHtmlCell::GetCursor() method simply returns wxNullCursor, so we
+ // know that GetCursor() was overriden iff it returns valid cursor.
+ wxCursor cur = GetCursor();
+ if (cur.Ok())
+ return cur;
+#endif // WXWIN_COMPATIBILITY_2_6
+
if ( GetLink() )
{
- if ( !gs_cursorLink )
- gs_cursorLink = new wxCursor(wxCURSOR_HAND);
- return *gs_cursorLink;
+ return window->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Link);
}
else
- return *wxSTANDARD_CURSOR;
+ {
+ return window->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Default);
+ }
}
return m_Word;
}
-wxCursor wxHtmlWordCell::GetCursor() const
+wxCursor wxHtmlWordCell::GetMouseCursor(wxHtmlWindowInterface *window) const
{
if ( !GetLink() )
{
- if ( !gs_cursorText )
- gs_cursorText = new wxCursor(wxCURSOR_IBEAM);
- return *gs_cursorText;
+ return window->GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor_Text);
}
else
- return wxHtmlCell::GetCursor();
+ {
+ return wxHtmlCell::GetMouseCursor(window);
+ }
}
int wdi;
wxString wd = tag.GetParam(wxT("WIDTH"));
- if (wd[wd.Length()-1] == wxT('%'))
+ if (wd[wd.length()-1] == wxT('%'))
{
wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
return m_pos;
}
-
-
-
-
-
-
-//-----------------------------------------------------------------------------
-// Cleanup
-//-----------------------------------------------------------------------------
-
-class wxHtmlCellModule: public wxModule
-{
-DECLARE_DYNAMIC_CLASS(wxHtmlCellModule)
-public:
- wxHtmlCellModule() : wxModule() {}
- bool OnInit() { return true; }
- void OnExit()
- {
- wxDELETE(gs_cursorLink);
- wxDELETE(gs_cursorText);
- }
-};
-
-IMPLEMENT_DYNAMIC_CLASS(wxHtmlCellModule, wxModule)
-
#endif