Audacity  3.0.3
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 "SelectedRegion.h"
16 
17 class wxMouseState;
18 class LabelTrack;
21 class ZoomInfo;
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 
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, AudacityProject *) override;
42 
43  bool HandlesRightClick() override;
44 
46  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
47 
48  Result Drag
49  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
50 
52  (const TrackPanelMouseState &state, AudacityProject *pProject)
53  override;
54 
56  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
57  wxWindow *pParent) override;
58 
59  Result Cancel(AudacityProject *pProject) override;
60 
61 private:
62  void HandleTextClick
63  (AudacityProject &project, const wxMouseEvent & evt);
65  AudacityProject &project, const wxMouseEvent & evt);
66 
67  std::weak_ptr<LabelTrack> mpLT {};
68  int mLabelNum{ -1 };
71 
73  bool mRightDragging{ false };
74 };
75 
76 #endif
LabelTextHandle::HitPreview
static HitTestPreview HitPreview()
Definition: LabelTextHandle.cpp:42
LabelDefaultClickHandle
Definition: LabelDefaultClickHandle.h:22
LabelTextHandle
Definition: LabelTextHandle.h:24
LabelTextHandle::operator=
LabelTextHandle & operator=(const LabelTextHandle &)=default
LabelTextHandle::mLabelNum
int mLabelNum
Definition: LabelTextHandle.h:68
ZoomInfo
Definition: ZoomInfo.h:47
LabelDefaultClickHandle.h
SelectionStateChanger
Definition: SelectionState.h:56
SelectedRegion.h
LabelTextHandle::LabelTextHandle
LabelTextHandle(const std::shared_ptr< LabelTrack > &pLT, int labelNum)
Definition: LabelTextHandle.cpp:29
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
LabelTextHandle::GetLabelNum
int GetLabelNum() const
Definition: LabelTextHandle.h:39
LabelTextHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:281
LabelTextHandle::HandleTextClick
void HandleTextClick(AudacityProject &project, const wxMouseEvent &evt)
Definition: LabelTextHandle.cpp:73
LabelTextHandle::mpLT
std::weak_ptr< LabelTrack > mpLT
Definition: LabelTextHandle.h:67
LabelTextHandle::GetTrack
std::shared_ptr< LabelTrack > GetTrack() const
Definition: LabelTextHandle.h:38
LabelTextHandle::mLabelTrackStartXPos
int mLabelTrackStartXPos
Definition: LabelTextHandle.h:69
LabelTextHandle::mLabelTrackStartYPos
int mLabelTrackStartYPos
Definition: LabelTextHandle.h:70
LabelTextHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< LabelTextHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT)
Definition: LabelTextHandle.cpp:53
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
LabelTextHandle::HandlesRightClick
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
Definition: LabelTextHandle.cpp:144
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
HitTestPreview
Definition: HitTestResult.h:20
LabelTextHandle::Enter
void Enter(bool forward, AudacityProject *) override
Definition: LabelTextHandle.cpp:35
LabelTextHandle::~LabelTextHandle
virtual ~LabelTextHandle()
Definition: LabelTextHandle.cpp:69
LabelTextHandle::Preview
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:255
LabelTextHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: LabelTextHandle.cpp:261
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
LabelTextHandle::HandleTextDragRelease
void HandleTextDragRelease(AudacityProject &project, const wxMouseEvent &evt)
Definition: LabelTextHandle.cpp:166
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
LabelTextHandle::mRightDragging
bool mRightDragging
flag to tell if it's a valid dragging
Definition: LabelTextHandle.h:73
LabelTextHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:150
LabelTextHandle::Drag
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelTextHandle.cpp:220
NotifyingSelectedRegion
Definition: ViewInfo.h:44