Audacity  2.2.2
LabelTextHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 LabelTextHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_LABEL_TEXT_HANDLE__
12 #define __AUDACITY_LABEL_TEXT_HANDLE__
13 
15 #include "../../../MemoryX.h"
16 #include "../../../SelectedRegion.h"
17 #include <wx/gdicmn.h>
18 
19 class wxMouseState;
20 class LabelTrack;
22 
24 {
25  static HitTestPreview HitPreview();
26 
27 public:
28  static UIHandlePtr HitTest
29  (std::weak_ptr<LabelTextHandle> &holder,
30  const wxMouseState &state, const std::shared_ptr<LabelTrack> &pLT);
31 
32  LabelTextHandle &operator=(const LabelTextHandle&) = default;
33 
34  explicit LabelTextHandle
35  ( const std::shared_ptr<LabelTrack> &pLT, int labelNum );
36  virtual ~LabelTextHandle();
37 
38  std::shared_ptr<LabelTrack> GetTrack() const { return mpLT.lock(); }
39  int GetLabelNum() const { return mLabelNum; }
40 
41  void Enter(bool forward) override;
42 
44  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
45 
46  Result Drag
47  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
48 
50  (const TrackPanelMouseState &state, const AudacityProject *pProject)
51  override;
52 
54  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
55  wxWindow *pParent) override;
56 
57  Result Cancel(AudacityProject *pProject) override;
58 
59 private:
60  std::weak_ptr<LabelTrack> mpLT {};
61  int mLabelNum{ -1 };
65  std::shared_ptr<SelectionStateChanger> mChanger;
66 };
67 
68 #endif
std::shared_ptr< LabelTrack > GetTrack() const
std::shared_ptr< SelectionStateChanger > mChanger
int GetLabelNum() const
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
void Enter(bool forward) override
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:158
unsigned Result
Definition: UIHandle.h:37
Defines a selected portion of a project.
LabelTextHandle & operator=(const LabelTextHandle &)=default
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static HitTestPreview HitPreview()
std::weak_ptr< LabelTrack > mpLT
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
SelectedRegion mSelectedRegion
LabelTextHandle(const std::shared_ptr< LabelTrack > &pLT, int labelNum)
static UIHandlePtr HitTest(std::weak_ptr< LabelTextHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT)
Result Cancel(AudacityProject *pProject) override
virtual ~LabelTextHandle()