Audacity  2.2.0
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 
27  wxString Tip(const wxMouseState &state) const override;
28 
29 public:
30  explicit MinimizeButtonHandle
31  ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
32 
34 
35  virtual ~MinimizeButtonHandle();
36 
37  static UIHandlePtr HitTest
38  (std::weak_ptr<MinimizeButtonHandle> &holder,
39  const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell);
40 };
41 
43 
44 class CloseButtonHandle final : public ButtonHandle
45 {
46  CloseButtonHandle(const CloseButtonHandle&) = delete;
47 
48 protected:
50  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
51  override;
52 
53  wxString Tip(const wxMouseState &state) const override;
54 
55  bool StopsOnKeystroke () override { return true; }
56 
57 public:
58  explicit CloseButtonHandle
59  ( const std::shared_ptr<Track> &pTrack, const wxRect &rect );
60 
62 
63  virtual ~CloseButtonHandle();
64 
65  static UIHandlePtr HitTest
66  (std::weak_ptr<CloseButtonHandle> &holder,
67  const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell);
68 };
69 
71 
72 #include <wx/event.h>
73 #include "../../widgets/PopupMenuTable.h"
74 
75 class MenuButtonHandle final : public ButtonHandle
76 {
77  MenuButtonHandle(const MenuButtonHandle&) = delete;
78 
79 protected:
81  (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)
82  override;
83 
84  wxString Tip(const wxMouseState &state) const override;
85 
86 public:
87  explicit MenuButtonHandle
88  ( const std::shared_ptr<TrackPanelCell> &pCell,
89  const std::shared_ptr<Track> &pTrack, const wxRect &rect );
90 
91  MenuButtonHandle &operator=(const MenuButtonHandle&) = default;
92 
93  virtual ~MenuButtonHandle();
94 
95  static UIHandlePtr HitTest
96  (std::weak_ptr<MenuButtonHandle> &holder,
97  const wxMouseState &state, const wxRect &rect,
98  const std::shared_ptr<TrackPanelCell> &pCell);
99 
100 private:
101  std::weak_ptr<TrackPanelCell> mpCell;
102 };
103 
104 #endif
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:155
CloseButtonHandle(const CloseButtonHandle &)=delete
wxString Tip(const wxMouseState &state) const override
Definition: TrackButtonHandles.cpp:108
Definition: ButtonHandle.h:23
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:30
MinimizeButtonHandle & operator=(const MinimizeButtonHandle &)=default
MenuButtonHandle & operator=(const MenuButtonHandle &)=default
std::weak_ptr< TrackPanelCell > mpCell
Definition: TrackButtonHandles.h:101
static UIHandlePtr HitTest(std::weak_ptr< MenuButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< TrackPanelCell > &pCell)
Definition: TrackButtonHandles.cpp:186
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackButtonHandles.cpp:86
MinimizeButtonHandle(const MinimizeButtonHandle &)=delete
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
unsigned Result
Definition: UIHandle.h:37
virtual ~MenuButtonHandle()
Definition: TrackButtonHandles.cpp:150
wxString Tip(const wxMouseState &state) const override
Definition: TrackButtonHandles.cpp:51
static UIHandlePtr HitTest(std::weak_ptr< CloseButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:125
wxString Tip(const wxMouseState &state) const override
Definition: TrackButtonHandles.cpp:169
Definition: TrackButtonHandles.h:75
CloseButtonHandle & operator=(const CloseButtonHandle &)=default
Definition: TrackButtonHandles.h:18
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
static UIHandlePtr HitTest(std::weak_ptr< MinimizeButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:58
bool StopsOnKeystroke() override
Definition: TrackButtonHandles.h:55
Definition: TrackPanelCell.h:32
virtual ~CloseButtonHandle()
Definition: TrackButtonHandles.cpp:81
Definition: TrackButtonHandles.h:44
virtual ~MinimizeButtonHandle()
Definition: TrackButtonHandles.cpp:25
MenuButtonHandle(const MenuButtonHandle &)=delete