Added variable cursor to highlight embedded user data.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-04-13 13:45:59 +00:00
parent 4846abaf45
commit 0454d4ca74
2 changed files with 24 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE(wxLayoutWindow,wxScrolledWindow)
EVT_LEFT_DOWN(wxLayoutWindow::OnLeftMouseClick)
EVT_RIGHT_DOWN(wxLayoutWindow::OnRightMouseClick)
EVT_LEFT_DCLICK(wxLayoutWindow::OnMouseDblClick)
EVT_MOTION (wxLayoutWindow::OnMouseMove)
EVT_MENU_RANGE(WXLOWIN_MENU_FIRST, WXLOWIN_MENU_LAST, wxLayoutWindow::OnMenu)
EVT_SET_FOCUS(wxLayoutWindow::OnSetFocus)
EVT_KILL_FOCUS(wxLayoutWindow::OnKillFocus)
@@ -142,6 +143,24 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
wxLogDebug("wxLayoutWindow::OnMouse: Found no object.");
#endif
//has the mouse only been moved?
if(eventId == WXLOWIN_MENU_MOUSEMOVE)
{
if(obj && obj->GetUserData() != NULL)
{
if(!m_HandCursor)
SetCursor(wxCURSOR_HAND);
m_HandCursor = TRUE;
}
else
{
if(m_HandCursor)
SetCursor(wxCURSOR_IBEAM);
m_HandCursor = FALSE;
}
return;
}
// always move cursor to mouse click:
if(obj && eventId == WXLOWIN_MENU_LCLICK)
{

View File

@@ -38,7 +38,8 @@ enum
WXLOWIN_MENU_RCLICK,
WXLOWIN_MENU_LCLICK,
WXLOWIN_MENU_DBLCLICK,
WXLOWIN_MENU_LAST = WXLOWIN_MENU_DBLCLICK
WXLOWIN_MENU_MOUSEMOVE,
WXLOWIN_MENU_LAST = WXLOWIN_MENU_MOUSEMOVE
};
/**
@@ -131,6 +132,7 @@ public:
void OnLeftMouseClick(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_LCLICK, event); }
void OnRightMouseClick(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_RCLICK, event); }
void OnMouseDblClick(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_DBLCLICK, event); }
void OnMouseMove(wxMouseEvent &event) { OnMouse(WXLOWIN_MENU_MOUSEMOVE, event) ; }
void OnSetFocus(wxFocusEvent &ev);
void OnKillFocus(wxFocusEvent &ev);
//@}
@@ -170,6 +172,8 @@ protected:
bool m_DoPopupMenu;
/// Should InternalPaint() scroll to cursor.
bool m_ScrollToCursor;
/// Do we currently have a non-standard cursor?
bool m_HandCursor;
/// the menu
wxMenu * m_PopupMenu;
/// for derived classes, set when mouse is clicked