]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlcell.cpp
Include wx/stream.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / html / htmlcell.cpp
index 1b111b9aca04a98312dbe2d57f4415a8d46c299e..ace347c57a0e7e0fb619503a150fedd91efe4b36 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        htmlcell.cpp
+// Name:        src/html/htmlcell.cpp
 // Purpose:     wxHtmlCell - basic element of HTML output
 // Author:      Vaclav Slavik
 // RCS-ID:      $Id$
@@ -9,15 +9,14 @@
 
 #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
 //-----------------------------------------------------------------------------
@@ -198,17 +188,34 @@ void wxHtmlCell::OnMouseClick(wxWindow *, int, int, const wxMouseEvent& event)
 #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);
+    }
 }
 
 
@@ -607,16 +614,16 @@ wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
     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);
+    }
 }
 
 
@@ -1140,7 +1147,7 @@ void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale
         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);
@@ -1558,29 +1565,4 @@ const wxHtmlCell* wxHtmlTerminalCellsInterator::operator++()
     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