Audacity  2.2.2
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:

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)
 
 AButton (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, wxImage up, wxImage over, wxImage down, wxImage overDown, wxImage dis, bool toggle)
 
virtual ~AButton ()
 
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 28 of file AButton.h.

Member Typedef Documentation

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

Definition at line 153 of file AButton.h.

Member Enumeration Documentation

Enumerator
AButtonUp 
AButtonOver 
AButtonDown 
AButtonOverDown 
AButtonDis 

Definition at line 138 of file AButton.h.

Constructor & Destructor Documentation

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 132 of file AButton.cpp.

References Init().

141  :
142  wxWindow()
143 {
144  Init(parent, id, pos, size,
145  up, over, down, overDown, dis,
146  toggle);
147 }
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:155
AButton::AButton ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size,
wxImage  up,
wxImage  over,
wxImage  down,
wxImage  overDown,
wxImage  dis,
bool  toggle 
)

Definition at line 114 of file AButton.cpp.

References Init().

123  :
124  wxWindow()
125 {
126  Init(parent, id, pos, size,
127  ImageRoll(up), ImageRoll(over),
128  ImageRoll(down), ImageRoll(overDown), ImageRoll(dis),
129  toggle);
130 }
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:155
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:29
AButton::~AButton ( )
virtual

Definition at line 149 of file AButton.cpp.

150 {
151  if(HasCapture())
152  ReleaseMouse();
153 }

Member Function Documentation

bool AButton::AcceptsFocus ( ) const
inlineoverride

Definition at line 62 of file AButton.h.

References s_AcceptsFocus.

62 { return s_AcceptsFocus; }
static bool s_AcceptsFocus
Definition: AButton.h:151
bool AButton::AcceptsFocusFromKeyboard ( ) const
inlineoverride

Definition at line 63 of file AButton.h.

References mEnabled.

63 { return mEnabled; }
bool mEnabled
Definition: AButton.h:187
void AButton::ClearDoubleClicked ( )
inline

Definition at line 127 of file AButton.h.

References mIsDoubleClicked.

127 { mIsDoubleClicked = false; }
bool mIsDoubleClicked
Definition: AButton.h:189
void AButton::Click ( )

Definition at line 537 of file AButton.cpp.

Referenced by OnKeyDown(), and OnMouseEvent().

538 {
539  wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
540  event.SetEventObject(this);
541  // Be sure to use SafelyProcessEvent so that exceptions do not propagate
542  // out of DoDefaultAction
543  GetEventHandler()->SafelyProcessEvent(event);
544 }
void AButton::Disable ( )

Definition at line 502 of file AButton.cpp.

References mEnabled.

Referenced by TranscriptionToolBar::Create(), and SetEnabled().

503 {
504  // Bug 1565: Tooltips not showing on disabled buttons.
505  // The fix is to NOT tell windows that the button is disabled.
506  // The button's appearance will still change to show it is disabled
507  // since we control that rather than windows.
508 #ifndef __WXMSW__
509  wxWindow::Enable(false);
510 #endif
511  mEnabled = false;
512  if (GetCapture()==this)
513  ReleaseMouse();
514  Refresh(false);
515 }
bool mEnabled
Definition: AButton.h:187
void AButton::Enable ( )

Definition at line 495 of file AButton.cpp.

References mEnabled.

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

496 {
497  wxWindow::Enable(true);
498  mEnabled = true;
499  Refresh(false);
500 }
bool mEnabled
Definition: AButton.h:187
void AButton::FollowModifierKeys ( )

Definition at line 258 of file AButton.cpp.

References mListener.

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

259 {
260  if(!mListener)
261  mListener = std::make_unique<Listener>(this);
262 }
std::unique_ptr< Listener > mListener
Definition: AButton.h:197
AButton::AButtonState AButton::GetState ( )

Definition at line 270 of file AButton.cpp.

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

Referenced by OnMouseEvent(), and OnPaint().

271 {
272  AButtonState state;
273 
274  if (!mEnabled && (!mToggle || !mButtonIsDown))
275  return AButtonDis;
276 
277  if (mCursorIsInWindow) {
278  if (mToggle) {
279  if (mIsClicking) {
280  state = mButtonIsDown ? AButtonUp : AButtonDown;
283  }
284  }
285  else {
289  }
290  }
291  }
292  else {
293  if (mIsClicking) {
295  }
296  else {
298  }
299  }
300  }
301  else {
302  //if (mToggle) {
303  state = mButtonIsDown ? AButtonDown : AButtonUp;
304  //}
305  //else {
306  //state = mButtonIsDown ? AButtonDown : AButtonUp;
307  //}
308  }
309 
310  return state;
311 }
AButtonState
Definition: AButton.h:138
bool mToggle
Definition: AButton.h:174
bool mCursorIsInWindow
Definition: AButton.h:184
bool mIsClicking
Definition: AButton.h:186
bool mButtonIsDown
Definition: AButton.h:185
bool mUseDisabledAsDownHiliteImage
Definition: AButton.h:188
bool mEnabled
Definition: AButton.h:187
bool AButton::HasAlternateImages ( unsigned  idx)
private

Definition at line 343 of file AButton.cpp.

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

344 {
345  if (mImages.size() <= idx)
346  return false;
347 
348  const ImageArr &images = mImages[idx];
349  const ImageRoll (&arr)[5] = images.mArr;
350  return (arr[0].Ok() &&
351  arr[1].Ok() &&
352  arr[2].Ok() &&
353  arr[3].Ok() &&
354  arr[4].Ok());
355 }
std::vector< ImageArr > mImages
Definition: AButton.h:192
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:29
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 155 of file AButton.cpp.

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

Referenced by AButton().

165 {
166  // Bug in wxWidgets 2.8.12: by default pressing Enter on an AButton is interpreted as
167  // a navigation event - move to next control. As a workaround, the style wxWANTS_CHARS
168  // results in all characters being available in the OnKeyDown function below. Note
169  // that OnKeyDown now has to handle navigation.
170  Create(parent, id, pos, size, wxWANTS_CHARS);
171 
172  mWasShiftDown = false;
173  mWasControlDown = false;
174  mButtonIsDown = false;
175  mIsClicking = false;
176  mEnabled = true;
177  mCursorIsInWindow = false;
178  mToggle = toggle;
180 
181  mImages.resize(1);
182  mImages[0].mArr[0] = up;
183  mImages[0].mArr[1] = over;
184  mImages[0].mArr[2] = down;
185  mImages[0].mArr[3] = overDown;
186  mImages[0].mArr[4] = dis;
187 
188  mAlternateIdx = 0;
189 
190  mFocusRect = GetClientRect().Deflate( 3, 3 );
191  mForceFocusRect = false;
192 
193  SetSizeHints(mImages[0].mArr[0].GetMinSize(),
194  mImages[0].mArr[0].GetMaxSize());
195 
196 #if wxUSE_ACCESSIBILITY
197  SetName( wxT("") );
198  SetAccessible(safenew AButtonAx(this));
199 #endif
200 }
bool mWasShiftDown
Definition: AButton.h:181
friend class AButtonAx
Definition: AButton.h:29
bool mToggle
Definition: AButton.h:174
#define safenew
Definition: Audacity.h:230
bool mCursorIsInWindow
Definition: AButton.h:184
std::vector< ImageArr > mImages
Definition: AButton.h:192
wxRect mFocusRect
Definition: AButton.h:194
bool mIsClicking
Definition: AButton.h:186
bool mButtonIsDown
Definition: AButton.h:185
unsigned mAlternateIdx
Definition: AButton.h:173
bool mUseDisabledAsDownHiliteImage
Definition: AButton.h:188
bool mWasControlDown
Definition: AButton.h:182
bool mEnabled
Definition: AButton.h:187
bool mForceFocusRect
Definition: AButton.h:195
void AButton::InteractionOver ( )
inline

Definition at line 132 of file AButton.h.

References mToggle, and PopUp().

Referenced by EditToolBar::OnButton().

132 { if( !mToggle ) PopUp();}
void PopUp()
Definition: AButton.cpp:525
bool mToggle
Definition: AButton.h:174
bool AButton::IsDoubleClicked ( ) const
inline

Definition at line 126 of file AButton.h.

References mIsDoubleClicked.

126 { return mIsDoubleClicked; }
bool mIsDoubleClicked
Definition: AButton.h:189
bool AButton::IsDown ( )
inline
bool AButton::IsEnabled ( ) const
inline

Definition at line 95 of file AButton.h.

References mEnabled.

95 { return mEnabled; }
bool mEnabled
Definition: AButton.h:187
void AButton::OnCaptureLost ( wxMouseCaptureLostEvent &  event)

Definition at line 437 of file AButton.cpp.

References OnMouseEvent().

438 {
439  wxMouseEvent e(wxEVT_LEFT_UP);
440  e.m_x = -1;
441  e.m_y = -1;
442  OnMouseEvent(e);
443 }
void OnMouseEvent(wxMouseEvent &event)
Definition: AButton.cpp:357
void AButton::OnErase ( wxEraseEvent &  event)

Definition at line 327 of file AButton.cpp.

328 {
329  // Ignore it to prevent flashing
330 }
void AButton::OnKeyDown ( wxKeyEvent &  event)

Definition at line 447 of file AButton.cpp.

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

448 {
449  switch( event.GetKeyCode() )
450  {
451  case WXK_RIGHT:
452  Navigate(wxNavigationKeyEvent::IsForward);
453  break;
454  case WXK_LEFT:
455  Navigate(wxNavigationKeyEvent::IsBackward);
456  break;
457  case WXK_TAB:
458  Navigate(event.ShiftDown()
459  ? wxNavigationKeyEvent::IsBackward
460  : wxNavigationKeyEvent::IsForward);
461  break;
462  case WXK_RETURN:
463  case WXK_NUMPAD_ENTER:
464  if( !mEnabled )
465  break;
466  mWasShiftDown = event.ShiftDown();
467  mWasControlDown = event.ControlDown();
468  Click();
469  break;
470  default:
471  event.Skip();
472  }
473 }
bool mWasShiftDown
Definition: AButton.h:181
bool mWasControlDown
Definition: AButton.h:182
bool mEnabled
Definition: AButton.h:187
void Click()
Definition: AButton.cpp:537
void AButton::OnKillFocus ( wxFocusEvent &  event)

Definition at line 480 of file AButton.cpp.

481 {
482  Refresh( false );
483 }
void AButton::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 357 of file AButton.cpp.

References Click(), GetActiveProject(), GetState(), mButtonIsDown, mCursorIsInWindow, mEnabled, mIsClicking, mIsDoubleClicked, mToggle, mWasControlDown, mWasShiftDown, AudacityProject::TP_DisplayStatusMessage(), and UpdateStatus().

Referenced by OnCaptureLost().

358 {
359  wxSize clientSize = GetClientSize();
360  AButtonState prevState = GetState();
361 
362  if (event.Entering()) {
363  // Bug 1201: On Mac, unsetting and re-setting the tooltip may be needed
364  // to make it pop up when we want it.
365  auto text = GetToolTipText();
366  UnsetToolTip();
367  SetToolTip(text);
368  mCursorIsInWindow = true;
369  }
370  else if (event.Leaving())
371  mCursorIsInWindow = false;
372  else
374  (event.m_x >= 0 && event.m_y >= 0 &&
375  event.m_x < clientSize.x && event.m_y < clientSize.y);
376 
377  if (mEnabled && event.IsButton()) {
378  if (event.ButtonIsDown(wxMOUSE_BTN_ANY)) {
379  mIsClicking = true;
380  if (event.ButtonDClick())
381  mIsDoubleClicked = true;
382  if( !HasCapture() )
383  CaptureMouse();
384  }
385  else if (mIsClicking) {
386  mIsClicking = false;
387 
388  if (HasCapture())
389  ReleaseMouse();
390 
391  if (mCursorIsInWindow && (mToggle || !mButtonIsDown)) {
392  if (mToggle)
394  else
395  mButtonIsDown = true;
396 
397  mWasShiftDown = event.ShiftDown();
398  mWasControlDown = event.ControlDown();
399 
400  Click();
401  }
402  }
403  }
404 
405  // Only redraw and change tooltips if the state has changed.
406  AButtonState newState = GetState();
407 
408  if (newState != prevState) {
409  Refresh(false);
410 
411  if (mCursorIsInWindow)
412  UpdateStatus();
413  else {
415  }
416  }
417  else
418  event.Skip();
419 }
bool mWasShiftDown
Definition: AButton.h:181
bool mIsDoubleClicked
Definition: AButton.h:189
AButtonState
Definition: AButton.h:138
bool mToggle
Definition: AButton.h:174
bool mCursorIsInWindow
Definition: AButton.h:184
bool mIsClicking
Definition: AButton.h:186
bool mButtonIsDown
Definition: AButton.h:185
void TP_DisplayStatusMessage(const wxString &msg) override
Definition: Project.cpp:5356
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
AButtonState GetState()
Definition: AButton.cpp:270
bool mWasControlDown
Definition: AButton.h:182
bool mEnabled
Definition: AButton.h:187
void Click()
Definition: AButton.cpp:537
void UpdateStatus()
Definition: AButton.cpp:421
void AButton::OnPaint ( wxPaintEvent &  event)

Definition at line 313 of file AButton.cpp.

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

314 {
315  wxBufferedPaintDC dc(this);
316 
317  AButtonState buttonState = GetState();
318 
319  mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect());
320 
321  if( this == wxWindow::FindFocus() )
322  {
324  }
325 }
AButtonState
Definition: AButton.h:138
static void DrawFocus(wxDC &dc, wxRect &r)
Definition: AColor.cpp:171
std::vector< ImageArr > mImages
Definition: AButton.h:192
wxRect mFocusRect
Definition: AButton.h:194
unsigned mAlternateIdx
Definition: AButton.h:173
AButtonState GetState()
Definition: AButton.cpp:270
void AButton::OnSetFocus ( wxFocusEvent &  event)

Definition at line 475 of file AButton.cpp.

476 {
477  Refresh( false );
478 }
void AButton::OnSize ( wxSizeEvent &  event)

Definition at line 332 of file AButton.cpp.

References mFocusRect, and mForceFocusRect.

333 {
334  if (!mForceFocusRect)
335  {
336  mFocusRect = GetClientRect().Deflate( 3, 3 );
337  }
338  Refresh(false);
339 }
wxRect mFocusRect
Definition: AButton.h:194
bool mForceFocusRect
Definition: AButton.h:195
void AButton::PopUp ( )
void AButton::PushDown ( )
void AButton::SetAlternateIdx ( unsigned  idx)

Definition at line 248 of file AButton.cpp.

References mAlternateIdx.

Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), ControlToolBar::SetRecord(), MixerTrackCluster::UpdateMute(), and MixerTrackCluster::UpdateSolo().

249 {
250  // If alternate-image-state is already correct then
251  // nothing to do (saves repainting button).
252  if( mAlternateIdx == idx )
253  return;
254  mAlternateIdx = idx;
255  Refresh(false);
256 }
unsigned mAlternateIdx
Definition: AButton.h:173
void AButton::SetAlternateImages ( unsigned  idx,
ImageRoll  up,
ImageRoll  over,
ImageRoll  down,
ImageRoll  overDown,
ImageRoll  dis 
)

Definition at line 232 of file AButton.cpp.

References mImages.

Referenced by ToolBar::MakeAlternateImages().

238 {
239  if (1 + idx > mImages.size())
240  mImages.resize(1 + idx);
241  mImages[idx].mArr[0] = up;
242  mImages[idx].mArr[1] = over;
243  mImages[idx].mArr[2] = down;
244  mImages[idx].mArr[3] = overDown;
245  mImages[idx].mArr[4] = dis;
246 }
std::vector< ImageArr > mImages
Definition: AButton.h:192
void AButton::SetAlternateImages ( unsigned  idx,
wxImage  up,
wxImage  over,
wxImage  down,
wxImage  overDown,
wxImage  dis 
)

Definition at line 216 of file AButton.cpp.

References mImages.

222 {
223  if (1 + idx > mImages.size())
224  mImages.resize(1 + idx);
225  mImages[idx].mArr[0] = ImageRoll(up);
226  mImages[idx].mArr[1] = ImageRoll(over);
227  mImages[idx].mArr[2] = ImageRoll(down);
228  mImages[idx].mArr[3] = ImageRoll(overDown);
229  mImages[idx].mArr[4] = ImageRoll(dis);
230 }
std::vector< ImageArr > mImages
Definition: AButton.h:192
An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed piece...
Definition: ImageRoll.h:29
void AButton::SetButtonToggles ( bool  toggler)
inline

Definition at line 129 of file AButton.h.

References mToggle.

129 { mToggle = toggler;}
bool mToggle
Definition: AButton.h:174
void AButton::SetControl ( bool  control)

Definition at line 551 of file AButton.cpp.

References mWasControlDown.

Referenced by ControlToolBar::SetPlay().

552 {
553  mWasControlDown = control;
554 }
bool mWasControlDown
Definition: AButton.h:182
void AButton::SetEnabled ( bool  state)
inline
void AButton::SetFocusFromKbd ( )
override

Definition at line 210 of file AButton.cpp.

References TemporarilyAllowFocus().

211 {
212  auto temp = TemporarilyAllowFocus();
213  SetFocus();
214 }
static TempAllowFocus TemporarilyAllowFocus()
Definition: AButton.cpp:556
void AButton::SetFocusRect ( wxRect &  r)

Definition at line 264 of file AButton.cpp.

References mFocusRect, and mForceFocusRect.

Referenced by ControlToolBar::MakeButton().

265 {
266  mFocusRect = r;
267  mForceFocusRect = true;
268 }
wxRect mFocusRect
Definition: AButton.h:194
bool mForceFocusRect
Definition: AButton.h:195
void AButton::SetShift ( bool  shift)

Definition at line 546 of file AButton.cpp.

References mWasShiftDown.

Referenced by ControlToolBar::SetPlay().

547 {
548  mWasShiftDown = shift;
549 }
bool mWasShiftDown
Definition: AButton.h:181
auto AButton::TemporarilyAllowFocus ( )
static

Definition at line 556 of file AButton.cpp.

Referenced by AudacityProject::NextOrPrevFrame(), ToolManager::RestoreFocus(), and SetFocusFromKbd().

556  {
557  s_AcceptsFocus = true;
558  return TempAllowFocus{ &s_AcceptsFocus };
559 }
std::unique_ptr< bool, Resetter > TempAllowFocus
Definition: AButton.h:153
static bool s_AcceptsFocus
Definition: AButton.h:151
void AButton::Toggle ( )
inline

Definition at line 133 of file AButton.h.

References mButtonIsDown, PopUp(), and PushDown().

133 { mButtonIsDown ? PopUp() : PushDown();}
void PopUp()
Definition: AButton.cpp:525
bool mButtonIsDown
Definition: AButton.h:185
void PushDown()
Definition: AButton.cpp:517
void AButton::UpdateStatus ( )

Definition at line 421 of file AButton.cpp.

References _(), GetActiveProject(), mCursorIsInWindow, mEnabled, and AudacityProject::TP_DisplayStatusMessage().

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

422 {
423  if (mCursorIsInWindow) {
424 #if wxUSE_TOOLTIPS // Not available in wxX11
425  // Display the tooltip in the status bar
426  wxToolTip * pTip = this->GetToolTip();
427  if( pTip ) {
428  wxString tipText = pTip->GetTip();
429  if (!mEnabled)
430  tipText += _(" (disabled)");
432  }
433 #endif
434  }
435 }
bool mCursorIsInWindow
Definition: AButton.h:184
void TP_DisplayStatusMessage(const wxString &msg) override
Definition: Project.cpp:5356
_("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
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
bool mEnabled
Definition: AButton.h:187
void AButton::UseDisabledAsDownHiliteImage ( bool  flag)

Definition at line 202 of file AButton.cpp.

References mUseDisabledAsDownHiliteImage.

203 {
205 }
bool mUseDisabledAsDownHiliteImage
Definition: AButton.h:188
bool AButton::WasControlDown ( )

Definition at line 490 of file AButton.cpp.

References mWasControlDown.

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

491 {
492  return mWasControlDown;
493 }
bool mWasControlDown
Definition: AButton.h:182
bool AButton::WasShiftDown ( )

Friends And Related Function Documentation

friend class AButtonAx
friend

Definition at line 29 of file AButton.h.

Referenced by Init().

Member Data Documentation

unsigned AButton::mAlternateIdx
private

Definition at line 173 of file AButton.h.

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

bool AButton::mButtonIsDown
private

Definition at line 185 of file AButton.h.

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

bool AButton::mCursorIsInWindow
private

Definition at line 184 of file AButton.h.

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

bool AButton::mEnabled
private
wxRect AButton::mFocusRect
private

Definition at line 194 of file AButton.h.

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

bool AButton::mForceFocusRect
private

Definition at line 195 of file AButton.h.

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

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

Definition at line 192 of file AButton.h.

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

bool AButton::mIsClicking
private

Definition at line 186 of file AButton.h.

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

bool AButton::mIsDoubleClicked {}
private

Definition at line 189 of file AButton.h.

Referenced by ClearDoubleClicked(), IsDoubleClicked(), and OnMouseEvent().

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

Definition at line 197 of file AButton.h.

Referenced by FollowModifierKeys().

bool AButton::mToggle
private

Definition at line 174 of file AButton.h.

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

bool AButton::mUseDisabledAsDownHiliteImage
private

Definition at line 188 of file AButton.h.

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

bool AButton::mWasControlDown
private

Definition at line 182 of file AButton.h.

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

bool AButton::mWasShiftDown
private

Definition at line 181 of file AButton.h.

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

bool AButton::s_AcceptsFocus { false }
staticprivate

Definition at line 151 of file AButton.h.

Referenced by AcceptsFocus().


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