Audacity  2.2.0
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 <wx/gdicmn.h>
18 #include "../../../../MemoryX.h"
19 #include "../../../../UIHandle.h"
20 
22 // TODO: do appearance changes as in ButtonHandle, or even, inherit from that
24 {
28 
29 public:
30  explicit NoteTrackButtonHandle
31  ( const std::shared_ptr<NoteTrack> &pTrack,
32  int channel, const wxRect &rect );
33 
35 
36  virtual ~NoteTrackButtonHandle();
37 
38  static UIHandlePtr HitTest
39  (std::weak_ptr<NoteTrackButtonHandle> &holder,
40  const wxMouseState &state, const wxRect &rect,
41  const std::shared_ptr<NoteTrack> &pTrack);
42 
43  int GetChannel() const { return mChannel; }
44 
46  (const NoteTrackButtonHandle &oldState,
47  const NoteTrackButtonHandle &newState);
48 
49 protected:
50  void Enter(bool forward) override;
51 
53  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
54 
55  Result Drag
56  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
57 
59  (const TrackPanelMouseState &state, const AudacityProject *pProject)
60  override;
61 
63  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
64  wxWindow *pParent) override;
65 
66  Result Cancel(AudacityProject *pProject) override;
67 
68  std::weak_ptr<NoteTrack> mpTrack;
69  int mChannel{ -1 };
70  wxRect mRect{};
71 };
72 
73 #endif
std::weak_ptr< NoteTrack > mpTrack
Definition: NoteTrackButtonHandle.h:68
int GetChannel() const
Definition: NoteTrackButtonHandle.h:43
virtual ~NoteTrackButtonHandle()
Definition: NoteTrackButtonHandle.cpp:35
Definition: NoteTrackButtonHandle.h:23
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:76
static NoteTrackButtonHandle & Instance()
Definition: TrackPanelMouseEvent.h:23
int mChannel
Definition: NoteTrackButtonHandle.h:69
Result Cancel(AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:111
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
unsigned Result
Definition: UIHandle.h:37
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: NoteTrackButtonHandle.cpp:93
void Enter(bool forward) override
Definition: NoteTrackButtonHandle.cpp:30
wxRect mRect
Definition: NoteTrackButtonHandle.h:70
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:70
NoteTrackButtonHandle & operator=(const NoteTrackButtonHandle &)=default
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: NoteTrackButtonHandle.cpp:82
Definition: UIHandle.h:33
Definition: HitTestResult.h:19
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< NoteTrack > &pTrack)
Definition: NoteTrackButtonHandle.cpp:49
static UIHandle::Result NeedChangeHighlight(const NoteTrackButtonHandle &oldState, const NoteTrackButtonHandle &newState)
Definition: NoteTrackButtonHandle.cpp:40
Definition: TrackPanelMouseEvent.h:41
A Track that is used for Midi notes. (Somewhat old code).