Audacity  3.0.3
Classes | Typedefs | Functions
UIHandle.h File Reference
#include <utility>
#include <memory>
#include <typeinfo>
#include "TrackPanelDrawable.h"
Include dependency graph for UIHandle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UIHandle
 Short-lived drawing and event-handling object associated with a TrackPanelCell. More...
 

Typedefs

using UIHandlePtr = std::shared_ptr< UIHandle >
 

Functions

template<typename Subclass >
std::shared_ptr< Subclass > AssignUIHandlePtr (std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
 

Typedef Documentation

◆ UIHandlePtr

using UIHandlePtr = std::shared_ptr<UIHandle>

Definition at line 143 of file UIHandle.h.

Function Documentation

◆ AssignUIHandlePtr()

template<typename Subclass >
std::shared_ptr<Subclass> AssignUIHandlePtr ( std::weak_ptr< Subclass > &  holder,
const std::shared_ptr< Subclass > &  pNew 
)

Definition at line 150 of file UIHandle.h.

152 {
153  // Either assign to a null weak_ptr, or else rewrite what the weak_ptr
154  // points at. Thus a handle already pointed at changes its state but not its
155  // identity. This may matter for the framework that holds the strong
156  // pointers.
157  auto ptr = holder.lock();
158  if (!ptr) {
159  holder = pNew;
160  return pNew;
161  }
162  else {
163  //type slicing check
164  wxASSERT(typeid(*ptr) == typeid(*pNew));
165 
166  auto code = Subclass::NeedChangeHighlight( *ptr, *pNew );
167  *ptr = std::move(*pNew);
168  ptr->SetChangeHighlight( code );
169  return ptr;
170  }
171 }

Referenced by BrushHandleHitTest(), WaveTrackView::DoDetailedHitTest(), EnvelopeHandle::HitAnywhere(), NoteTrackAffordanceHandle::HitAnywhere(), SampleHandle::HitAnywhere(), TimeShiftHandle::HitAnywhere(), TrackSelectHandle::HitAnywhere(), WaveClipTrimHandle::HitAnywhere(), ZoomHandle::HitAnywhere(), TrackPanelResizerCell::HitTest(), SpectrumVRulerControls::HitTest(), WaveformVRulerControls::HitTest(), TimeTrackVRulerControls::HitTest(), BackgroundCell::HitTest(), AdornedRulerPanel::QPCell::HitTest(), AdornedRulerPanel::ScrubbingCell::HitTest(), WaveTrackAffordanceControls::HitTest(), CloseButtonHandle::HitTest(), CutlineHandle::HitTest(), GainSliderHandle::HitTest(), LabelGlyphHandle::HitTest(), LabelTextHandle::HitTest(), MenuButtonHandle::HitTest(), MinimizeButtonHandle::HitTest(), MuteButtonHandle::HitTest(), NoteTrackButtonHandle::HitTest(), NoteTrackVZoomHandle::HitTest(), PanSliderHandle::HitTest(), SelectButtonHandle::HitTest(), SelectHandle::HitTest(), SoloButtonHandle::HitTest(), StretchHandle::HitTest(), anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::HitTest(), anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::HitTest(), and anonymous_namespace{WaveTrackView.cpp}::SubViewRearrangeHandle::HitTest().

Here is the caller graph for this function: