Audacity  2.2.2
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  std::shared_ptr<NoteTrack> GetTrack() const { return mpTrack.lock(); }
44  int GetChannel() const { return mChannel; }
45 
47  (const NoteTrackButtonHandle &oldState,
48  const NoteTrackButtonHandle &newState);
49 
50 protected:
51  void Enter(bool forward) override;
52 
54  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
55 
56  Result Drag
57  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
58 
60  (const TrackPanelMouseState &state, const AudacityProject *pProject)
61  override;
62 
64  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
65  wxWindow *pParent) override;
66 
67  Result Cancel(AudacityProject *pProject) override;
68 
69  std::weak_ptr<NoteTrack> mpTrack;
70  int mChannel{ -1 };
71  wxRect mRect{};
72 };
73 
74 #endif
std::weak_ptr< NoteTrack > mpTrack
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Cancel(AudacityProject *pProject) override
static NoteTrackButtonHandle & Instance()
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< NoteTrack > &pTrack)
static UIHandle::Result NeedChangeHighlight(const NoteTrackButtonHandle &oldState, const NoteTrackButtonHandle &newState)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::shared_ptr< NoteTrack > GetTrack() const
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
unsigned Result
Definition: UIHandle.h:37
void Enter(bool forward) override
virtual ~NoteTrackButtonHandle()
NoteTrackButtonHandle & operator=(const NoteTrackButtonHandle &)=default
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
A Track that is used for Midi notes. (Somewhat old code).