Audacity  2.2.0
LabelGlyphHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 LabelGlyphHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_LABEL_GLYPH_HANDLE__
12 #define __AUDACITY_LABEL_GLYPH_HANDLE__
13 
15 #include <wx/gdicmn.h>
16 #include "../../../MemoryX.h"
17 
18 class wxMouseState;
19 class LabelTrack;
20 
31 struct LabelTrackHit {
32  int mEdge{};
33  int mMouseOverLabelLeft{ -1 };
35  bool mbIsMoving {};
37 };
38 
40 {
41  static HitTestPreview HitPreview(bool hitCenter);
42 
43 public:
44  explicit LabelGlyphHandle
45  (const std::shared_ptr<LabelTrack> &pLT,
46  const wxRect &rect, const LabelTrackHit &hit);
47 
48  LabelGlyphHandle &operator=(const LabelGlyphHandle&) = default;
49 
50  static UIHandlePtr HitTest
51  (std::weak_ptr<LabelGlyphHandle> &holder,
52  const wxMouseState &state,
53  const std::shared_ptr<LabelTrack> &pLT, const wxRect &rect);
54 
55  virtual ~LabelGlyphHandle();
56 
57  void Enter(bool forward) override;
58 
60  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
61 
62  Result Drag
63  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
64 
66  (const TrackPanelMouseState &state, const AudacityProject *pProject)
67  override;
68 
70  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
71  wxWindow *pParent) override;
72 
73  Result Cancel(AudacityProject *pProject) override;
74 
75  bool StopsOnKeystroke() override { return true; }
76 
78 
80  (const LabelGlyphHandle &oldState, const LabelGlyphHandle &newState);
81 
82 private:
83  std::shared_ptr<LabelTrack> mpLT {};
84  wxRect mRect {};
85 };
86 
87 #endif
LabelGlyphHandle(const std::shared_ptr< LabelTrack > &pLT, const wxRect &rect, const LabelTrackHit &hit)
Definition: LabelGlyphHandle.cpp:27
Definition: LabelGlyphHandle.h:31
Result Cancel(AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:154
static HitTestPreview HitPreview(bool hitCenter)
Definition: LabelGlyphHandle.cpp:49
void Enter(bool forward) override
Definition: LabelGlyphHandle.cpp:35
static UIHandlePtr HitTest(std::weak_ptr< LabelGlyphHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT, const wxRect &rect)
Definition: LabelGlyphHandle.cpp:61
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: LabelGlyphHandle.cpp:136
int mMouseOverLabelRight
Keeps track of which left label the mouse is currently over.
Definition: LabelGlyphHandle.h:34
Definition: TrackPanelMouseEvent.h:23
bool mIsAdjustingLabel
Definition: LabelGlyphHandle.h:36
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:114
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:85
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
unsigned Result
Definition: UIHandle.h:37
int mEdge
Definition: LabelGlyphHandle.h:32
static UIHandle::Result NeedChangeHighlight(const LabelGlyphHandle &oldState, const LabelGlyphHandle &newState)
Definition: LabelGlyphHandle.cpp:41
virtual ~LabelGlyphHandle()
Definition: LabelGlyphHandle.cpp:80
std::shared_ptr< LabelTrack > mpLT
Definition: LabelGlyphHandle.h:83
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
int mMouseOverLabelLeft
Definition: LabelGlyphHandle.h:33
wxRect mRect
Definition: LabelGlyphHandle.h:84
Definition: LabelGlyphHandle.h:39
Definition: HitTestResult.h:19
bool StopsOnKeystroke() override
Definition: LabelGlyphHandle.h:75
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:130
LabelTrackHit mHit
Definition: LabelGlyphHandle.h:77
Definition: LabelDefaultClickHandle.h:22
Definition: TrackPanelMouseEvent.h:41
LabelGlyphHandle & operator=(const LabelGlyphHandle &)=default
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:116
bool mbIsMoving
Keeps track of which right label the mouse is currently over.
Definition: LabelGlyphHandle.h:35