mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
... So this can be called more than once in its lifetime, in response to TAB key rotation.
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
ButtonHandle.h
|
|
|
|
Paul Licameli
|
|
|
|
**********************************************************************/
|
|
|
|
#ifndef __AUDACITY_BUTTON_HANDLE__
|
|
#define __AUDACITY_BUTTON_HANDLE__
|
|
|
|
#include "../../UIHandle.h"
|
|
#include "../../MemoryX.h"
|
|
|
|
class wxMouseEvent;
|
|
#include <wx/gdicmn.h>
|
|
|
|
class Track;
|
|
|
|
class ButtonHandle /* not final */ : public UIHandle
|
|
{
|
|
ButtonHandle(const ButtonHandle&) = delete;
|
|
|
|
public:
|
|
std::shared_ptr<Track> GetTrack() const { return mpTrack.lock(); }
|
|
bool IsClicked() const { return mIsClicked; }
|
|
|
|
protected:
|
|
explicit ButtonHandle
|
|
( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
|
|
|
|
ButtonHandle &operator=(const ButtonHandle&) = default;
|
|
|
|
virtual ~ButtonHandle();
|
|
|
|
// This new abstract virtual simplifies the duties of further subclasses.
|
|
// This class will decide whether to refresh the clicked cell for button state
|
|
// change.
|
|
// Subclass can decide to refresh other things and the results will be ORed.
|
|
virtual Result CommitChanges
|
|
(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) = 0;
|
|
|
|
void Enter() override;
|
|
|
|
Result Click
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
|
|
Result Drag
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
|
|
HitTestPreview Preview
|
|
(const TrackPanelMouseState &state, const AudacityProject *pProject)
|
|
override;
|
|
|
|
Result Release
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
|
wxWindow *pParent) override;
|
|
|
|
Result Cancel(AudacityProject *pProject) override;
|
|
|
|
std::weak_ptr<Track> mpTrack;
|
|
wxRect mRect;
|
|
bool mWasIn{ true };
|
|
bool mIsClicked{};
|
|
};
|
|
|
|
#endif
|