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; 19 class MinimizeButtonHandle; 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: 29 using TrackControls::TrackControls; 30 31 // This is passed to the InitUserData() methods of the PopupMenuTable 32 // objects returned by GetMenuExtension: 33 struct InitMenuData 34 { 35 public: 36 AudacityProject &project; 37 Track *pTrack; 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( 67 TrackPanelDrawingContext &, 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 78