1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackPanelMouseEvent.h
6 
7 Paul Licameli
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_PANEL_MOUSE_EVENT__
12 #define __AUDACITY_TRACK_PANEL_MOUSE_EVENT__
13 
14 class wxMouseEvent;
15 class wxMouseState;
16 class wxRect;
17 class wxSize;
18 class TrackPanelCell;
19 #include <memory>
20 
21 // This is a hack so that the code that fakes a MOUSE_LEFT_BTN_UP on
22 // capture lost doesn't get in the way of handling MOUSE_RIGHT_BTN_UP.
23 const int kCaptureLostEventId = 19019;
24 
25 // Augment a mouse state with information about which track panel cell and
26 // sub-rectangle was hit.
27 struct TrackPanelMouseState
28 {
TrackPanelMouseStateTrackPanelMouseState29    TrackPanelMouseState
30       ( wxMouseState &state_, const wxRect &rect_,
31         const std::shared_ptr<TrackPanelCell> &pCell_ )
32       : state{ state_ }
33       , rect{ rect_ }
34       , pCell{ pCell_ }
35    {
36    }
37 
38    wxMouseState &state;
39    const wxRect &rect;
40    std::shared_ptr<TrackPanelCell> pCell; // may be NULL
41 };
42 
43 // Augment a mouse event with information about which track panel cell and
44 // sub-rectangle was hit.
45 struct TrackPanelMouseEvent
46 {
TrackPanelMouseEventTrackPanelMouseEvent47    TrackPanelMouseEvent
48       ( wxMouseEvent &event_, const wxRect &rect_, const wxSize &whole_,
49         const std::shared_ptr<TrackPanelCell> &pCell_ )
50       : event{ event_ }
51       , rect{ rect_ }
52       , whole{ whole_ }
53       , pCell{ pCell_ }
54       , steps{ 0 }
55    {
56    }
57 
58    wxMouseEvent &event;
59    const wxRect &rect;
60    const wxSize &whole;
61    std::shared_ptr<TrackPanelCell> pCell; // may be NULL
62    double steps;  // for mouse wheel rotation
63 };
64 
65 #endif
66