Audacity 3.2.0
AButton.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AButton.cpp
6
7 Dominic Mazzoni
8
9*******************************************************************//*******************************************************************/
23
24
25#include "AButton.h"
26
27#include "AColor.h"
28
29#include <wx/setup.h> // for wxUSE_* macros
30
31#include <wx/app.h>
32#include <wx/dcbuffer.h>
33#include <wx/eventfilter.h>
34#include <wx/image.h>
35#include <wx/timer.h>
36
37//This is needed for tooltips
38#include "Project.h"
39#include "ProjectStatus.h"
40#include "../ProjectWindowBase.h"
41#include <wx/tooltip.h>
42
43#if wxUSE_ACCESSIBILITY
44#include "WindowAccessible.h"
45
46class AButtonAx final : public WindowAccessible
47{
48public:
49 AButtonAx(wxWindow * window);
50
51 virtual ~ AButtonAx();
52
53 // Performs the default action. childId is 0 (the action for this object)
54 // or > 0 (the action for a child).
55 // Return wxACC_NOT_SUPPORTED if there is no default action for this
56 // window (e.g. an edit control).
57 wxAccStatus DoDefaultAction(int childId) override;
58
59 // Retrieves the address of an IDispatch interface for the specified child.
60 // All objects must support this property.
61 wxAccStatus GetChild(int childId, wxAccessible** child) override;
62
63 // Gets the number of children.
64 wxAccStatus GetChildCount(int* childCount) override;
65
66 // Gets the default action for this object (0) or > 0 (the action for a child).
67 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
68 // string if there is no action.
69 // The retrieved string describes the action that is performed on an object,
70 // not what the object does as a result. For example, a toolbar button that prints
71 // a document has a default action of "Press" rather than "Prints the current document."
72 wxAccStatus GetDefaultAction(int childId, wxString *actionName) override;
73
74 // Returns the description for this object or a child.
75 wxAccStatus GetDescription(int childId, wxString *description) override;
76
77 // Gets the window with the keyboard focus.
78 // If childId is 0 and child is NULL, no object in
79 // this subhierarchy has the focus.
80 // If this object has the focus, child should be 'this'.
81 wxAccStatus GetFocus(int *childId, wxAccessible **child) override;
82
83 // Returns help text for this object or a child, similar to tooltip text.
84 wxAccStatus GetHelpText(int childId, wxString *helpText) override;
85
86 // Returns the keyboard shortcut for this object or child.
87 // Return e.g. ALT+K
88 wxAccStatus GetKeyboardShortcut(int childId, wxString *shortcut) override;
89
90 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
91 // rect is in screen coordinates.
92 wxAccStatus GetLocation(wxRect& rect, int elementId) override;
93
94 // Gets the name of the specified object.
95 wxAccStatus GetName(int childId, wxString *name) override;
96
97 // Returns a role constant.
98 wxAccStatus GetRole(int childId, wxAccRole *role) override;
99
100 // Gets a variant representing the selected children
101 // of this object.
102 // Acceptable values:
103 // - a null variant (IsNull() returns TRUE)
104 // - a list variant (GetType() == wxT("list"))
105 // - an integer representing the selected child element,
106 // or 0 if this object is selected (GetType() == wxT("long"))
107 // - a "void*" pointer to a wxAccessible child object
108 wxAccStatus GetSelections(wxVariant *selections) override;
109
110 // Returns a state constant.
111 wxAccStatus GetState(int childId, long* state) override;
112
113 // Returns a localized string representing the value for the object
114 // or child.
115 wxAccStatus GetValue(int childId, wxString* strValue) override;
116
117};
118
119#endif // wxUSE_ACCESSIBILITY
120
121BEGIN_EVENT_TABLE(AButton, wxWindow)
122 EVT_MOUSE_EVENTS(AButton::OnMouseEvent)
123 EVT_MOUSE_CAPTURE_LOST(AButton::OnCaptureLost)
124 EVT_KEY_DOWN(AButton::OnKeyDown)
125 EVT_SET_FOCUS(AButton::OnSetFocus)
126 EVT_KILL_FOCUS(AButton::OnKillFocus)
127 EVT_PAINT(AButton::OnPaint)
128 EVT_SIZE(AButton::OnSize)
129 EVT_ERASE_BACKGROUND(AButton::OnErase)
131
132// LL: An alternative to this might be to just use the wxEVT_KILL_FOCUS
133// or wxEVT_ACTIVATE events.
134class AButton::Listener final
135 : public wxEventFilter
136{
137public:
138 Listener (AButton *button);
139 ~Listener();
140
141 int FilterEvent(wxEvent &event) override;
142
143 void OnEvent();
144
145private:
147};
148
150: mButton(button)
151{
152 wxEvtHandler::AddFilter(this);
153}
154
156{
157 wxEvtHandler::RemoveFilter(this);
158}
159
161{
162 if (!mButton->IsDown())
163 {
164 int idx = 0;
165 // Ignore the event, consult key states. One modifier key might
166 // have gone up but another remained down.
167 // Note that CMD (or CTRL) takes precedence over Shift if both are down
168 // and alternates are defined for both
169 // see also AButton::OnMouseEvent()
170 if (wxGetKeyState(WXK_CONTROL) && mButton->HasAlternateImages(2))
171 idx = 2;
172 else if (wxGetKeyState(WXK_SHIFT) && mButton->HasAlternateImages(1))
173 idx = 1;
174
175 // Turn e.g. the "Play" button into a "Loop" button
176 // or "Cut Preview" button
177 mButton->SetAlternateIdx(idx);
178 }
179}
180
182{
183 if (event.GetEventType() == wxEVT_KEY_DOWN ||
184 event.GetEventType() == wxEVT_KEY_UP)
185 OnEvent();
186 else if (event.GetEventType() == wxEVT_SET_FOCUS)
187 // A modal dialog might have eaten the modifier key-up with its own
188 // filter before we saw it; this is adequate to fix the button image
189 // when the dialog disappears.
190 OnEvent();
191 return Event_Skip;
192}
193
194AButton::AButton(wxWindow * parent,
195 wxWindowID id,
196 const wxPoint & pos,
197 const wxSize & size,
198 ImageRoll up,
199 ImageRoll over,
200 ImageRoll down,
201 ImageRoll overDown,
202 ImageRoll dis,
203 bool toggle):
204 wxWindow()
205{
206 Init(parent, id, pos, size,
207 up, over, down, overDown, dis,
208 toggle);
209}
210
212{
213 if(HasCapture())
214 ReleaseMouse();
215}
216
217void AButton::Init(wxWindow * parent,
218 wxWindowID id,
219 const wxPoint & pos,
220 const wxSize & size,
221 ImageRoll up,
222 ImageRoll over,
223 ImageRoll down,
224 ImageRoll overDown,
225 ImageRoll dis,
226 bool toggle)
227{
228 // Bug in wxWidgets 2.8.12: by default pressing Enter on an AButton is interpreted as
229 // a navigation event - move to next control. As a workaround, the style wxWANTS_CHARS
230 // results in all characters being available in the OnKeyDown function below. Note
231 // that OnKeyDown now has to handle navigation.
232 Create(parent, id, pos, size, wxWANTS_CHARS);
233
234 mWasShiftDown = false;
235 mWasControlDown = false;
236 mButtonIsDown = false;
237 mIsClicking = false;
238 mEnabled = true;
239 mCursorIsInWindow = false;
240 mToggle = toggle;
242
243 mImages.resize(1);
244 mImages[0].mArr[0] = up;
245 mImages[0].mArr[1] = over;
246 mImages[0].mArr[2] = down;
247 mImages[0].mArr[3] = overDown;
248 mImages[0].mArr[4] = dis;
249
250 mAlternateIdx = 0;
251
252 mFocusRect = GetClientRect().Deflate( 3, 3 );
253 mForceFocusRect = false;
254
255 SetMinSize(mImages[0].mArr[0].GetMinSize());
256 SetMaxSize(mImages[0].mArr[0].GetMaxSize());
257
258#if wxUSE_ACCESSIBILITY
259 SetName( wxT("") );
260 SetAccessible(safenew AButtonAx(this));
261#endif
262}
263
265{
267}
268
270{
271 wxWindow::SetToolTip( toolTip.Stripped().Translation() );
272}
273
275{
276 wxWindow::SetLabel( toolTip.Stripped().Translation() );
277}
278
279// This compensates for a but in wxWidgets 3.0.2 for mac:
280// Couldn't set focus from keyboard when AcceptsFocus returns false;
281// this bypasses that limitation
283{
284 auto temp = TemporarilyAllowFocus();
285 SetFocus();
286}
287
289 wxImage up,
290 wxImage over,
291 wxImage down,
292 wxImage overDown,
293 wxImage dis)
294{
295 if (1 + idx > mImages.size())
296 mImages.resize(1 + idx);
297 mImages[idx].mArr[0] = ImageRoll(up);
298 mImages[idx].mArr[1] = ImageRoll(over);
299 mImages[idx].mArr[2] = ImageRoll(down);
300 mImages[idx].mArr[3] = ImageRoll(overDown);
301 mImages[idx].mArr[4] = ImageRoll(dis);
302}
303
305 ImageRoll up,
306 ImageRoll over,
307 ImageRoll down,
308 ImageRoll overDown,
309 ImageRoll dis)
310{
311 if (1 + idx > mImages.size())
312 mImages.resize(1 + idx);
313 mImages[idx].mArr[0] = up;
314 mImages[idx].mArr[1] = over;
315 mImages[idx].mArr[2] = down;
316 mImages[idx].mArr[3] = overDown;
317 mImages[idx].mArr[4] = dis;
318}
319
320void AButton::SetAlternateIdx(unsigned idx)
321{
322 // If alternate-image-state is already correct then
323 // nothing to do (saves repainting button).
324 if( mAlternateIdx == idx )
325 return;
326 mAlternateIdx = idx;
327 Refresh(false);
328}
329
331{
332 if(!mListener)
333 mListener = std::make_unique<Listener>(this);
334}
335
336void AButton::SetFocusRect(wxRect & r)
337{
338 mFocusRect = r;
339 mForceFocusRect = true;
340}
341
343{
344 AButtonState state;
345
346 if (!mEnabled && (!mToggle || !mButtonIsDown))
347 return AButtonDis;
348
349 if (mCursorIsInWindow) {
350 if (mToggle) {
351 if (mIsClicking) {
355 }
356 }
357 else {
361 }
362 }
363 }
364 else {
365 if (mIsClicking) {
367 }
368 else {
370 }
371 }
372 }
373 else {
374 //if (mToggle) {
376 //}
377 //else {
378 //state = mButtonIsDown ? AButtonDown : AButtonUp;
379 //}
380 }
381
382 return state;
383}
384
385void AButton::OnPaint(wxPaintEvent & WXUNUSED(event))
386{
387 wxBufferedPaintDC dc(this);
388
389 AButtonState buttonState = GetState();
390
391 mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect());
392
393 if( this == wxWindow::FindFocus() )
394 {
396 }
397}
398
399void AButton::OnErase(wxEraseEvent & WXUNUSED(event))
400{
401 // Ignore it to prevent flashing
402}
403
404void AButton::OnSize(wxSizeEvent & WXUNUSED(event))
405{
406 if (!mForceFocusRect)
407 {
408 mFocusRect = GetClientRect().Deflate( 3, 3 );
409 }
410 Refresh(false);
411}
412
413bool AButton::s_AcceptsFocus{ false };
414
416{
417 if (mImages.size() <= idx)
418 return false;
419
420 const ImageArr &images = mImages[idx];
421 const ImageRoll (&arr)[5] = images.mArr;
422 return (arr[0].Ok() &&
423 arr[1].Ok() &&
424 arr[2].Ok() &&
425 arr[3].Ok() &&
426 arr[4].Ok());
427}
428
429void AButton::OnMouseEvent(wxMouseEvent & event)
430{
431 wxSize clientSize = GetClientSize();
432 AButtonState prevState = GetState();
433
434 if (event.Entering()) {
435 // Bug 1201: On Mac, unsetting and re-setting the tooltip may be needed
436 // to make it pop up when we want it.
437 auto text = GetToolTipText();
438 UnsetToolTip();
439 wxWindow::SetToolTip(text);
440 mCursorIsInWindow = true;
441 }
442 else if (event.Leaving())
443 mCursorIsInWindow = false;
444 else
446 (event.m_x >= 0 && event.m_y >= 0 &&
447 event.m_x < clientSize.x && event.m_y < clientSize.y);
448
449 if (mEnabled && event.IsButton()) {
450 if (event.ButtonIsDown(wxMOUSE_BTN_LEFT)) {
451 mIsClicking = true;
452 if (event.ButtonDClick())
453 mIsDoubleClicked = true;
454 if( !HasCapture() )
455 CaptureMouse();
456 }
457 else if (mIsClicking) {
458 mIsClicking = false;
459
460 if (HasCapture())
461 ReleaseMouse();
462
464 if (mToggle)
466 else
467 mButtonIsDown = true;
468
469 mWasShiftDown = event.ShiftDown();
470 mWasControlDown = event.ControlDown();
471
472 Click();
473 }
474 }
475 }
476
477 // Only redraw and change tooltips if the state has changed.
478 AButtonState newState = GetState();
479
480 if (newState != prevState) {
481 Refresh(false);
482
484 UpdateStatus();
485 else {
486 auto pProject = FindProjectFromWindow( this );
487 if (pProject)
488 ProjectStatus::Get( *pProject ).Set({});
489 }
490 }
491 else
492 event.Skip();
493}
494
496{
497 if (mCursorIsInWindow) {
498#if wxUSE_TOOLTIPS // Not available in wxX11
499 // Display the tooltip in the status bar
500 wxToolTip * pTip = this->GetToolTip();
501 if( pTip ) {
502 auto tipText = Verbatim( pTip->GetTip() );
503 if (!mEnabled)
504 tipText.Join( XO("(disabled)"), " " );
505 auto pProject = FindProjectFromWindow( this );
506 if (pProject)
507 ProjectStatus::Get( *pProject ).Set( tipText );
508 }
509#endif
510 }
511}
512
513void AButton::OnCaptureLost(wxMouseCaptureLostEvent & WXUNUSED(event))
514{
515 wxMouseEvent e(wxEVT_LEFT_UP);
516 e.m_x = -1;
517 e.m_y = -1;
518 OnMouseEvent(e);
519}
520
521// Note that OnKeyDown has to handle navigation because wxWANTS_CHARS
522// flag was set - see above.
523void AButton::OnKeyDown(wxKeyEvent & event)
524{
525 switch( event.GetKeyCode() )
526 {
527 case WXK_RIGHT:
528 Navigate(wxNavigationKeyEvent::IsForward);
529 break;
530 case WXK_LEFT:
531 Navigate(wxNavigationKeyEvent::IsBackward);
532 break;
533 case WXK_TAB:
534 Navigate(event.ShiftDown()
535 ? wxNavigationKeyEvent::IsBackward
536 : wxNavigationKeyEvent::IsForward);
537 break;
538 case WXK_RETURN:
539 case WXK_NUMPAD_ENTER:
540 if( !mEnabled )
541 break;
542 mWasShiftDown = event.ShiftDown();
543 mWasControlDown = event.ControlDown();
544 Click();
545 break;
546 default:
547 event.Skip();
548 }
549}
550
551void AButton::OnSetFocus(wxFocusEvent & WXUNUSED(event))
552{
553 Refresh( false );
554}
555
556void AButton::OnKillFocus(wxFocusEvent & WXUNUSED(event))
557{
558 Refresh( false );
559}
560
562{
563 return mWasShiftDown;
564}
565
567{
568 return mWasControlDown;
569}
570
572{
573 bool changed = wxWindow::Enable(true);
574 if ( !mEnabled ) {
575 mEnabled = true;
576 Refresh(false);
577 }
578}
579
581{
582 // Bug 1565: Tooltips not showing on disabled buttons.
583 // The fix is to NOT tell windows that the button is disabled.
584 // The button's appearance will still change to show it is disabled
585 // since we control that rather than windows.
586#ifndef __WXMSW__
587 wxWindow::Enable(false);
588#endif
589 if (GetCapture()==this)
590 ReleaseMouse();
591 if ( mEnabled ) {
592 mEnabled = false;
593 Refresh(false);
594 }
595}
596
598{
599 if (!mButtonIsDown) {
600 mButtonIsDown = true;
601 this->Refresh(false);
602 }
603}
604
606{
607 if (mButtonIsDown) {
608 mButtonIsDown = false;
609
610 this->Refresh(false);
611 }
612
613 if (GetCapture()==this)
614 ReleaseMouse();
615}
616
618{
619 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
620 event.SetEventObject(this);
621 // Be sure to use SafelyProcessEvent so that exceptions do not propagate
622 // out of DoDefaultAction
623 GetEventHandler()->SafelyProcessEvent(event);
624}
625
626void AButton::SetShift(bool shift)
627{
628 mWasShiftDown = shift;
629}
630
631void AButton::SetControl(bool control)
632{
633 mWasControlDown = control;
634}
635
637 s_AcceptsFocus = true;
638 return TempAllowFocus{ &s_AcceptsFocus };
639}
640
641#if wxUSE_ACCESSIBILITY
642
643AButtonAx::AButtonAx( wxWindow *window ):
644 WindowAccessible( window )
645{
646}
647
648AButtonAx::~AButtonAx()
649{
650}
651
652// Performs the default action. childId is 0 (the action for this object)
653// or > 0 (the action for a child).
654// Return wxACC_NOT_SUPPORTED if there is no default action for this
655// window (e.g. an edit control).
656wxAccStatus AButtonAx::DoDefaultAction(int WXUNUSED(childId))
657{
658 AButton *ab = wxDynamicCast( GetWindow(), AButton );
659
660 if(ab && ab->IsEnabled()) {
661 ab->mWasShiftDown = false;
662 ab->mWasControlDown = false;
663 ab->Click();
664 }
665
666 return wxACC_OK;
667}
668
669// Retrieves the address of an IDispatch interface for the specified child.
670// All objects must support this property.
671wxAccStatus AButtonAx::GetChild( int childId, wxAccessible** child )
672{
673 if( childId == wxACC_SELF )
674 {
675 *child = this;
676 }
677 else
678 {
679 *child = NULL;
680 }
681
682 return wxACC_OK;
683}
684
685// Gets the number of children.
686wxAccStatus AButtonAx::GetChildCount(int* childCount)
687{
688 *childCount = 0;
689
690 return wxACC_OK;
691}
692
693// Gets the default action for this object (0) or > 0 (the action for
694// a child). Return wxACC_OK even if there is no action. actionName
695// is the action, or the empty string if there is no action. The
696// retrieved string describes the action that is performed on an
697// object, not what the object does as a result. For example, a
698// toolbar button that prints a document has a default action of
699// "Press" rather than "Prints the current document."
700wxAccStatus AButtonAx::GetDefaultAction(int WXUNUSED(childId), wxString* actionName)
701{
702 *actionName = _( "Press" );
703
704 return wxACC_OK;
705}
706
707// Returns the description for this object or a child.
708wxAccStatus AButtonAx::GetDescription( int WXUNUSED(childId), wxString *description )
709{
710 description->clear();
711
712 return wxACC_OK;
713}
714
715// Gets the window with the keyboard focus.
716// If childId is 0 and child is NULL, no object in
717// this subhierarchy has the focus.
718// If this object has the focus, child should be 'this'.
719wxAccStatus AButtonAx::GetFocus(int* childId, wxAccessible** child)
720{
721 *childId = 0;
722 *child = this;
723
724 return wxACC_OK;
725}
726
727// Returns help text for this object or a child, similar to tooltip text.
728wxAccStatus AButtonAx::GetHelpText( int WXUNUSED(childId), wxString *helpText )
729{
730#if wxUSE_TOOLTIPS // Not available in wxX11
731 AButton *ab = wxDynamicCast( GetWindow(), AButton );
732
733 wxToolTip *pTip = ab->GetToolTip();
734 if( pTip )
735 {
736 *helpText = pTip->GetTip();
737 }
738
739 return wxACC_OK;
740#else
741 helpText->clear();
742
743 return wxACC_NOT_SUPPORTED;
744#endif
745}
746
747// Returns the keyboard shortcut for this object or child.
748// Return e.g. ALT+K
749wxAccStatus AButtonAx::GetKeyboardShortcut( int WXUNUSED(childId), wxString *shortcut )
750{
751 shortcut->clear();
752
753 return wxACC_OK;
754}
755
756// Returns the rectangle for this object (id = 0) or a child element (id > 0).
757// rect is in screen coordinates.
758wxAccStatus AButtonAx::GetLocation( wxRect& rect, int WXUNUSED(elementId) )
759{
760 AButton *ab = wxDynamicCast( GetWindow(), AButton );
761
762 rect = ab->GetRect();
763 rect.SetPosition( ab->GetParent()->ClientToScreen( rect.GetPosition() ) );
764
765 return wxACC_OK;
766}
767
768// Gets the name of the specified object.
769wxAccStatus AButtonAx::GetName(int WXUNUSED(childId), wxString* name)
770{
771 AButton *ab = wxDynamicCast( GetWindow(), AButton );
772
773 *name = ab->GetName();
774 if( name->empty() )
775 {
776 *name = ab->GetLabel();
777 }
778
779 if( name->empty() )
780 {
781 *name = _("Button");
782 }
783
784 return wxACC_OK;
785}
786
787// Returns a role constant.
788wxAccStatus AButtonAx::GetRole(int WXUNUSED(childId), wxAccRole* role)
789{
790 *role = wxROLE_SYSTEM_PUSHBUTTON;
791
792 return wxACC_OK;
793}
794
795// Gets a variant representing the selected children
796// of this object.
797// Acceptable values:
798// - a null variant (IsNull() returns TRUE)
799// - a list variant (GetType() == wxT("list"))
800// - an integer representing the selected child element,
801// or 0 if this object is selected (GetType() == wxT("long"))
802// - a "void*" pointer to a wxAccessible child object
803wxAccStatus AButtonAx::GetSelections( wxVariant * WXUNUSED(selections) )
804{
805 return wxACC_NOT_IMPLEMENTED;
806}
807
808// Returns a state constant.
809wxAccStatus AButtonAx::GetState(int WXUNUSED(childId), long* state)
810{
811 AButton *ab = wxDynamicCast( GetWindow(), AButton );
812
813 switch( ab->GetState() )
814 {
816 *state = wxACC_STATE_SYSTEM_PRESSED | wxACC_STATE_SYSTEM_FOCUSABLE;
817 break;
818
820 *state = wxACC_STATE_SYSTEM_HOTTRACKED | wxACC_STATE_SYSTEM_FOCUSABLE;
821 break;
822
824 *state = wxACC_STATE_SYSTEM_HOTTRACKED | wxACC_STATE_SYSTEM_PRESSED |
825 wxACC_STATE_SYSTEM_FOCUSABLE;
826 break;
827
829 *state = wxACC_STATE_SYSTEM_UNAVAILABLE;
830 break;
831
832 default:
833 *state = wxACC_STATE_SYSTEM_FOCUSABLE;
834 break;
835 }
836
837 *state |= ( ab == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
838
839 return wxACC_OK;
840}
841
842// Returns a localized string representing the value for the object
843// or child.
844wxAccStatus AButtonAx::GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue))
845{
846 return wxACC_NOT_SUPPORTED;
847}
848
849#endif
wxEVT_COMMAND_BUTTON_CLICKED
END_EVENT_TABLE()
const TranslatableString name
Definition: Distortion.cpp:82
#define XO(s)
Definition: Internat.h:31
#define _(s)
Definition: Internat.h:75
#define safenew
Definition: MemoryX.h:10
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
static std::once_flag flag
AButton * mButton
Definition: AButton.cpp:146
Listener(AButton *button)
Definition: AButton.cpp:149
int FilterEvent(wxEvent &event) override
Definition: AButton.cpp:181
A wxButton with mouse-over behaviour.
Definition: AButton.h:25
AButton(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis, bool toggle)
Definition: AButton.cpp:194
std::vector< ImageArr > mImages
Definition: AButton.h:182
wxRect mFocusRect
Definition: AButton.h:184
bool mUseDisabledAsDownHiliteImage
Definition: AButton.h:178
void SetShift(bool shift)
Definition: AButton.cpp:626
bool mButtonIsDown
Definition: AButton.h:175
bool mCursorIsInWindow
Definition: AButton.h:174
void SetControl(bool control)
Definition: AButton.cpp:631
void UseDisabledAsDownHiliteImage(bool flag)
Definition: AButton.cpp:264
AButtonState
Definition: AButton.h:128
@ AButtonUp
Definition: AButton.h:129
@ AButtonDis
Definition: AButton.h:133
@ AButtonOver
Definition: AButton.h:130
@ AButtonDown
Definition: AButton.h:131
@ AButtonOverDown
Definition: AButton.h:132
void PushDown()
Definition: AButton.cpp:597
std::unique_ptr< bool, Resetter > TempAllowFocus
Definition: AButton.h:143
bool mIsClicking
Definition: AButton.h:176
bool mWasShiftDown
Definition: AButton.h:171
void Click()
Definition: AButton.cpp:617
void OnSize(wxSizeEvent &event)
Definition: AButton.cpp:404
void OnSetFocus(wxFocusEvent &event)
Definition: AButton.cpp:551
void OnKillFocus(wxFocusEvent &event)
Definition: AButton.cpp:556
void UpdateStatus()
Definition: AButton.cpp:495
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:269
static TempAllowFocus TemporarilyAllowFocus()
Definition: AButton.cpp:636
static bool s_AcceptsFocus
Definition: AButton.h:141
void SetAlternateIdx(unsigned idx)
Definition: AButton.cpp:320
void OnPaint(wxPaintEvent &event)
Definition: AButton.cpp:385
bool HasAlternateImages(unsigned idx)
Definition: AButton.cpp:415
bool WasControlDown()
Definition: AButton.cpp:566
void OnErase(wxEraseEvent &event)
Definition: AButton.cpp:399
void SetFocusFromKbd() override
Definition: AButton.cpp:282
std::unique_ptr< Listener > mListener
Definition: AButton.h:187
void Disable()
Definition: AButton.cpp:580
friend class AButtonAx
Definition: AButton.h:26
bool mIsDoubleClicked
Definition: AButton.h:179
void OnMouseEvent(wxMouseEvent &event)
Definition: AButton.cpp:429
void SetAlternateImages(unsigned idx, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis)
Definition: AButton.cpp:304
void Enable()
Definition: AButton.cpp:571
void PopUp()
Definition: AButton.cpp:605
bool IsEnabled() const
Definition: AButton.h:85
bool mEnabled
Definition: AButton.h:177
bool WasShiftDown()
Definition: AButton.cpp:561
AButtonState GetState()
Definition: AButton.cpp:342
void OnKeyDown(wxKeyEvent &event)
Definition: AButton.cpp:523
bool mToggle
Definition: AButton.h:164
unsigned mAlternateIdx
Definition: AButton.h:163
void SetFocusRect(wxRect &r)
Definition: AButton.cpp:336
virtual ~AButton()
Definition: AButton.cpp:211
bool mWasControlDown
Definition: AButton.h:172
void FollowModifierKeys()
Definition: AButton.cpp:330
void OnCaptureLost(wxMouseCaptureLostEvent &event)
Definition: AButton.cpp:513
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:274
void Init(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis, bool toggle)
Definition: AButton.cpp:217
bool mForceFocusRect
Definition: AButton.h:185
static void DrawFocus(wxDC &dc, wxRect &r)
Definition: AColor.cpp:235
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:28
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=mainStatusBarField)
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
ImageRoll mArr[5]
Definition: AButton.h:181