Audacity  3.0.3
CommonTrackControls.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 CommonTrackControls.h
6 
7 Paul Licameli split from TrackControls.h
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_COMMON_TRACK_CONTROLS__
12 #define __AUDACITY_COMMON_TRACK_CONTROLS__
13 
14 #include "TrackControls.h" // to inherit
15 
16 class CloseButtonHandle;
17 class MenuButtonHandle;
18 class PopupMenuTable;
20 class SelectButtonHandle;
21 class TrackSelectHandle;
22 
23 namespace TrackInfo{ struct TCPLine; }
24 using TCPLines = std::vector< TrackInfo::TCPLine >;
25 
26 class AUDACITY_DLL_API CommonTrackControls /* not final */ : public TrackControls
27 {
28 public:
30 
31  // This is passed to the InitUserData() methods of the PopupMenuTable
32  // objects returned by GetMenuExtension:
33  struct InitMenuData
34  {
35  public:
38  wxWindow *pParent;
39  unsigned result;
40  };
41 
42  // This decides what details to draw in the track control panel, besides
43  // those at the bottom
44  virtual const TCPLines& GetTCPLines() const;
45 
46  // To help subclasses define GetTCPLines
47  static const TCPLines& StaticTCPLines();
48 
49 protected:
50  // An override is supplied for derived classes to call through but it is
51  // still marked pure virtual
52  virtual std::vector<UIHandlePtr> HitTest
53  (const TrackPanelMouseState &state,
54  const AudacityProject *) override = 0;
55 
56  unsigned DoContextMenu
57  (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition,
58  AudacityProject *pProject) override;
59  virtual PopupMenuTable *GetMenuExtension(Track *pTrack) = 0;
60 
61  // TrackPanelDrawable implementation
62  void Draw(
63  TrackPanelDrawingContext &context,
64  const wxRect &rect, unsigned iPass ) override;
65 
66  wxRect DrawingArea(
68  const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
69 
70  std::weak_ptr<CloseButtonHandle> mCloseHandle;
71  std::weak_ptr<MenuButtonHandle> mMenuHandle;
72  std::weak_ptr<MinimizeButtonHandle> mMinimizeHandle;
73  std::weak_ptr<SelectButtonHandle> mSelectButtonHandle;
74  std::weak_ptr<TrackSelectHandle> mSelectHandle;
75 };
76 
77 #endif
TrackSelectHandle
Definition: TrackSelectHandle.h:20
CommonTrackControls::mMinimizeHandle
std::weak_ptr< MinimizeButtonHandle > mMinimizeHandle
Definition: CommonTrackControls.h:72
CommonTrackControls::mMenuHandle
std::weak_ptr< MenuButtonHandle > mMenuHandle
Definition: CommonTrackControls.h:71
TrackPanelCell::HitTest
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject)=0
TrackControls::TrackControls
TrackControls(std::shared_ptr< Track > pTrack)
Definition: TrackControls.cpp:16
TCPLines
TrackInfo::TCPLines TCPLines
Definition: TrackInfo.cpp:101
CommonTrackControls::mSelectHandle
std::weak_ptr< TrackSelectHandle > mSelectHandle
Definition: CommonTrackControls.h:74
CommonTrackControls::mSelectButtonHandle
std::weak_ptr< SelectButtonHandle > mSelectButtonHandle
Definition: CommonTrackControls.h:73
PopupMenuTable
Definition: PopupMenuTable.h:115
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
CommonTrackControls
Definition: CommonTrackControls.h:27
TrackPanelDrawable::DrawingArea
virtual wxRect DrawingArea(TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:22
CommonTrackControls::InitMenuData::result
unsigned result
Definition: CommonTrackControls.h:39
MenuButtonHandle
Definition: TrackButtonHandles.h:100
CommonTrackPanelCell::DoContextMenu
unsigned DoContextMenu(const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
Definition: CommonTrackPanelCell.cpp:62
CommonTrackControls::InitMenuData::project
AudacityProject & project
Definition: CommonTrackControls.h:36
CommonTrackControls::mCloseHandle
std::weak_ptr< CloseButtonHandle > mCloseHandle
Definition: CommonTrackControls.h:70
CloseButtonHandle
Definition: TrackButtonHandles.h:71
TrackControls.h
CommonTrackControls::InitMenuData
Definition: CommonTrackControls.h:34
CommonTrackControls::InitMenuData::pParent
wxWindow * pParent
Definition: CommonTrackControls.h:38
TrackInfo
Functions for drawing the track control panel, which is shown to the side of a track It has the menus...
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
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
TrackControls
Definition: TrackControls.h:20
TrackInfo::TCPLine
Definition: TrackInfo.h:36
SelectButtonHandle
Definition: TrackButtonHandles.h:45
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
CommonTrackControls::InitMenuData::pTrack
Track * pTrack
Definition: CommonTrackControls.h:37
CommonTrackControls::GetMenuExtension
virtual PopupMenuTable * GetMenuExtension(Track *pTrack)=0
MinimizeButtonHandle
Definition: TrackButtonHandles.h:19
TrackPanelDrawable::Draw
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:17