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:
Václav Slavík
2003-06-07 23:31:21 +00:00
parent 493ac0b8b5
commit 77bae5e228
4 changed files with 69 additions and 16 deletions

View File

@@ -30,8 +30,18 @@
#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
//-----------------------------------------------------------------------------
@@ -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
{
@@ -129,7 +151,6 @@ void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
}
void wxHtmlCell::Layout(int WXUNUSED(w))
{
SetPos(0, 0);
@@ -427,6 +448,18 @@ wxString wxHtmlWordCell::ConvertToText(wxHtmlSelection *s) const
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;
}
//-----------------------------------------------------------------------------
// 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