Audacity  3.0.3
NoteTrackButtonHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 NoteTrackButtonHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_NOTE_TRACK_BUTTON_HANDLE__
12 #define __AUDACITY_NOTE_TRACK_BUTTON_HANDLE__
13 
14 class wxMouseState;
15 class NoteTrack;
16 
17 #include "../../../../UIHandle.h"
18 
20 // TODO: do appearance changes as in ButtonHandle, or even, inherit from that
22 {
26 
27 public:
28  explicit NoteTrackButtonHandle
29  ( const std::shared_ptr<NoteTrack> &pTrack,
30  int channel, const wxRect &rect );
31 
33 
34  virtual ~NoteTrackButtonHandle();
35 
36  static UIHandlePtr HitTest
37  (std::weak_ptr<NoteTrackButtonHandle> &holder,
38  const wxMouseState &state, const wxRect &rect,
39  const std::shared_ptr<NoteTrack> &pTrack);
40 
41  std::shared_ptr<NoteTrack> GetTrack() const { return mpTrack.lock(); }
42  int GetChannel() const { return mChannel; }
43 
45  (const NoteTrackButtonHandle &oldState,
46  const NoteTrackButtonHandle &newState);
47 
48 protected:
49  void Enter(bool forward, AudacityProject *) override;
50 
52  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
53 
54  Result Drag
55  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
56 
58  (const TrackPanelMouseState &state, AudacityProject *pProject)
59  override;
60 
62  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
63  wxWindow *pParent) override;
64 
65  Result Cancel(AudacityProject *pProject) override;
66 
67  std::weak_ptr<NoteTrack> mpTrack;
68  int mChannel{ -1 };
69  wxRect mRect{};
70 };
71 
72 #endif
NoteTrackButtonHandle::NoteTrackButtonHandle
NoteTrackButtonHandle()
NoteTrackButtonHandle::operator=
NoteTrackButtonHandle & operator=(const NoteTrackButtonHandle &)=default
NoteTrackButtonHandle::GetTrack
std::shared_ptr< NoteTrack > GetTrack() const
Definition: NoteTrackButtonHandle.h:41
UIHandle
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:35
NoteTrackButtonHandle::Drag
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:78
NoteTrackButtonHandle::Preview
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:84
NoteTrackButtonHandle::mpTrack
std::weak_ptr< NoteTrack > mpTrack
Definition: NoteTrackButtonHandle.h:67
NoteTrackButtonHandle::mChannel
int mChannel
Definition: NoteTrackButtonHandle.h:68
NoteTrackButtonHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:72
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
NoteTrackButtonHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: NoteTrackButtonHandle.cpp:95
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
NoteTrackButtonHandle::~NoteTrackButtonHandle
virtual ~NoteTrackButtonHandle()
Definition: NoteTrackButtonHandle.cpp:38
HitTestPreview
Definition: HitTestResult.h:20
NoteTrackButtonHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:113
NoteTrackButtonHandle::Enter
void Enter(bool forward, AudacityProject *) override
Definition: NoteTrackButtonHandle.cpp:33
NoteTrackButtonHandle::NoteTrackButtonHandle
NoteTrackButtonHandle(const NoteTrackButtonHandle &)
NoteTrackButtonHandle::mRect
wxRect mRect
Definition: NoteTrackButtonHandle.h:69
NoteTrackButtonHandle::Instance
static NoteTrackButtonHandle & Instance()
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
NoteTrackButtonHandle::NeedChangeHighlight
static UIHandle::Result NeedChangeHighlight(const NoteTrackButtonHandle &oldState, const NoteTrackButtonHandle &newState)
Definition: NoteTrackButtonHandle.cpp:43
NoteTrackButtonHandle::GetChannel
int GetChannel() const
Definition: NoteTrackButtonHandle.h:42
NoteTrackButtonHandle
Definition: NoteTrackButtonHandle.h:22
NoteTrackButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< NoteTrack > &pTrack)
Definition: NoteTrackButtonHandle.cpp:52
NoteTrack
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:67