40 mwAx->MessageForScreenReader(message);
46 mwAx->BeginChangeFocus();
50 const std::shared_ptr<Track> &track)
53 mwAx->EndChangeFocus(track);
59 mwAx->UpdateAccessibility();
66#if wxUSE_ACCESSIBILITY
83#if wxUSE_ACCESSIBILITY
88 auto focusedTrack = pFocus->PeekFocus();
89 if (focusedTrack && !focusedTrack->GetSelected()) {
90 NotifyEvent( wxACC_EVENT_OBJECT_SELECTIONREMOVE,
93 pFocus->TrackNum(focusedTrack));
100#if wxUSE_ACCESSIBILITY
107 NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
110 pFocus->NumFocusedTrack());
113 if (track->GetSelected()) {
114 NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
117 pFocus->NumFocusedTrack());
121 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
137#if wxUSE_ACCESSIBILITY
142 auto t = pFocus->GetFocus();
147 NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
150 pFocus->TrackNum(t));
152 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
155 pFocus->TrackNum(t));
161#if wxUSE_ACCESSIBILITY
168 auto t = pFocus->GetFocus();
169 int childId = t ? pFocus->TrackNum(t) : 0;
180 NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
189#if wxUSE_ACCESSIBILITY
193wxAccStatus TrackPanelAx::GetChild(
int childId, wxAccessible** child )
195 if( childId == wxACC_SELF )
208wxAccStatus TrackPanelAx::GetChildCount(
int* childCount )
214 *childCount = as_const(*pFocus).GetTracks().Any().size();
224wxAccStatus TrackPanelAx::GetDefaultAction(
int WXUNUSED(childId), wxString *actionName )
232wxAccStatus TrackPanelAx::GetDescription(
int WXUNUSED(childId), wxString *description )
234 description->clear();
240wxAccStatus TrackPanelAx::GetHelpText(
int WXUNUSED(childId), wxString *helpText )
249wxAccStatus TrackPanelAx::GetKeyboardShortcut(
int WXUNUSED(childId), wxString *shortcut )
258wxAccStatus TrackPanelAx::GetLocation( wxRect& rect,
int elementId )
266 if( elementId == wxACC_SELF )
272 auto t = pFocus->FindTrack(elementId);
287 rect.Inflate(dx, dx);
288 rect.SetPosition(
GetWindow()->ClientToScreen(rect.GetPosition()));
295wxAccStatus TrackPanelAx::GetName(
int childId, wxString*
name )
297#if defined(__WXMSW__) || defined(__WXMAC__)
300 if( childId == wxACC_SELF )
302 *
name =
_(
"TrackView");
310 auto t = pFocus->FindTrack(childId);
315 name->Printf(
"%d %s", pFocus->TrackNum(t), t->GetName());
319 const auto trackNameLower = t->GetName().Lower();
323 if(trackNameLower.Find(wxString(
_(
"Label Track")).Lower()) == wxNOT_FOUND &&
327 name->Append(
wxT(
" ") + wxString(
_(
"Label Track")));
329 else if(
dynamic_cast<TimeTrack*
>(t.get()))
334 name->Append(
wxT(
" ") + wxString(
_(
"Time Track")));
337 else if(
dynamic_cast<NoteTrack*
>(t.get()))
340 name->Append(
wxT(
" ") + wxString(
_(
"Note Track")));
345 if( pt && pt->GetMute() )
355 name->Append(
wxT(
" ") + wxString(
_(
" Muted" )) );
358 if( pt && pt->GetSolo() )
362 name->Append(
wxT(
" ") + wxString(
_(
" Soloed" )) );
364 if( t->GetSelected() )
368 name->Append(
wxT(
" ") + wxString(
_(
" Selected" )) );
376 name->Append(
wxT(
" ") + wxString(
_(
" Sync Locked" )) );
388#if defined(__WXMAC__)
389 return wxACC_NOT_IMPLEMENTED;
394wxAccStatus TrackPanelAx::GetRole(
int childId, wxAccRole* role )
396#if defined(__WXMSW__)
399 if( childId == wxACC_SELF )
401 *role = wxROLE_SYSTEM_TABLE;
405 *role = wxROLE_SYSTEM_ROW;
414#if defined(__WXMAC__)
415 if( childId == wxACC_SELF )
417 *role = wxROLE_SYSTEM_PANE;
421 *role = wxROLE_SYSTEM_STATICTEXT;
436wxAccStatus TrackPanelAx::GetSelections( wxVariant * WXUNUSED(selections) )
438 return wxACC_NOT_IMPLEMENTED;
442wxAccStatus TrackPanelAx::GetState(
int childId,
long* state )
444#if defined(__WXMSW__)
451 auto t = pFocus->FindTrack(childId);
453 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
458 *state |= wxACC_STATE_SYSTEM_FOCUSED;
463 *state |= wxACC_STATE_SYSTEM_SELECTED;
470 return wxACC_NOT_IMPLEMENTED;
474#if defined(__WXMAC__)
479 *state = wxACC_STATE_SYSTEM_FOCUSABLE | wxACC_STATE_SYSTEM_SELECTABLE;
483 auto t = pFocus->FindTrack(childId);
487 if (t == pFocus->PeekFocus())
489 *state |= wxACC_STATE_SYSTEM_FOCUSED;
492 if( t->GetSelected() )
494 *state |= wxACC_STATE_SYSTEM_SELECTED;
505#if defined(__WXMAC__)
506wxAccStatus TrackPanelAx::GetValue(
int childId, wxString* strValue )
508wxAccStatus TrackPanelAx::GetValue(
int WXUNUSED(childId), wxString* WXUNUSED(strValue) )
511#if defined(__WXMSW__)
512 return wxACC_NOT_IMPLEMENTED;
515#if defined(__WXMAC__)
516 if( childId == wxACC_SELF )
518 *strValue =
_(
"TrackView");
522 auto pFocus = mwFocus.lock();
526 auto t = pFocus->FindTrack(childId);
535 strValue->Printf(
_(
"Track %d"), pFocus->TrackNum(t));
536 strValue->Append(
" " + t->GetName());
540 if( pt && pt->GetMute() )
542 strValue->Append(
_(
" Mute On" ) );
545 if( pt && pt->GetSolo() )
547 strValue->Append(
_(
" Solo On" ) );
549 if( t->GetSelected() )
551 strValue->Append(
_(
" Select On" ) );
563wxAccStatus TrackPanelAx::GetFocus(
int *childId, wxAccessible **child )
569#if defined(__WXMSW__)
573 auto focusedTrack = pFocus->PeekFocus();
576 *childId = pFocus->TrackNum(focusedTrack);
587#if defined(__WXMAC__)
590 auto focusedTrack = pFocus->PeekFocus();
593 *childId = pFocus->TrackNum(focusedTrack);
597 *childId = wxACC_SELF;
603 return wxACC_NOT_IMPLEMENTED;
608wxAccStatus TrackPanelAx::Navigate(wxNavDir navDir,
int fromId,
int* toId, wxAccessible** toObject)
611 GetChildCount( &childCount );
613 if (fromId > childCount)
617 case wxNAVDIR_FIRSTCHILD:
618 if (fromId == wxACC_SELF && childCount > 0 )
624 case wxNAVDIR_LASTCHILD:
625 if (fromId == wxACC_SELF && childCount > 0 )
633 if (fromId != wxACC_SELF) {
635 if (*toId > childCount)
639 return wxACC_NOT_IMPLEMENTED;
642 case wxNAVDIR_PREVIOUS:
644 if (fromId != wxACC_SELF) {
650 return wxACC_NOT_IMPLEMENTED;
655 if (fromId != wxACC_SELF)
658 return wxACC_NOT_IMPLEMENTED;
667wxAccStatus TrackPanelAx::Select(
int childId, wxAccSelectionFlags selectFlags)
674 if (selectFlags != wxACC_SEL_TAKEFOCUS)
675 return wxACC_NOT_IMPLEMENTED;
677 if (childId != wxACC_SELF) {
679 GetChildCount( &childCount );
680 if (childId > childCount)
683 Track* t = pFocus->FindTrack(childId).get();
688 pViewport->ShowTrack(*t);
692 return wxACC_NOT_IMPLEMENTED;
A LabelTrack is a Track that holds labels (LabelStruct).
static wxString GetDefaultName()
A Track that is used for Midi notes. (Somewhat old code).
AudioTrack subclass that can also be audibly replayed by the program.
static bool IsSyncLockSelected(const Track &track)
A kind of Track used to 'warp time'.
static wxString GetDefaultName()
Abstract base class for an object holding data associated with points on a time axis.
std::shared_ptr< Subclass > SharedPointer()
void BeginChangeFocus() override
TrackPanelAx(std::weak_ptr< Viewport > wViewport, std::weak_ptr< TrackFocus > wFocus, RectangleFinder finder)
std::weak_ptr< Viewport > mwViewport
std::function< wxRect(Track &) > RectangleFinder
std::weak_ptr< TrackFocus > mwFocus
void UpdateAccessibility() override
wxWindow * GetWindow() const
void MessageForScreenReader(const TranslatableString &message) override
void EndChangeFocus(const std::shared_ptr< Track > &track) override
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
void BeginChangeFocus() override
void MessageForScreenReader(const TranslatableString &message) override
const wxWeakRef< TrackPanelAx > mwAx
void UpdateAccessibility() override
void EndChangeFocus(const std::shared_ptr< Track > &track) override