Audacity 3.2.0
NoteTrackButtonHandle.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5NoteTrackButtonHandle.h
6
7Paul Licameli split from TrackPanel.cpp
8
9**********************************************************************/
10
11#ifndef __AUDACITY_NOTE_TRACK_BUTTON_HANDLE__
12#define __AUDACITY_NOTE_TRACK_BUTTON_HANDLE__
13
14class wxMouseState;
15class NoteTrack;
16
17#include "../../../../UIHandle.h"
18
20// TODO: do appearance changes as in ButtonHandle, or even, inherit from that
22{
26
27public:
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 std::shared_ptr<const Track> FindTrack() const override;
43 int GetChannel() const { return mChannel; }
44
46 (const NoteTrackButtonHandle &oldState,
47 const NoteTrackButtonHandle &newState);
48
49protected:
50 void Enter(bool forward, AudacityProject *) override;
51
53 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
54
56 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
57
59 (const TrackPanelMouseState &state, 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::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
NoteTrackButtonHandle(const NoteTrackButtonHandle &)
static UIHandle::Result NeedChangeHighlight(const NoteTrackButtonHandle &oldState, const NoteTrackButtonHandle &newState)
std::shared_ptr< const Track > FindTrack() const override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
static NoteTrackButtonHandle & Instance()
NoteTrackButtonHandle & operator=(const NoteTrackButtonHandle &)=default
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::shared_ptr< NoteTrack > GetTrack() const
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void Enter(bool forward, AudacityProject *) override
std::weak_ptr< NoteTrack > mpTrack
Result Cancel(AudacityProject *pProject) override
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< NoteTrack > &pTrack)
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:37
unsigned Result
Definition: UIHandle.h:40