Audacity 3.2.0
ButtonHandle.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5ButtonHandle.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_BUTTON_HANDLE__
12#define __AUDACITY_BUTTON_HANDLE__
13
14#include "../../UIHandle.h"
15
16class wxMouseEvent;
17class wxMouseState;
18
19class Track;
21
22
25class AUDACITY_DLL_API ButtonHandle /* not final */ : public UIHandle
26{
27 ButtonHandle(const ButtonHandle&) = delete;
28
29public:
30 std::shared_ptr<Track> GetTrack() const { return mpTrack.lock(); }
31 bool IsClicked() const { return mIsClicked; }
32
33protected:
34 explicit ButtonHandle
35 ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
36
38
39 virtual ~ButtonHandle();
40
41 // This NEW abstract virtual simplifies the duties of further subclasses.
42 // This class will decide whether to refresh the clicked cell for button state
43 // change.
44 // Subclass can decide to refresh other things and the results will be ORed.
46 (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) = 0;
47
48 // Define a message for the status bar and tooltip.
50 const wxMouseState &state, AudacityProject &project) const = 0;
51
52 void Enter(bool forward, AudacityProject *) final override;
53
55 (const TrackPanelMouseEvent &event, AudacityProject *pProject)
56 final override;
57
59 (const TrackPanelMouseEvent &event, AudacityProject *pProject)
60 final override;
61
63 (const TrackPanelMouseState &state, AudacityProject *pProject)
64 final override;
65
67 (const TrackPanelMouseEvent &event, AudacityProject *pProject,
68 wxWindow *pParent) final override;
69
70 Result Cancel(AudacityProject *pProject) final override;
71
72 std::weak_ptr<Track> mpTrack;
73 wxRect mRect;
74 bool mWasIn{ true };
75 bool mIsClicked{};
76};
77
78#endif
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:72
ButtonHandle(const ButtonHandle &)=delete
virtual Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
virtual TranslatableString Tip(const wxMouseState &state, AudacityProject &project) const =0
wxRect mRect
Definition: ButtonHandle.h:73
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
ButtonHandle & operator=(const ButtonHandle &)=default
bool IsClicked() const
Definition: ButtonHandle.h:31
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
Holds a msgid for the translation catalog; may also bind format arguments.
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:35
virtual void Enter(bool forward, AudacityProject *pProject)
Definition: UIHandle.cpp:20
virtual Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
virtual Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
unsigned Result
Definition: UIHandle.h:38
virtual HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject)=0
virtual Result Cancel(AudacityProject *pProject)=0
virtual Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0