Audacity  3.0.3
TrackButtonHandles.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 WavelTrackButtonHandles.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_BUTTON_HANDLES__
12 #define __AUDACITY_TRACK_BUTTON_HANDLES__
13 
14 #include "../ui/ButtonHandle.h"
15 
16 class wxMouseState;
17 
18 class MinimizeButtonHandle final : public ButtonHandle
19 {
21 
22 protected:
24  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
25  override;
26 
28  const wxMouseState &state, AudacityProject &) const override;
29 
30 public:
31  explicit MinimizeButtonHandle
32  ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
33 
35 
36  virtual ~MinimizeButtonHandle();
37 
38  static UIHandlePtr HitTest
39  (std::weak_ptr<MinimizeButtonHandle> &holder,
40  const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell);
41 };
42 
44 class SelectButtonHandle final : public ButtonHandle
45 {
47 
48 protected:
50  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
51  override;
52 
54  const wxMouseState &state, AudacityProject &) const override;
55 
56 public:
57  explicit SelectButtonHandle
58  ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
59 
61 
62  virtual ~SelectButtonHandle();
63 
64  static UIHandlePtr HitTest
65  (std::weak_ptr<SelectButtonHandle> &holder,
66  const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell);
67 };
68 
70 class CloseButtonHandle final : public ButtonHandle
71 {
73 
74 protected:
76  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
77  override;
78 
80  const wxMouseState &state, AudacityProject &project) const override;
81 
82  bool StopsOnKeystroke () override { return true; }
83 
84 public:
85  explicit CloseButtonHandle
86  ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
87 
89 
90  virtual ~CloseButtonHandle();
91 
92  static UIHandlePtr HitTest
93  (std::weak_ptr<CloseButtonHandle> &holder,
94  const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell);
95 };
96 
98 
99 class MenuButtonHandle final : public ButtonHandle
100 {
102 
103 protected:
105  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
106  override;
107 
109  const wxMouseState &state, AudacityProject &) const override;
110 
111 public:
112  explicit MenuButtonHandle
113  ( const std::shared_ptr<TrackPanelCell> &pCell,
114  const std::shared_ptr<Track> &pTrack, const wxRect &rect );
115 
117 
118  virtual ~MenuButtonHandle();
119 
120  static UIHandlePtr HitTest
121  (std::weak_ptr<MenuButtonHandle> &holder,
122  const wxMouseState &state, const wxRect &rect,
123  const std::shared_ptr<TrackPanelCell> &pCell);
124 
125 private:
126  std::weak_ptr<TrackPanelCell> mpCell;
127 };
128 
129 #endif
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
MenuButtonHandle::~MenuButtonHandle
virtual ~MenuButtonHandle()
Definition: TrackButtonHandles.cpp:215
MenuButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< MenuButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< TrackPanelCell > &pCell)
Definition: TrackButtonHandles.cpp:250
CloseButtonHandle::Tip
TranslatableString Tip(const wxMouseState &state, AudacityProject &project) const override
Definition: TrackButtonHandles.cpp:175
SelectButtonHandle::CommitChanges
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:96
CloseButtonHandle::CommitChanges
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:152
CloseButtonHandle::~CloseButtonHandle
virtual ~CloseButtonHandle()
Definition: TrackButtonHandles.cpp:147
MinimizeButtonHandle::operator=
MinimizeButtonHandle & operator=(const MinimizeButtonHandle &)=default
MenuButtonHandle::operator=
MenuButtonHandle & operator=(const MenuButtonHandle &)=default
MinimizeButtonHandle::MinimizeButtonHandle
MinimizeButtonHandle(const MinimizeButtonHandle &)=delete
MenuButtonHandle
Definition: TrackButtonHandles.h:100
SelectButtonHandle::~SelectButtonHandle
virtual ~SelectButtonHandle()
Definition: TrackButtonHandles.cpp:91
CloseButtonHandle::operator=
CloseButtonHandle & operator=(const CloseButtonHandle &)=default
SelectButtonHandle::Tip
TranslatableString Tip(const wxMouseState &state, AudacityProject &) const override
Definition: TrackButtonHandles.cpp:112
MenuButtonHandle::Tip
TranslatableString Tip(const wxMouseState &state, AudacityProject &) const override
Definition: TrackButtonHandles.cpp:235
CloseButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< CloseButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:190
ButtonHandle
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
MinimizeButtonHandle::Tip
TranslatableString Tip(const wxMouseState &state, AudacityProject &) const override
Definition: TrackButtonHandles.cpp:60
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
SelectButtonHandle::SelectButtonHandle
SelectButtonHandle(const SelectButtonHandle &)=delete
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
MenuButtonHandle::CommitChanges
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:220
CloseButtonHandle
Definition: TrackButtonHandles.h:71
TrackPanelCell
Definition: TrackPanelCell.h:74
MenuButtonHandle::MenuButtonHandle
MenuButtonHandle(const MenuButtonHandle &)=delete
MenuButtonHandle::mpCell
std::weak_ptr< TrackPanelCell > mpCell
Definition: TrackButtonHandles.h:126
SelectButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< SelectButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:124
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
SelectButtonHandle
Definition: TrackButtonHandles.h:45
CloseButtonHandle::CloseButtonHandle
CloseButtonHandle(const CloseButtonHandle &)=delete
MinimizeButtonHandle::~MinimizeButtonHandle
virtual ~MinimizeButtonHandle()
Definition: TrackButtonHandles.cpp:33
CloseButtonHandle::StopsOnKeystroke
bool StopsOnKeystroke() override
Definition: TrackButtonHandles.h:82
MinimizeButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< MinimizeButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:69
SelectButtonHandle::operator=
SelectButtonHandle & operator=(const SelectButtonHandle &)=default
MinimizeButtonHandle
Definition: TrackButtonHandles.h:19
MinimizeButtonHandle::CommitChanges
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:38