Audacity  3.0.3
TrackPanelResizerCell.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  TrackPanelResizerCell.h
6 
7  Paul Licameli split from TrackPanel.cpp
8 
9  **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_PANEL_RESIZER_CELL__
12 #define __AUDACITY_TRACK_PANEL_RESIZER_CELL__
13 
14 #include "ClientData.h" // to inherit
15 #include "tracks/ui/CommonTrackPanelCell.h" // to inherit
16 
17 class Track;
19 
21  : public CommonTrackPanelCell
22  , public std::enable_shared_from_this< TrackPanelResizerCell >
23  , public ClientData::Base
24 {
27 public:
28 
29  static TrackPanelResizerCell &Get( Track &track );
30  static const TrackPanelResizerCell &Get( const Track &track );
31 
32  explicit
33  TrackPanelResizerCell( const std::shared_ptr<Track> &pTrack );
34 
35  std::vector<UIHandlePtr> HitTest
36  (const TrackPanelMouseState &, const AudacityProject *) override;
37 
38 protected:
39  std::shared_ptr<Track> DoFindTrack() override;
40 
41 private:
42  // back-pointer is weak to break a cycle
43  std::weak_ptr<Track> mwTrack;
44 
45  // TrackPanelDrawable implementation
46  void Draw(
47  TrackPanelDrawingContext &context,
48  const wxRect &rect, unsigned iPass ) override;
49 
50  std::weak_ptr<TrackPanelResizeHandle> mResizeHandle;
51 };
52 
53 #endif
TrackPanelResizerCell::DoFindTrack
std::shared_ptr< Track > DoFindTrack() override
Definition: TrackPanelResizerCell.cpp:47
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
ClientData::Base
A convenient default parameter for class template Site.
Definition: ClientData.h:28
TrackPanelResizerCell::Draw
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
Definition: TrackPanelResizerCell.cpp:52
TrackPanelResizerCell::mResizeHandle
std::weak_ptr< TrackPanelResizeHandle > mResizeHandle
Definition: TrackPanelResizerCell.h:50
ClientData.h
Utility ClientData::Site to register hooks into a host class that attach client data.
TrackPanelResizeHandle
Definition: TrackPanelResizeHandle.h:19
TrackPanelResizerCell::TrackPanelResizerCell
TrackPanelResizerCell(const TrackPanelResizerCell &)=delete
CommonTrackPanelCell.h
TrackPanelResizerCell::HitTest
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &, const AudacityProject *) override
Definition: TrackPanelResizerCell.cpp:33
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:113
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
TrackPanelResizerCell
Definition: TrackPanelResizerCell.h:24
TrackPanelResizerCell::operator=
TrackPanelResizerCell & operator=(const TrackPanelResizerCell &)=delete
CommonTrackPanelCell
Definition: CommonTrackPanelCell.h:26
TrackPanelResizerCell::Get
static TrackPanelResizerCell & Get(Track &track)
Definition: TrackPanelResizerCell.cpp:119
TrackPanelResizerCell::mwTrack
std::weak_ptr< Track > mwTrack
Definition: TrackPanelResizerCell.h:43