]> git.saurik.com Git - wxWidgets.git/commitdiff
Added variable cursor to highlight embedded user data.
authorKarsten Ballüder <ballueder@usa.net>
Tue, 13 Apr 1999 13:45:59 +0000 (13:45 +0000)
committerKarsten Ballüder <ballueder@usa.net>
Tue, 13 Apr 1999 13:45:59 +0000 (13:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

user/wxLayout/wxlwindow.cpp
user/wxLayout/wxlwindow.h

index 921d58fc0de17103652f93fde099a857c4a1bc5f..fddc16148645fbf1c7a235a71ba6c51faa8d8590 100644 (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)
    {
index 98d0d61903362d126d2ca04dfeafeea4550486a9..0cce930123000659f7bee4b3bc5f99942a0a7bae 100644 (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