use 'I' cursor when over text
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -184,6 +184,9 @@ public:
|
|||||||
int WXUNUSED(y) = 0) const
|
int WXUNUSED(y) = 0) const
|
||||||
{ return m_Link; }
|
{ 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
|
// return next cell among parent's cells
|
||||||
wxHtmlCell *GetNext() const {return m_Next;}
|
wxHtmlCell *GetNext() const {return m_Next;}
|
||||||
// returns first child cell (if there are any, i.e. if this is container):
|
// returns first child cell (if there are any, i.e. if this is container):
|
||||||
@@ -329,6 +332,7 @@ public:
|
|||||||
wxHtmlWordCell(const wxString& word, wxDC& dc);
|
wxHtmlWordCell(const wxString& word, wxDC& dc);
|
||||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
|
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
|
||||||
wxHtmlRenderingInfo& info);
|
wxHtmlRenderingInfo& info);
|
||||||
|
wxCursor GetCursor() const;
|
||||||
wxString ConvertToText(wxHtmlSelection *sel) const;
|
wxString ConvertToText(wxHtmlSelection *sel) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -323,9 +323,6 @@ private:
|
|||||||
// this filter is used when no filter is able to read some file
|
// this filter is used when no filter is able to read some file
|
||||||
static wxHtmlFilter *m_DefaultFilter;
|
static wxHtmlFilter *m_DefaultFilter;
|
||||||
|
|
||||||
static wxCursor *s_cur_hand;
|
|
||||||
static wxCursor *s_cur_arrow;
|
|
||||||
|
|
||||||
wxHtmlHistoryArray *m_History;
|
wxHtmlHistoryArray *m_History;
|
||||||
// browser history
|
// browser history
|
||||||
int m_HistoryPos;
|
int m_HistoryPos;
|
||||||
|
@@ -30,8 +30,18 @@
|
|||||||
#include "wx/html/htmlcell.h"
|
#include "wx/html/htmlcell.h"
|
||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Global variables
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static wxCursor *gs_cursorLink = NULL;
|
||||||
|
static wxCursor *gs_cursorText = NULL;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Helper classes
|
// Helper classes
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -105,6 +115,18 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
bool wxHtmlCell::AdjustPagebreak(int *pagebreak, int* WXUNUSED(known_pagebreaks), int WXUNUSED(number_of_pages)) const
|
||||||
{
|
{
|
||||||
@@ -129,7 +151,6 @@ void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlCell::Layout(int WXUNUSED(w))
|
void wxHtmlCell::Layout(int WXUNUSED(w))
|
||||||
{
|
{
|
||||||
SetPos(0, 0);
|
SetPos(0, 0);
|
||||||
@@ -427,6 +448,18 @@ wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
|
|||||||
return m_Word;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1167,4 +1200,29 @@ const wxHtmlCell* wxHtmlTerminalCellsInterator::operator++()
|
|||||||
return m_pos;
|
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
|
#endif
|
||||||
|
@@ -691,8 +691,6 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
|
|||||||
|
|
||||||
wxList wxHtmlWindow::m_Filters;
|
wxList wxHtmlWindow::m_Filters;
|
||||||
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
||||||
wxCursor *wxHtmlWindow::s_cur_hand = NULL;
|
|
||||||
wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
|
|
||||||
wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
|
wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
|
||||||
|
|
||||||
void wxHtmlWindow::CleanUpStatics()
|
void wxHtmlWindow::CleanUpStatics()
|
||||||
@@ -701,8 +699,6 @@ void wxHtmlWindow::CleanUpStatics()
|
|||||||
m_Filters.DeleteContents(TRUE);
|
m_Filters.DeleteContents(TRUE);
|
||||||
m_Filters.Clear();
|
m_Filters.Clear();
|
||||||
wxDELETE(m_GlobalProcessors);
|
wxDELETE(m_GlobalProcessors);
|
||||||
wxDELETE(s_cur_hand);
|
|
||||||
wxDELETE(s_cur_arrow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -926,12 +922,6 @@ void wxHtmlWindow::OnMouseUp(wxMouseEvent& event)
|
|||||||
|
|
||||||
void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
|
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))
|
if (m_tmpMouseMoved && (m_Cell != NULL))
|
||||||
{
|
{
|
||||||
int xc, yc, x, y;
|
int xc, yc, x, y;
|
||||||
@@ -1023,19 +1013,23 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
|
|||||||
if ( cell != m_tmpLastCell )
|
if ( cell != m_tmpLastCell )
|
||||||
{
|
{
|
||||||
wxHtmlLinkInfo *lnk = cell ? cell->GetLink(x, y) : NULL;
|
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 != m_tmpLastLink)
|
||||||
{
|
{
|
||||||
if (lnk == NULL)
|
if (lnk == NULL)
|
||||||
{
|
{
|
||||||
SetCursor(*s_cur_arrow);
|
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame->SetStatusText(wxEmptyString,
|
m_RelatedFrame->SetStatusText(wxEmptyString,
|
||||||
m_RelatedStatusBar);
|
m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCursor(*s_cur_hand);
|
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame->SetStatusText(lnk->GetHref(),
|
m_RelatedFrame->SetStatusText(lnk->GetHref(),
|
||||||
m_RelatedStatusBar);
|
m_RelatedStatusBar);
|
||||||
|
Reference in New Issue
Block a user