int WXUNUSED(y) = 0) const
{ return m_Link; }
+ // Returns cursor to be used when mouse is over the cell:
+ virtual wxCursor GetCursor() const;
+
// return next cell among parent's cells
wxHtmlCell *GetNext() const {return m_Next;}
// returns first child cell (if there are any, i.e. if this is container):
wxHtmlWordCell(const wxString& word, wxDC& dc);
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
wxHtmlRenderingInfo& info);
+ wxCursor GetCursor() const;
wxString ConvertToText(wxHtmlSelection *sel) const;
protected:
// this filter is used when no filter is able to read some file
static wxHtmlFilter *m_DefaultFilter;
- static wxCursor *s_cur_hand;
- static wxCursor *s_cur_arrow;
-
wxHtmlHistoryArray *m_History;
// browser history
int m_HistoryPos;
#include "wx/html/htmlcell.h"
#include "wx/html/htmlwin.h"
#include "wx/settings.h"
+#include "wx/module.h"
+
#include <stdlib.h>
+//-----------------------------------------------------------------------------
+// Global variables
+//-----------------------------------------------------------------------------
+
+static wxCursor *gs_cursorLink = NULL;
+static wxCursor *gs_cursorText = NULL;
+
+
//-----------------------------------------------------------------------------
// Helper classes
//-----------------------------------------------------------------------------
}
+wxCursor wxHtmlCell::GetCursor() const
+{
+ if ( GetLink() )
+ {
+ if ( !gs_cursorLink )
+ gs_cursorLink = new wxCursor(wxCURSOR_HAND);
+ return *gs_cursorLink;
+ }
+ else
+ return *wxSTANDARD_CURSOR;
+}
+
bool wxHtmlCell::AdjustPagebreak(int *pagebreak, int* WXUNUSED(known_pagebreaks), int WXUNUSED(number_of_pages)) const
{
}
-
void wxHtmlCell::Layout(int WXUNUSED(w))
{
SetPos(0, 0);
return m_Word;
}
+wxCursor wxHtmlWordCell::GetCursor() const
+{
+ if ( !GetLink() )
+ {
+ if ( !gs_cursorText )
+ gs_cursorText = new wxCursor(wxCURSOR_IBEAM);
+ return *gs_cursorText;
+ }
+ else
+ return wxHtmlCell::GetCursor();
+}
+
//-----------------------------------------------------------------------------
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
wxList wxHtmlWindow::m_Filters;
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
-wxCursor *wxHtmlWindow::s_cur_hand = NULL;
-wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
void wxHtmlWindow::CleanUpStatics()
m_Filters.DeleteContents(TRUE);
m_Filters.Clear();
wxDELETE(m_GlobalProcessors);
- wxDELETE(s_cur_hand);
- wxDELETE(s_cur_arrow);
}
void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
{
- if (s_cur_hand == NULL)
- {
- s_cur_hand = new wxCursor(wxCURSOR_HAND);
- s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
- }
-
if (m_tmpMouseMoved && (m_Cell != NULL))
{
int xc, yc, x, y;
if ( cell != m_tmpLastCell )
{
wxHtmlLinkInfo *lnk = cell ? cell->GetLink(x, y) : NULL;
+ wxCursor cur;
+ if (cell)
+ cur = cell->GetCursor();
+ else
+ cur = *wxSTANDARD_CURSOR;
+ SetCursor(cur);
if (lnk != m_tmpLastLink)
{
if (lnk == NULL)
{
- SetCursor(*s_cur_arrow);
if (m_RelatedStatusBar != -1)
m_RelatedFrame->SetStatusText(wxEmptyString,
m_RelatedStatusBar);
}
else
{
- SetCursor(*s_cur_hand);
if (m_RelatedStatusBar != -1)
m_RelatedFrame->SetStatusText(lnk->GetHref(),
m_RelatedStatusBar);