Audacity  3.2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
AButton Class Referencefinal

A wxButton with mouse-over behaviour. More...

#include <AButton.h>

Inheritance diagram for AButton:
[legend]
Collaboration diagram for AButton:
[legend]

Classes

struct  ImageArr
 
class  Listener
 
struct  Resetter
 

Public Types

enum  AButtonState {
  AButtonUp, AButtonOver, AButtonDown, AButtonOverDown,
  AButtonDis
}
 

Public Member Functions

 AButton (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis, bool toggle)
 
virtual ~ AButton ()
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetLabel (const TranslatableString &label)
 
bool AcceptsFocus () const override
 
bool AcceptsFocusFromKeyboard () const override
 
void SetFocusFromKbd () override
 
void SetAlternateImages (unsigned idx, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis)
 
void SetAlternateImages (unsigned idx, wxImage up, wxImage over, wxImage down, wxImage overDown, wxImage dis)
 
void SetAlternateIdx (unsigned idx)
 
void FollowModifierKeys ()
 
void SetFocusRect (wxRect &r)
 
bool IsEnabled () const
 
void Disable ()
 
void Enable ()
 
void SetEnabled (bool state)
 
void PushDown ()
 
void PopUp ()
 
void OnErase (wxEraseEvent &event)
 
void OnPaint (wxPaintEvent &event)
 
void OnSize (wxSizeEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void UpdateStatus ()
 
void OnCaptureLost (wxMouseCaptureLostEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void OnSetFocus (wxFocusEvent &event)
 
void OnKillFocus (wxFocusEvent &event)
 
bool WasShiftDown ()
 
bool WasControlDown ()
 
bool IsDown ()
 
bool IsDoubleClicked () const
 
void ClearDoubleClicked ()
 
void SetButtonToggles (bool toggler)
 
void InteractionOver ()
 
void Toggle ()
 
void Click ()
 
void SetShift (bool shift)
 
void SetControl (bool control)
 
AButtonState GetState ()
 
void UseDisabledAsDownHiliteImage (bool flag)
 

Static Public Member Functions

static TempAllowFocus TemporarilyAllowFocus ()
 

Private Types

using TempAllowFocus = std::unique_ptr< bool, Resetter >
 

Private Member Functions

bool HasAlternateImages (unsigned idx)
 
void Init (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ImageRoll up, ImageRoll over, ImageRoll down, ImageRoll overDown, ImageRoll dis, bool toggle)
 

Private Attributes

unsigned mAlternateIdx
 
bool mToggle
 
bool mWasShiftDown
 
bool mWasControlDown
 
bool mCursorIsInWindow
 
bool mButtonIsDown
 
bool mIsClicking
 
bool mEnabled
 
bool mUseDisabledAsDownHiliteImage
 
bool mIsDoubleClicked {}
 
std::vector< ImageArrmImages
 
wxRect mFocusRect
 
bool mForceFocusRect
 
std::unique_ptr< ListenermListener
 

Static Private Attributes

static bool s_AcceptsFocus { false }
 

Friends

class AButtonAx
 

Detailed Description

A wxButton with mouse-over behaviour.

AButton is a custom button class for Audacity. The main feature it supports that a wxButton does not is mouseovers.

It uses an image for all of its states: up, over, down, and disabled, allowing any sort of customization you want. Currently it does not support transparency effects, so the image musts be rectangular and opaque.

Definition at line 25 of file AButton.h.

Member Typedef Documentation

◆ TempAllowFocus

using AButton::TempAllowFocus = std::unique_ptr<bool, Resetter>
private

Definition at line 143 of file AButton.h.

Member Enumeration Documentation

◆ AButtonState

Enumerator
AButtonUp 
AButtonOver 
AButtonDown 
AButtonOverDown 
AButtonDis 

Definition at line 128 of file AButton.h.

128  {
129  AButtonUp,
130  AButtonOver,
131  AButtonDown,
133  AButtonDis
134  };

Constructor & Destructor Documentation

◆ AButton()

AButton::AButton ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size,
ImageRoll  up,
ImageRoll  over,
ImageRoll  down,
ImageRoll  overDown,
ImageRoll  dis,
bool  toggle 
)

Definition at line 194 of file AButton.cpp.

203  :
204  wxWindow()
205 {
206  Init(parent, id, pos, size,
207  up, over, down, overDown, dis,
208  toggle);
209 }

References Init(), and size.

Here is the call graph for this function:

◆ ~ AButton()

virtual AButton::~ AButton ( )
virtual

Member Function Documentation

◆ AcceptsFocus()

bool AButton::AcceptsFocus ( ) const
inlineoverride

Definition at line 52 of file AButton.h.

52 { return s_AcceptsFocus; }

◆ AcceptsFocusFromKeyboard()

bool AButton::AcceptsFocusFromKeyboard ( ) const
inlineoverride

Definition at line 53 of file AButton.h.

53 { return mEnabled; }

◆ ClearDoubleClicked()

void AButton::ClearDoubleClicked ( )
inline

Definition at line 117 of file AButton.h.

117 { mIsDoubleClicked = false; }

◆ Click()

void AButton::Click ( )

Definition at line 617 of file AButton.cpp.

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 }

References wxEVT_COMMAND_BUTTON_CLICKED.

Referenced by OnKeyDown(), and OnMouseEvent().

Here is the caller graph for this function:

◆ Disable()

void AButton::Disable ( )

Definition at line 580 of file AButton.cpp.

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 }

References mEnabled.

Referenced by TranscriptionToolBar::Create().

Here is the caller graph for this function:

◆ Enable()

void AButton::Enable ( )

Definition at line 571 of file AButton.cpp.

572 {
573  bool changed = wxWindow::Enable(true);
574  if ( !mEnabled ) {
575  mEnabled = true;
576  Refresh(false);
577  }
578 }

References mEnabled.

Referenced by TranscriptionToolBar::Create(), and ScrubbingToolBar::EnableDisableButtons().

Here is the caller graph for this function:

◆ FollowModifierKeys()

void AButton::FollowModifierKeys ( )

Definition at line 330 of file AButton.cpp.

331 {
332  if(!mListener)
333  mListener = std::make_unique<Listener>(this);
334 }

References mListener.

Referenced by ControlToolBar::Populate(), and TranscriptionToolBar::Populate().

Here is the caller graph for this function:

◆ GetState()

AButton::AButtonState AButton::GetState ( )

Definition at line 342 of file AButton.cpp.

343 {
344  AButtonState state;
345 
346  if (!mEnabled && (!mToggle || !mButtonIsDown))
347  return AButtonDis;
348 
349  if (mCursorIsInWindow) {
350  if (mToggle) {
351  if (mIsClicking) {
352  state = mButtonIsDown ? AButtonUp : AButtonDown;
355  }
356  }
357  else {
361  }
362  }
363  }
364  else {
365  if (mIsClicking) {
367  }
368  else {
370  }
371  }
372  }
373  else {
374  //if (mToggle) {
375  state = mButtonIsDown ? AButtonDown : AButtonUp;
376  //}
377  //else {
378  //state = mButtonIsDown ? AButtonDown : AButtonUp;
379  //}
380  }
381 
382  return state;
383 }

References AButtonDis, AButtonDown, AButtonOver, AButtonOverDown, AButtonUp, mButtonIsDown, mCursorIsInWindow, mEnabled, mIsClicking, mToggle, and mUseDisabledAsDownHiliteImage.

Referenced by OnMouseEvent(), and OnPaint().

Here is the caller graph for this function:

◆ HasAlternateImages()

bool AButton::HasAlternateImages ( unsigned  idx)
private

Definition at line 415 of file AButton.cpp.

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 }

References AButton::ImageArr::mArr, and mImages.

◆ Init()

void AButton::Init ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size,
ImageRoll  up,
ImageRoll  over,
ImageRoll  down,
ImageRoll  overDown,
ImageRoll  dis,
bool  toggle 
)
private

Definition at line 217 of file AButton.cpp.

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 }

References AButtonAx, mAlternateIdx, mButtonIsDown, mCursorIsInWindow, mEnabled, mFocusRect, mForceFocusRect, mImages, mIsClicking, mToggle, mUseDisabledAsDownHiliteImage, mWasControlDown, mWasShiftDown, safenew, and size.

Referenced by AButton().

Here is the caller graph for this function:

◆ InteractionOver()

void AButton::InteractionOver ( )
inline

Definition at line 122 of file AButton.h.

122 { if( !mToggle ) PopUp();}

Referenced by EditToolBar::OnButton().

Here is the caller graph for this function:

◆ IsDoubleClicked()

bool AButton::IsDoubleClicked ( ) const
inline

Definition at line 116 of file AButton.h.

116 { return mIsDoubleClicked; }

◆ IsDown()

bool AButton::IsDown ( )
inline

Definition at line 113 of file AButton.h.

113 { return mButtonIsDown;}

Referenced by ControlToolBar::EnableDisableButtons(), ControlToolBar::ReCreateButtons(), and ControlToolBar::StateForStatusBar().

Here is the caller graph for this function:

◆ IsEnabled()

bool AButton::IsEnabled ( ) const
inline

Definition at line 85 of file AButton.h.

85 { return mEnabled; }

◆ OnCaptureLost()

void AButton::OnCaptureLost ( wxMouseCaptureLostEvent &  event)

Definition at line 513 of file AButton.cpp.

514 {
515  wxMouseEvent e(wxEVT_LEFT_UP);
516  e.m_x = -1;
517  e.m_y = -1;
518  OnMouseEvent(e);
519 }

References OnMouseEvent().

Here is the call graph for this function:

◆ OnErase()

void AButton::OnErase ( wxEraseEvent &  event)

Definition at line 399 of file AButton.cpp.

400 {
401  // Ignore it to prevent flashing
402 }

◆ OnKeyDown()

void AButton::OnKeyDown ( wxKeyEvent &  event)

Definition at line 523 of file AButton.cpp.

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 }

References Click(), mEnabled, mWasControlDown, and mWasShiftDown.

Here is the call graph for this function:

◆ OnKillFocus()

void AButton::OnKillFocus ( wxFocusEvent &  event)

Definition at line 556 of file AButton.cpp.

557 {
558  Refresh( false );
559 }

◆ OnMouseEvent()

void AButton::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 429 of file AButton.cpp.

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 
463  if (mCursorIsInWindow && (mToggle || !mButtonIsDown)) {
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 
483  if (mCursorIsInWindow)
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 }

References Click(), FindProjectFromWindow(), ProjectStatus::Get(), GetState(), mButtonIsDown, mCursorIsInWindow, mEnabled, mIsClicking, mIsDoubleClicked, mToggle, mWasControlDown, mWasShiftDown, ProjectStatus::Set(), and UpdateStatus().

Referenced by OnCaptureLost().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPaint()

void AButton::OnPaint ( wxPaintEvent &  event)

Definition at line 385 of file AButton.cpp.

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 }

References AColor::DrawFocus(), GetState(), mAlternateIdx, mFocusRect, and mImages.

Here is the call graph for this function:

◆ OnSetFocus()

void AButton::OnSetFocus ( wxFocusEvent &  event)

Definition at line 551 of file AButton.cpp.

552 {
553  Refresh( false );
554 }

◆ OnSize()

void AButton::OnSize ( wxSizeEvent &  event)

Definition at line 404 of file AButton.cpp.

405 {
406  if (!mForceFocusRect)
407  {
408  mFocusRect = GetClientRect().Deflate( 3, 3 );
409  }
410  Refresh(false);
411 }

References mFocusRect, and mForceFocusRect.

◆ PopUp()

void AButton::PopUp ( )

Definition at line 605 of file AButton.cpp.

606 {
607  if (mButtonIsDown) {
608  mButtonIsDown = false;
609 
610  this->Refresh(false);
611  }
612 
613  if (GetCapture()==this)
614  ReleaseMouse();
615 }

References mButtonIsDown.

Referenced by ExpandingToolBar::Collapse(), ToolsToolBar::DoToolChanged(), EditToolBar::ForAllButtons(), ControlToolBar::OnFF(), ControlToolBar::OnIdle(), ControlToolBar::OnRewind(), ToolBar::SetButton(), TranscriptionToolBar::SetButton(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), ExpandingToolBar::TryAutoCollapse(), AdornedRulerPanel::UpdateButtonStates(), and MixerTrackCluster::UpdateForStateChange().

Here is the caller graph for this function:

◆ PushDown()

void AButton::PushDown ( )

◆ SetAlternateIdx()

void AButton::SetAlternateIdx ( unsigned  idx)

Definition at line 320 of file AButton.cpp.

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 }

References mAlternateIdx.

Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), ControlToolBar::OnIdle(), ControlToolBar::ReCreateButtons(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), and MixerTrackCluster::UpdateForStateChange().

Here is the caller graph for this function:

◆ SetAlternateImages() [1/2]

void AButton::SetAlternateImages ( unsigned  idx,
ImageRoll  up,
ImageRoll  over,
ImageRoll  down,
ImageRoll  overDown,
ImageRoll  dis 
)

Definition at line 304 of file AButton.cpp.

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 }

References mImages.

Referenced by ToolBar::MakeAlternateImages().

Here is the caller graph for this function:

◆ SetAlternateImages() [2/2]

void AButton::SetAlternateImages ( unsigned  idx,
wxImage  up,
wxImage  over,
wxImage  down,
wxImage  overDown,
wxImage  dis 
)

Definition at line 288 of file AButton.cpp.

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 }

References mImages.

◆ SetButtonToggles()

void AButton::SetButtonToggles ( bool  toggler)
inline

Definition at line 119 of file AButton.h.

119 { mToggle = toggler;}

◆ SetControl()

void AButton::SetControl ( bool  control)

Definition at line 631 of file AButton.cpp.

632 {
633  mWasControlDown = control;
634 }

References mWasControlDown.

Referenced by ControlToolBar::SetPlay().

Here is the caller graph for this function:

◆ SetEnabled()

void AButton::SetEnabled ( bool  state)
inline

Definition at line 88 of file AButton.h.

88  {
89  state ? Enable() : Disable();
90  }

Referenced by ControlToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), EditToolBar::ForAllButtons(), EditToolBar::Populate(), and TranscriptionToolBar::SetEnabled().

Here is the caller graph for this function:

◆ SetFocusFromKbd()

void AButton::SetFocusFromKbd ( )
override

Definition at line 282 of file AButton.cpp.

283 {
284  auto temp = TemporarilyAllowFocus();
285  SetFocus();
286 }

References TemporarilyAllowFocus().

Here is the call graph for this function:

◆ SetFocusRect()

void AButton::SetFocusRect ( wxRect &  r)

Definition at line 336 of file AButton.cpp.

337 {
338  mFocusRect = r;
339  mForceFocusRect = true;
340 }

References mFocusRect, and mForceFocusRect.

Referenced by ControlToolBar::MakeButton().

Here is the caller graph for this function:

◆ SetLabel()

void AButton::SetLabel ( const TranslatableString label)

Definition at line 274 of file AButton.cpp.

275 {
276  wxWindow::SetLabel( toolTip.Stripped().Translation() );
277 }

References TranslatableString::Stripped(), and TranslatableString::Translation().

Referenced by EditToolBar::AddButton(), ScrubbingToolBar::AddButton(), TranscriptionToolBar::AddButton(), ControlToolBar::MakeButton(), ToolsToolBar::MakeTool(), and AdornedRulerPanel::UpdateButtonStates().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetShift()

void AButton::SetShift ( bool  shift)

Definition at line 626 of file AButton.cpp.

627 {
628  mWasShiftDown = shift;
629 }

References mWasShiftDown.

Referenced by ControlToolBar::SetPlay().

Here is the caller graph for this function:

◆ SetToolTip()

void AButton::SetToolTip ( const TranslatableString toolTip)

Definition at line 269 of file AButton.cpp.

270 {
271  wxWindow::SetToolTip( toolTip.Stripped().Translation() );
272 }

References TranslatableString::Stripped(), and TranslatableString::Translation().

Referenced by TranscriptionToolBar::RegenerateTooltips(), and ToolBar::SetButtonToolTip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TemporarilyAllowFocus()

auto AButton::TemporarilyAllowFocus ( )
static

Definition at line 636 of file AButton.cpp.

636  {
637  s_AcceptsFocus = true;
638  return TempAllowFocus{ &s_AcceptsFocus };
639 }

Referenced by anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), ToolManager::RestoreFocus(), and SetFocusFromKbd().

Here is the caller graph for this function:

◆ Toggle()

void AButton::Toggle ( )
inline

Definition at line 123 of file AButton.h.

123 { mButtonIsDown ? PopUp() : PushDown();}

◆ UpdateStatus()

void AButton::UpdateStatus ( )

Definition at line 495 of file AButton.cpp.

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 }

References FindProjectFromWindow(), ProjectStatus::Get(), mCursorIsInWindow, mEnabled, ProjectStatus::Set(), Verbatim(), and XO.

Referenced by OnMouseEvent(), and AdornedRulerPanel::UpdateButtonStates().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UseDisabledAsDownHiliteImage()

void AButton::UseDisabledAsDownHiliteImage ( bool  flag)

Definition at line 264 of file AButton.cpp.

265 {
267 }

References flag, and mUseDisabledAsDownHiliteImage.

◆ WasControlDown()

bool AButton::WasControlDown ( )

Definition at line 566 of file AButton.cpp.

567 {
568  return mWasControlDown;
569 }

References mWasControlDown.

Referenced by TranscriptionToolBar::OnPlaySpeed(), and ControlToolBar::PlayDefault().

Here is the caller graph for this function:

◆ WasShiftDown()

bool AButton::WasShiftDown ( )

Definition at line 561 of file AButton.cpp.

562 {
563  return mWasShiftDown;
564 }

References mWasShiftDown.

Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), ControlToolBar::OnFF(), ControlToolBar::OnRecord(), ControlToolBar::OnRewind(), ControlToolBar::PlayDefault(), and ControlToolBar::ReCreateButtons().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ AButtonAx

friend class AButtonAx
friend

Definition at line 26 of file AButton.h.

Referenced by Init().

Member Data Documentation

◆ mAlternateIdx

unsigned AButton::mAlternateIdx
private

Definition at line 163 of file AButton.h.

Referenced by Init(), OnPaint(), and SetAlternateIdx().

◆ mButtonIsDown

bool AButton::mButtonIsDown
private

Definition at line 175 of file AButton.h.

Referenced by GetState(), Init(), OnMouseEvent(), PopUp(), and PushDown().

◆ mCursorIsInWindow

bool AButton::mCursorIsInWindow
private

Definition at line 174 of file AButton.h.

Referenced by GetState(), Init(), OnMouseEvent(), and UpdateStatus().

◆ mEnabled

bool AButton::mEnabled
private

Definition at line 177 of file AButton.h.

Referenced by Disable(), Enable(), GetState(), Init(), OnKeyDown(), OnMouseEvent(), and UpdateStatus().

◆ mFocusRect

wxRect AButton::mFocusRect
private

Definition at line 184 of file AButton.h.

Referenced by Init(), OnPaint(), OnSize(), and SetFocusRect().

◆ mForceFocusRect

bool AButton::mForceFocusRect
private

Definition at line 185 of file AButton.h.

Referenced by Init(), OnSize(), and SetFocusRect().

◆ mImages

std::vector<ImageArr> AButton::mImages
private

Definition at line 182 of file AButton.h.

Referenced by HasAlternateImages(), Init(), OnPaint(), and SetAlternateImages().

◆ mIsClicking

bool AButton::mIsClicking
private

Definition at line 176 of file AButton.h.

Referenced by GetState(), Init(), and OnMouseEvent().

◆ mIsDoubleClicked

bool AButton::mIsDoubleClicked {}
private

Definition at line 179 of file AButton.h.

Referenced by OnMouseEvent().

◆ mListener

std::unique_ptr<Listener> AButton::mListener
private

Definition at line 187 of file AButton.h.

Referenced by FollowModifierKeys().

◆ mToggle

bool AButton::mToggle
private

Definition at line 164 of file AButton.h.

Referenced by GetState(), Init(), and OnMouseEvent().

◆ mUseDisabledAsDownHiliteImage

bool AButton::mUseDisabledAsDownHiliteImage
private

Definition at line 178 of file AButton.h.

Referenced by GetState(), Init(), and UseDisabledAsDownHiliteImage().

◆ mWasControlDown

bool AButton::mWasControlDown
private

Definition at line 172 of file AButton.h.

Referenced by Init(), OnKeyDown(), OnMouseEvent(), SetControl(), and WasControlDown().

◆ mWasShiftDown

bool AButton::mWasShiftDown
private

Definition at line 171 of file AButton.h.

Referenced by Init(), OnKeyDown(), OnMouseEvent(), SetShift(), and WasShiftDown().

◆ s_AcceptsFocus

bool AButton::s_AcceptsFocus { false }
staticprivate

Definition at line 141 of file AButton.h.


The documentation for this class was generated from the following files:
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
AButton::TemporarilyAllowFocus
static TempAllowFocus TemporarilyAllowFocus()
Definition: AButton.cpp:636
AButton::AButtonOverDown
@ AButtonOverDown
Definition: AButton.h:132
AButton::mUseDisabledAsDownHiliteImage
bool mUseDisabledAsDownHiliteImage
Definition: AButton.h:178
flag
static std::once_flag flag
Definition: WaveformView.cpp:1133
AButton::mButtonIsDown
bool mButtonIsDown
Definition: AButton.h:175
AButton::PopUp
void PopUp()
Definition: AButton.cpp:605
AButton::AButtonUp
@ AButtonUp
Definition: AButton.h:129
AButton::TempAllowFocus
std::unique_ptr< bool, Resetter > TempAllowFocus
Definition: AButton.h:143
AButton::mWasShiftDown
bool mWasShiftDown
Definition: AButton.h:171
AButton::mIsDoubleClicked
bool mIsDoubleClicked
Definition: AButton.h:179
AButton::Disable
void Disable()
Definition: AButton.cpp:580
AButton::mAlternateIdx
unsigned mAlternateIdx
Definition: AButton.h:163
XO
#define XO(s)
Definition: Internat.h:31
AButton::mToggle
bool mToggle
Definition: AButton.h:164
AButton::AButtonOver
@ AButtonOver
Definition: AButton.h:130
FindProjectFromWindow
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
Definition: ProjectWindowBase.cpp:44
AButton::mImages
std::vector< ImageArr > mImages
Definition: AButton.h:182
wxEVT_COMMAND_BUTTON_CLICKED
wxEVT_COMMAND_BUTTON_CLICKED
Definition: AdornedRulerPanel.cpp:693
AButton::AButtonDown
@ AButtonDown
Definition: AButton.h:131
ProjectStatus::Set
void Set(const TranslatableString &msg, StatusBarField field=mainStatusBarField)
Definition: ProjectStatus.cpp:63
AButton::Enable
void Enable()
Definition: AButton.cpp:571
ImageRoll
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
AButton::GetState
AButtonState GetState()
Definition: AButton.cpp:342
AButton::UpdateStatus
void UpdateStatus()
Definition: AButton.cpp:495
AButton::PushDown
void PushDown()
Definition: AButton.cpp:597
AButton::mFocusRect
wxRect mFocusRect
Definition: AButton.h:184
AButton::mIsClicking
bool mIsClicking
Definition: AButton.h:176
AButton::s_AcceptsFocus
static bool s_AcceptsFocus
Definition: AButton.h:141
AColor::DrawFocus
static void DrawFocus(wxDC &dc, wxRect &r)
Definition: AColor.cpp:157
AButton::Click
void Click()
Definition: AButton.cpp:617
AButton::Init
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
AButton::OnMouseEvent
void OnMouseEvent(wxMouseEvent &event)
Definition: AButton.cpp:429
AButton::mListener
std::unique_ptr< Listener > mListener
Definition: AButton.h:187
AButton::AButtonAx
friend class AButtonAx
Definition: AButton.h:26
AButton::AButtonState
AButtonState
Definition: AButton.h:128
AButton::mEnabled
bool mEnabled
Definition: AButton.h:177
ProjectStatus::Get
static ProjectStatus & Get(AudacityProject &project)
Definition: ProjectStatus.cpp:21
AButton::mWasControlDown
bool mWasControlDown
Definition: AButton.h:172
Verbatim
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Definition: TranslatableString.h:321
AButton::mForceFocusRect
bool mForceFocusRect
Definition: AButton.h:185
AButton::AButtonDis
@ AButtonDis
Definition: AButton.h:133
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
AButton::mCursorIsInWindow
bool mCursorIsInWindow
Definition: AButton.h:174
TranslatableString::Stripped
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object
Definition: TranslatableString.h:198
safenew
#define safenew
Definition: MemoryX.h:10
BasicUI::Button::Ok
@ Ok
One button.