Audacity 3.2.0
HighlitClipButtonHandle.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 HighlitClipButtonHandle.h
7
8 A `UIHandle` implementation to interact with the clip buttons when they are
9 highlit, i.e., when the mouse hovers over them.
10
11 Matthieu Hodgkinson
12
13**********************************************************************/
14#pragma once
15
16#include "ClipButtonId.h"
17#include "UIHandle.h"
18#include "WaveTrack.h"
19#include <functional>
20
21class wxRect;
22class wxPoint;
23class Channel;
25class AudacityProject;
26class wxWindow;
28
29class HighlitClipButtonHandle /* not final */ : public UIHandle
30{
31public:
33 ClipButtonId id, std::shared_ptr<WaveTrack> track,
34 std::shared_ptr<WaveTrack::Interval> clip);
35
36 void Enter(bool forward, AudacityProject* pProject) override;
37
38 void Draw(
39 TrackPanelDrawingContext& context, const wxRect& rect,
40 unsigned iPass) override;
41
42 Result
43 Click(const TrackPanelMouseEvent& event, AudacityProject* pProject) override;
44
45 Result
46 Drag(const TrackPanelMouseEvent& event, AudacityProject* pProject) override;
47
48 Result Cancel(AudacityProject* pProject) override;
49
50 std::shared_ptr<const Track> FindTrack() const override;
51
53 const TrackPanelMouseEvent& event, AudacityProject* pProject,
54 wxWindow* pParent) override;
55
56 virtual void DoDraw(const wxRect& args, wxDC& dc) = 0;
57
58protected:
60 const TrackPanelMouseEvent& event, AudacityProject* pProject,
61 wxWindow* pParent) = 0;
62
64 const TrackPanelMouseEvent& event, AudacityProject* pProject);
65
68
70 std::shared_ptr<WaveTrack> mTrack;
71 std::shared_ptr<WaveTrack::Interval> mClip;
72
73private:
74 static void Highlight(const wxRect& rect, wxDC& dc);
75 std::weak_ptr<TrackPanelCell> mwCell;
76};
ClipButtonId
Definition: ClipButtonId.h:14
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
HighlitClipButtonHandle(ClipButtonId id, std::shared_ptr< WaveTrack > track, std::shared_ptr< WaveTrack::Interval > clip)
virtual Result DoRelease(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
std::shared_ptr< WaveTrack > mTrack
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
UIHandle::Result SelectAt(const TrackPanelMouseEvent &event, AudacityProject *project)
static void Highlight(const wxRect &rect, wxDC &dc)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::weak_ptr< TrackPanelCell > mwCell
std::shared_ptr< WaveTrack::Interval > mClip
void Enter(bool forward, AudacityProject *pProject) override
virtual void DoDraw(const wxRect &args, wxDC &dc)=0
std::shared_ptr< const Track > FindTrack() const override
Result Cancel(AudacityProject *pProject) override
UIHandle::Result UpdateTrackSelection(const TrackPanelMouseEvent &event, AudacityProject *pProject)
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:37
unsigned Result
Definition: UIHandle.h:40