Audacity  2.2.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
MinimizeButtonHandle Class Referencefinal

#include <TrackButtonHandles.h>

Inheritance diagram for MinimizeButtonHandle:
ButtonHandle UIHandle

Public Member Functions

 MinimizeButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
 
MinimizeButtonHandleoperator= (const MinimizeButtonHandle &)=default
 
virtual ~MinimizeButtonHandle ()
 
- Public Member Functions inherited from ButtonHandle
std::shared_ptr< TrackGetTrack () const
 
bool IsClicked () const
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
virtual bool HasRotation () const
 
virtual bool Rotate (bool forward)
 
virtual bool HasEscape () const
 
virtual bool Escape ()
 
virtual void DrawExtras (DrawingPass pass, wxDC *dc, const wxRegion &updateRegion, const wxRect &panelRect)
 
virtual bool StopsOnKeystroke ()
 
virtual void OnProjectChange (AudacityProject *pProject)
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 

Static Public Member Functions

static UIHandlePtr HitTest (std::weak_ptr< MinimizeButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 

Protected Member Functions

Result CommitChanges (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
wxString Tip (const wxMouseState &state) const override
 
- Protected Member Functions inherited from ButtonHandle
 ButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
 
ButtonHandleoperator= (const ButtonHandle &)=default
 
virtual ~ButtonHandle ()
 
void Enter (bool forward) finaloverride
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) finaloverride
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) finaloverride
 
HitTestPreview Preview (const TrackPanelMouseState &state, const AudacityProject *pProject) finaloverride
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) finaloverride
 
Result Cancel (AudacityProject *pProject) finaloverride
 

Private Member Functions

 MinimizeButtonHandle (const MinimizeButtonHandle &)=delete
 

Additional Inherited Members

- Public Types inherited from UIHandle
enum  DrawingPass { Cells, Panel }
 
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Protected Attributes inherited from ButtonHandle
std::weak_ptr< TrackmpTrack
 
wxRect mRect
 
bool mWasIn { true }
 
bool mIsClicked {}
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 18 of file TrackButtonHandles.h.

Constructor & Destructor Documentation

MinimizeButtonHandle::MinimizeButtonHandle ( const MinimizeButtonHandle )
privatedelete
MinimizeButtonHandle::MinimizeButtonHandle ( const std::shared_ptr< Track > &  pTrack,
const wxRect &  rect 
)
explicit

Definition at line 21 of file TrackButtonHandles.cpp.

22  : ButtonHandle{ pTrack, rect }
23 {}
MinimizeButtonHandle::~MinimizeButtonHandle ( )
virtual

Definition at line 25 of file TrackButtonHandles.cpp.

26 {
27 }

Member Function Documentation

UIHandle::Result MinimizeButtonHandle::CommitChanges ( const wxMouseEvent &  event,
AudacityProject pProject,
wxWindow *  pParent 
)
overrideprotectedvirtual

Implements ButtonHandle.

Definition at line 30 of file TrackButtonHandles.cpp.

References RefreshCode::FixScrollbars, AudacityProject::ModifyState(), RefreshCode::RefreshAll, and RefreshCode::RefreshNone.

31 {
32  using namespace RefreshCode;
33 
34  auto pTrack = mpTrack.lock();
35  if (pTrack)
36  {
37  pTrack->SetMinimized(!pTrack->GetMinimized());
38  if (pTrack->GetLink())
39  pTrack->GetLink()->SetMinimized(pTrack->GetMinimized());
40  pProject->ModifyState(true);
41 
42  // Redraw all tracks when any one of them expands or contracts
43  // (Could we invent a return code that draws only those at or below
44  // the affected track?)
45  return RefreshAll | FixScrollbars;
46  }
47 
48  return RefreshNone;
49 }
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:69
void ModifyState(bool bWantsAutoSave)
Definition: Project.cpp:4747
UIHandlePtr MinimizeButtonHandle::HitTest ( std::weak_ptr< MinimizeButtonHandle > &  holder,
const wxMouseState &  state,
const wxRect &  rect,
TrackPanelCell pCell 
)
static

Definition at line 58 of file TrackButtonHandles.cpp.

References AssignUIHandlePtr(), and TrackInfo::GetMinimizeRect().

Referenced by TrackControls::HitTest().

60 {
61  wxRect buttonRect;
62  TrackInfo::GetMinimizeRect(rect, buttonRect);
63 
64  if (buttonRect.Contains(state.m_x, state.m_y)) {
65  auto pTrack = static_cast<CommonTrackPanelCell*>(pCell)->FindTrack();
66  auto result = std::make_shared<MinimizeButtonHandle>( pTrack, buttonRect );
67  result = AssignUIHandlePtr(holder, result);
68  return result;
69  }
70  else
71  return {};
72 }
static void GetMinimizeRect(const wxRect &rect, wxRect &dest)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:162
MinimizeButtonHandle& MinimizeButtonHandle::operator= ( const MinimizeButtonHandle )
default
wxString MinimizeButtonHandle::Tip ( const wxMouseState &  state) const
overrideprotectedvirtual

Implements ButtonHandle.

Definition at line 51 of file TrackButtonHandles.cpp.

References _(), and ButtonHandle::GetTrack().

52 {
53  auto pTrack = GetTrack();
54  return pTrack->GetMinimized() ? _("Expand") : _("Collapse");
55 }
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand

The documentation for this class was generated from the following files: