Audacity  3.0.3
TrackControls.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackControls.cpp
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 
12 #include "TrackControls.h"
13 
14 #include "../../Track.h"
15 
16 TrackControls::TrackControls( std::shared_ptr<Track> pTrack )
17  : CommonTrackCell{ pTrack }
18 {
19 }
20 
22 {
23 }
24 
26 {
27  auto pControls =
28  std::static_pointer_cast<TrackControls>( track.GetTrackControls() );
29  if (!pControls)
30  // create on demand
31  track.SetTrackControls( pControls = DoGetControls::Call( track ) );
32  return *pControls;
33 }
34 
35 const TrackControls &TrackControls::Get( const Track &track )
36 {
37  return Get( const_cast< Track& >( track ) );
38 }
39 
41  return nullptr;
42 }
TrackControls::TrackControls
TrackControls(std::shared_ptr< Track > pTrack)
Definition: TrackControls.cpp:16
AttachedVirtualFunction::Call
static Return Call(This &obj, Arguments &&...arguments)
Invoke the method – but only after static initialization time.
Definition: AttachedVirtualFunction.h:223
AttachedVirtualFunction
Class template generates single-dispatch, open method registry tables.
Definition: AttachedVirtualFunction.h:159
TrackControls::Get
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
DEFINE_ATTACHED_VIRTUAL
DEFINE_ATTACHED_VIRTUAL(DoGetControls)
Definition: TrackControls.cpp:40
TrackControls.h
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TrackControls
Definition: TrackControls.h:20
Track::SetTrackControls
void SetTrackControls(const std::shared_ptr< CommonTrackCell > &pControls)
Definition: Track.cpp:159
TrackControls::~TrackControls
virtual ~TrackControls()=0
Definition: TrackControls.cpp:21
CommonTrackCell
Definition: CommonTrackPanelCell.h:99
Track::GetTrackControls
const std::shared_ptr< CommonTrackCell > & GetTrackControls()
Definition: Track.cpp:154