Audacity  2.2.0
TrackControls.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackControls.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_CONTROLS__
12 #define __AUDACITY_TRACK_CONTROLS__
13 
14 #include "CommonTrackPanelCell.h"
15 #include "../../MemoryX.h"
16 
17 class PopupMenuTable;
18 class Track;
19 
20 class CloseButtonHandle;
21 class MenuButtonHandle;
23 class TrackSelectHandle;
24 
25 class TrackControls /* not final */ : public CommonTrackPanelCell
26 {
27 public:
28  explicit
29  TrackControls( std::shared_ptr<Track> pTrack );
30 
31  virtual ~TrackControls() = 0;
32 
33  std::shared_ptr<Track> FindTrack() override;
34 
35  // This is passed to the InitMenu() methods of the PopupMenuTable
36  // objects returned by GetMenuExtension:
37  struct InitMenuData
38  {
39  public:
41  wxWindow *pParent;
42  unsigned result;
43  };
44 
45 protected:
46  // An override is supplied for derived classes to call through but it is
47  // still marked pure virtual
48  virtual std::vector<UIHandlePtr> HitTest
49  (const TrackPanelMouseState &state,
50  const AudacityProject *) override = 0;
51 
52  unsigned DoContextMenu
53  (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition) override;
54  virtual PopupMenuTable *GetMenuExtension(Track *pTrack) = 0;
55 
56  Track *GetTrack() const;
57 
58  std::weak_ptr<Track> mwTrack;
59 
60  std::weak_ptr<CloseButtonHandle> mCloseHandle;
61  std::weak_ptr<MenuButtonHandle> mMenuHandle;
62  std::weak_ptr<MinimizeButtonHandle> mMinimizeHandle;
63  std::weak_ptr<TrackSelectHandle> mSelectHandle;
64 };
65 
66 #endif
Definition: TrackSelectHandle.h:20
std::weak_ptr< TrackSelectHandle > mSelectHandle
Definition: TrackControls.h:63
unsigned result
Definition: TrackControls.h:42
virtual PopupMenuTable * GetMenuExtension(Track *pTrack)=0
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *) override=0
Definition: TrackControls.cpp:39
virtual ~TrackControls()=0
Definition: TrackControls.cpp:29
Definition: TrackControls.h:37
Definition: TrackPanelMouseEvent.h:23
std::shared_ptr< Track > FindTrack() override
Definition: TrackControls.cpp:33
std::weak_ptr< CloseButtonHandle > mCloseHandle
Definition: TrackControls.h:60
unsigned DoContextMenu(const wxRect &rect, wxWindow *pParent, wxPoint *pPosition) override
Definition: TrackControls.cpp:213
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
Track * GetTrack() const
Definition: TrackControls.h:25
std::weak_ptr< MenuButtonHandle > mMenuHandle
Definition: TrackControls.h:61
Track * pTrack
Definition: TrackControls.h:40
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
wxWindow * pParent
Definition: TrackControls.h:41
TrackControls(std::shared_ptr< Track > pTrack)
Definition: TrackControls.cpp:24
Definition: TrackButtonHandles.h:75
std::weak_ptr< MinimizeButtonHandle > mMinimizeHandle
Definition: TrackControls.h:62
Definition: TrackButtonHandles.h:18
Definition: PopupMenuTable.h:56
Definition: CommonTrackPanelCell.h:20
Definition: TrackButtonHandles.h:44
std::weak_ptr< Track > mwTrack
Definition: TrackControls.h:58