Audacity  2.2.0
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
Definition: LabelTextHandle.h:23
int mLabelTrackStartXPos
Definition: LabelTextHandle.h:62
std::shared_ptr< LabelTrack > GetTrack() const
Definition: LabelTextHandle.h:38
std::shared_ptr< SelectionStateChanger > mChanger
Definition: LabelTextHandle.h:65
int GetLabelNum() const
Definition: LabelTextHandle.h:39
int mLabelNum
Definition: LabelTextHandle.h:61
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:67
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: LabelTextHandle.cpp:169
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:163
int mLabelTrackStartYPos
Definition: LabelTextHandle.h:63
Definition: TrackPanelMouseEvent.h:23
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:114
void Enter(bool forward) override
Definition: LabelTextHandle.cpp:29
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
unsigned Result
Definition: UIHandle.h:37
Definition: SelectionState.h:48
Defines a selected portion of a project.
Definition: SelectedRegion.h:37
LabelTextHandle & operator=(const LabelTextHandle &)=default
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:129
static HitTestPreview HitPreview()
Definition: LabelTextHandle.cpp:36
std::weak_ptr< LabelTrack > mpLT
Definition: LabelTextHandle.h:60
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
SelectedRegion mSelectedRegion
Definition: LabelTextHandle.h:64
LabelTextHandle(const std::shared_ptr< LabelTrack > &pLT, int labelNum)
Definition: LabelTextHandle.cpp:23
static UIHandlePtr HitTest(std::weak_ptr< LabelTextHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT)
Definition: LabelTextHandle.cpp:47
Result Cancel(AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:194
Definition: HitTestResult.h:19
Definition: LabelDefaultClickHandle.h:22
Definition: TrackPanelMouseEvent.h:41
virtual ~LabelTextHandle()
Definition: LabelTextHandle.cpp:62