![]() |
Audacity 3.2.0
|
A wxButton with mouse-over behaviour. More...
#include <AButton.h>
Classes | |
| class | Listener |
| struct | Resetter |
Public Types | |
| enum | Type { TextButton , ImageButton , FrameButton , FrameTextVButton , FrameTextHButton } |
| enum | AButtonState { AButtonUp , AButtonOver , AButtonDown , AButtonOverDown , AButtonDis , AButtonStateCount } |
Public Member Functions | |
| AButton (wxWindow *parent=nullptr, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, bool toggle=false) | |
| AButton (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis, bool toggle) | |
| virtual | ~AButton () |
| void | SetButtonType (Type type) |
| void | SetFrameMid (int mid) |
| void | SetToolTip (const TranslatableString &toolTip) |
| void | SetLabel (const TranslatableString &label) |
| bool | AcceptsFocus () const override |
| bool | AcceptsFocusFromKeyboard () const override |
| void | SetFocusFromKbd () override |
| void | SetImages (const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis) |
| void | SetAlternateImages (unsigned idx, const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis) |
| void | SetIcon (const wxImage &icon) |
| void | SetIcon (AButtonState state, const wxImage &icon) |
| void | SetIcons (const wxImage &up, const wxImage &down, const wxImage &disabled) |
| void | SetAlternateIcon (unsigned idx, const wxImage &icon) |
| void | SetAlternateIcon (unsigned idx, AButtonState state, const wxImage &icon) |
| void | SetAlternateIcons (unsigned idx, const wxImage &up, const wxImage &down, const wxImage &disabled) |
| void | SetAlternateIdx (unsigned idx) |
| void | FollowModifierKeys () |
| void | SetFocusRect (const 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) |
| void | OnCharHook (wxKeyEvent &event) |
| bool | WasShiftDown () |
| bool | WasControlDown () |
| bool | IsDown () |
| bool | IsDoubleClicked () const |
| void | ClearDoubleClicked () |
| void | SetButtonToggles (bool toggler) |
| bool | IsToggle () const noexcept |
| void | InteractionOver () |
| void | Toggle () |
| void | Click () |
| void | SetShift (bool shift) |
| void | SetControl (bool control) |
| wxSize | DoGetBestClientSize () const override |
| 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) const |
| void | Init (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, bool toggle) |
Private Attributes | |
| unsigned | mAlternateIdx {0} |
| bool | mToggle {false} |
| bool | mWasShiftDown {false} |
| bool | mWasControlDown {false} |
| bool | mCursorIsInWindow {false} |
| bool | mButtonIsDown {false} |
| bool | mIsClicking {false} |
| bool | mEnabled {true} |
| bool | mUseDisabledAsDownHiliteImage {false} |
| bool | mIsDoubleClicked {false} |
| std::vector< std::array< wxImage, AButtonStateCount > > | mIcons |
| std::vector< std::array< wxImage, AButtonStateCount > > | mImages |
| wxRect | mFocusRect |
| bool | mForceFocusRect {false} |
| std::unique_ptr< Listener > | mListener |
| Type | mType {ImageButton} |
| int | mFrameMid {1} |
Static Private Attributes | |
| static bool | s_AcceptsFocus { false } |
Friends | |
| class | AButtonAx |
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.
|
private |
| Enumerator | |
|---|---|
| AButtonUp | |
| AButtonOver | |
| AButtonDown | |
| AButtonOverDown | |
| AButtonDis | |
| AButtonStateCount | |
Definition at line 119 of file AButton.h.
| enum AButton::Type |
| Enumerator | |
|---|---|
| TextButton | |
| ImageButton | |
| FrameButton | |
| FrameTextVButton | |
| FrameTextHButton | |
Definition at line 110 of file AButton.h.
| AButton::AButton | ( | wxWindow * | parent = nullptr, |
| wxWindowID | id = wxID_ANY, |
||
| const wxPoint & | pos = wxDefaultPosition, |
||
| const wxSize & | size = wxDefaultSize, |
||
| bool | toggle = false |
||
| ) |
Definition at line 118 of file AButton.cpp.
| AButton::AButton | ( | wxWindow * | parent, |
| wxWindowID | id, | ||
| const wxPoint & | pos, | ||
| const wxSize & | size, | ||
| const wxImage & | up, | ||
| const wxImage & | over, | ||
| const wxImage & | down, | ||
| const wxImage & | overDown, | ||
| const wxImage & | dis, | ||
| bool | toggle | ||
| ) |
Definition at line 123 of file AButton.cpp.
References AButtonUp, Init(), mImages, SetAlternateImages(), and size.
|
virtual |
Definition at line 142 of file AButton.cpp.
|
inlineoverride |
| void AButton::Click | ( | ) |
Definition at line 684 of file AButton.cpp.
References wxEVT_COMMAND_BUTTON_CLICKED.
Referenced by OnCharHook(), and OnMouseEvent().
| void AButton::Disable | ( | ) |
Definition at line 647 of file AButton.cpp.
References mEnabled.
Referenced by TranscriptionToolBar::Create(), AudioSetupToolBar::EnableDisableButtons(), and RealtimeEffectPanel::ResetTrack().
|
override |
Definition at line 703 of file AButton.cpp.
References AButtonUp, FrameButton, FrameTextHButton, FrameTextVButton, HasAlternateImages(), mAlternateIdx, mFrameMid, mIcons, mImages, mType, and TextButton.
| void AButton::Enable | ( | ) |
Definition at line 638 of file AButton.cpp.
References mEnabled.
Referenced by TranscriptionToolBar::Create(), AudioSetupToolBar::EnableDisableButtons(), and RealtimeEffectPanel::SetTrack().
| void AButton::FollowModifierKeys | ( | ) |
Definition at line 298 of file AButton.cpp.
References mListener.
Referenced by ControlToolBar::Populate(), and TranscriptionToolBar::Populate().
| AButton::AButtonState AButton::GetState | ( | ) |
Definition at line 310 of file AButton.cpp.
References AButtonDis, AButtonDown, AButtonOver, AButtonOverDown, AButtonUp, mButtonIsDown, mCursorIsInWindow, mEnabled, mIsClicking, mToggle, and mUseDisabledAsDownHiliteImage.
Referenced by OnMouseEvent(), and OnPaint().
|
private |
Definition at line 465 of file AButton.cpp.
References mImages.
Referenced by DoGetBestClientSize(), and OnPaint().
|
private |
Definition at line 174 of file AButton.cpp.
References AButtonAx, ThemeBase::Colour(), mFocusRect, mToggle, safenew, size, theTheme, and wxT().
Referenced by AButton().
|
inline |
Definition at line 227 of file AButton.h.
Referenced by ControlToolBar::EnableDisableButtons(), RealtimeEffectPanel::MakeMasterEffectPane(), RealtimeEffectPanel::MakeTrackEffectPane(), EffectUIHost::OnEnable(), AudioSetupToolBar::ReCreateButtons(), ControlToolBar::ReCreateButtons(), and ControlToolBar::StateForStatusBar().
|
inline |
|
noexcept |
| void AButton::OnCaptureLost | ( | wxMouseCaptureLostEvent & | event | ) |
Definition at line 560 of file AButton.cpp.
References OnMouseEvent().
| void AButton::OnCharHook | ( | wxKeyEvent & | event | ) |
Definition at line 592 of file AButton.cpp.
References Click(), mButtonIsDown, mEnabled, mToggle, mWasControlDown, and mWasShiftDown.
| void AButton::OnErase | ( | wxEraseEvent & | event | ) |
Definition at line 449 of file AButton.cpp.
| void AButton::OnKeyDown | ( | wxKeyEvent & | event | ) |
Definition at line 570 of file AButton.cpp.
| void AButton::OnKillFocus | ( | wxFocusEvent & | event | ) |
Definition at line 623 of file AButton.cpp.
| void AButton::OnMouseEvent | ( | wxMouseEvent & | event | ) |
Definition at line 478 of file AButton.cpp.
References Click(), FindProjectFromWindow(), ProjectStatus::Get(), GetState(), mButtonIsDown, mCursorIsInWindow, mEnabled, mIsClicking, mIsDoubleClicked, mToggle, mWasControlDown, mWasShiftDown, ProjectStatus::Set(), and UpdateStatus().
Referenced by OnCaptureLost().
| void AButton::OnPaint | ( | wxPaintEvent & | event | ) |
Definition at line 348 of file AButton.cpp.
References AButtonUp, AColor::DrawFocus(), AColor::DrawFrame(), AColor::DrawHStretch(), FrameButton, FrameTextHButton, FrameTextVButton, GetState(), HasAlternateImages(), ImageButton, mAlternateIdx, mFocusRect, mFrameMid, mIcons, mImages, mType, TrackArt::TruncateText(), and wxImage().
| void AButton::OnSetFocus | ( | wxFocusEvent & | event | ) |
Definition at line 618 of file AButton.cpp.
| void AButton::OnSize | ( | wxSizeEvent & | event | ) |
Definition at line 454 of file AButton.cpp.
References mFocusRect, and mForceFocusRect.
| void AButton::PopUp | ( | ) |
Definition at line 672 of file AButton.cpp.
References mButtonIsDown.
Referenced by ExpandingToolBar::Collapse(), ToolsToolBar::DoToolChanged(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), AudioSetupToolBar::OnAudioSetup(), ControlToolBar::OnFF(), ControlToolBar::OnIdle(), ControlToolBar::OnRewind(), RealtimeEffectPanel::RealtimeEffectPanel(), ToolBar::SetButton(), TranscriptionToolBar::SetButton(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), RealtimeEffectPanel::SetTrack(), ExpandingToolBar::TryAutoCollapse(), AdornedRulerPanel::UpdateButtonStates(), EffectUIHost::UpdateControls(), and MixerTrackCluster::UpdateForStateChange().
| void AButton::PushDown | ( | ) |
Definition at line 664 of file AButton.cpp.
References mButtonIsDown.
Referenced by ToolsToolBar::DoToolChanged(), ExpandingToolBar::Expand(), ControlToolBar::OnFF(), ControlToolBar::OnIdle(), ControlToolBar::OnRewind(), RealtimeEffectPanel::RealtimeEffectPanel(), AudioSetupToolBar::ReCreateButtons(), ControlToolBar::ReCreateButtons(), ToolBar::SetButton(), TranscriptionToolBar::SetButton(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), ControlToolBar::SetStop(), RealtimeEffectPanel::SetTrack(), ExpandingToolBar::TryAutoExpand(), EffectUIHost::UpdateControls(), and MixerTrackCluster::UpdateForStateChange().
| void AButton::SetAlternateIcon | ( | unsigned | idx, |
| AButtonState | state, | ||
| const wxImage & | icon | ||
| ) |
| void AButton::SetAlternateIcon | ( | unsigned | idx, |
| const wxImage & | icon | ||
| ) |
Definition at line 257 of file AButton.cpp.
References AButtonDis, AButtonDown, AButtonOver, AButtonOverDown, AButtonUp, and mIcons.
Referenced by SetIcon().
| void AButton::SetAlternateIcons | ( | unsigned | idx, |
| const wxImage & | up, | ||
| const wxImage & | down, | ||
| const wxImage & | disabled | ||
| ) |
Definition at line 275 of file AButton.cpp.
References AButtonDis, AButtonDown, AButtonOver, AButtonOverDown, AButtonUp, and mIcons.
Referenced by ControlToolBar::Populate(), and SetIcons().
| void AButton::SetAlternateIdx | ( | unsigned | idx | ) |
Definition at line 287 of file AButton.cpp.
References mAlternateIdx.
Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), ControlToolBar::OnIdle(), ControlToolBar::ReCreateButtons(), ControlToolBar::SetPlay(), TranscriptionToolBar::SetPlaying(), and MixerTrackCluster::UpdateForStateChange().
| void AButton::SetAlternateImages | ( | unsigned | idx, |
| const wxImage & | up, | ||
| const wxImage & | over, | ||
| const wxImage & | down, | ||
| const wxImage & | overDown, | ||
| const wxImage & | dis | ||
| ) |
Definition at line 226 of file AButton.cpp.
References AButtonDis, AButtonDown, AButtonOver, AButtonOverDown, AButtonUp, and mImages.
Referenced by AButton(), ToolBar::MakeAlternateImages(), and SetImages().
|
inline |
Definition at line 233 of file AButton.h.
Referenced by ControlToolBar::Populate().
| void AButton::SetButtonType | ( | Type | type | ) |
Definition at line 148 of file AButton.cpp.
References mType.
Referenced by AudioSetupToolBar::MakeAudioSetupButton(), SelectionBar::MakeSetupButton(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), and MeterToolBar::Populate().
| void AButton::SetControl | ( | bool | control | ) |
Definition at line 698 of file AButton.cpp.
References mWasControlDown.
Referenced by ControlToolBar::SetPlay().
|
inline |
Definition at line 201 of file AButton.h.
Referenced by audacity::cloud::ShareAudioToolbar::EnableDisableButtons(), ControlToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), RealtimeEffectListWindow::ReloadEffectsList(), and TranscriptionToolBar::SetEnabled().
|
override |
Definition at line 215 of file AButton.cpp.
References BasicUI::SetFocus(), and TemporarilyAllowFocus().
| void AButton::SetFocusRect | ( | const wxRect & | r | ) |
Definition at line 304 of file AButton.cpp.
References mFocusRect, and mForceFocusRect.
Referenced by ToolBar::MakeButton().
| void AButton::SetFrameMid | ( | int | mid | ) |
Definition at line 159 of file AButton.cpp.
References FrameButton, mFrameMid, and mType.
Referenced by MeterToolBar::Populate().
| void AButton::SetIcon | ( | AButtonState | state, |
| const wxImage & | icon | ||
| ) |
Definition at line 247 of file AButton.cpp.
References SetAlternateIcon().
| void AButton::SetIcon | ( | const wxImage & | icon | ) |
Definition at line 242 of file AButton.cpp.
References SetAlternateIcon().
Referenced by AudioSetupToolBar::MakeAudioSetupButton(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), and MeterToolBar::Populate().
Definition at line 252 of file AButton.cpp.
References SetAlternateIcons().
| void AButton::SetImages | ( | const wxImage & | up, |
| const wxImage & | over, | ||
| const wxImage & | down, | ||
| const wxImage & | overDown, | ||
| const wxImage & | dis | ||
| ) |
Definition at line 221 of file AButton.cpp.
References SetAlternateImages().
Referenced by AudioSetupToolBar::MakeAudioSetupButton(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), and MeterToolBar::Populate().
| void AButton::SetLabel | ( | const TranslatableString & | label | ) |
Definition at line 205 of file AButton.cpp.
References FrameButton, mType, TranslatableString::Stripped(), and TranslatableString::Translation().
Referenced by TranscriptionToolBar::AddButton(), AudioSetupToolBar::MakeAudioSetupButton(), ToolBar::MakeButton(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), MeterToolBar::Populate(), and AdornedRulerPanel::UpdateButtonStates().
| void AButton::SetShift | ( | bool | shift | ) |
Definition at line 693 of file AButton.cpp.
References mWasShiftDown.
Referenced by ControlToolBar::SetPlay().
| void AButton::SetToolTip | ( | const TranslatableString & | toolTip | ) |
Definition at line 200 of file AButton.cpp.
References TranslatableString::Stripped(), and TranslatableString::Translation().
Referenced by MeterToolBar::Populate(), TranscriptionToolBar::RegenerateTooltips(), and ToolBar::SetButtonToolTip().
|
static |
Definition at line 764 of file AButton.cpp.
References s_AcceptsFocus.
Referenced by anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), ToolManager::RestoreFocus(), and SetFocusFromKbd().
| void AButton::UpdateStatus | ( | ) |
Definition at line 542 of file AButton.cpp.
References FindProjectFromWindow(), ProjectStatus::Get(), mCursorIsInWindow, mEnabled, ProjectStatus::Set(), Verbatim(), and XO().
Referenced by OnMouseEvent(), and AdornedRulerPanel::UpdateButtonStates().
| void AButton::UseDisabledAsDownHiliteImage | ( | bool | flag | ) |
Definition at line 195 of file AButton.cpp.
References flag, and mUseDisabledAsDownHiliteImage.
| bool AButton::WasControlDown | ( | ) |
Definition at line 633 of file AButton.cpp.
References mWasControlDown.
Referenced by TranscriptionToolBar::OnPlaySpeed(), and ControlToolBar::PlayDefault().
| bool AButton::WasShiftDown | ( | ) |
Definition at line 628 of file AButton.cpp.
References mWasShiftDown.
Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), ControlToolBar::OnFF(), ControlToolBar::OnRecord(), ControlToolBar::OnRewind(), ControlToolBar::PlayDefault(), and ControlToolBar::ReCreateButtons().
|
private |
Definition at line 263 of file AButton.h.
Referenced by DoGetBestClientSize(), OnPaint(), and SetAlternateIdx().
|
private |
Definition at line 275 of file AButton.h.
Referenced by GetState(), OnCharHook(), OnMouseEvent(), PopUp(), and PushDown().
|
private |
Definition at line 274 of file AButton.h.
Referenced by GetState(), OnMouseEvent(), and UpdateStatus().
|
private |
Definition at line 277 of file AButton.h.
Referenced by Disable(), Enable(), GetState(), OnCharHook(), OnMouseEvent(), and UpdateStatus().
|
private |
|
private |
Definition at line 285 of file AButton.h.
Referenced by OnSize(), and SetFocusRect().
|
private |
Definition at line 290 of file AButton.h.
Referenced by DoGetBestClientSize(), OnPaint(), and SetFrameMid().
|
private |
Definition at line 281 of file AButton.h.
Referenced by DoGetBestClientSize(), OnPaint(), SetAlternateIcon(), and SetAlternateIcons().
|
private |
Definition at line 282 of file AButton.h.
Referenced by AButton(), DoGetBestClientSize(), HasAlternateImages(), OnPaint(), and SetAlternateImages().
|
private |
Definition at line 276 of file AButton.h.
Referenced by GetState(), and OnMouseEvent().
|
private |
Definition at line 279 of file AButton.h.
Referenced by OnMouseEvent().
|
private |
Definition at line 287 of file AButton.h.
Referenced by FollowModifierKeys().
|
private |
Definition at line 264 of file AButton.h.
Referenced by GetState(), Init(), OnCharHook(), and OnMouseEvent().
|
private |
Definition at line 289 of file AButton.h.
Referenced by DoGetBestClientSize(), OnPaint(), SetButtonType(), SetFrameMid(), and SetLabel().
|
private |
Definition at line 278 of file AButton.h.
Referenced by GetState(), and UseDisabledAsDownHiliteImage().
|
private |
Definition at line 272 of file AButton.h.
Referenced by OnCharHook(), OnMouseEvent(), SetControl(), and WasControlDown().
|
private |
Definition at line 271 of file AButton.h.
Referenced by OnCharHook(), OnMouseEvent(), SetShift(), and WasShiftDown().
|
staticprivate |
Definition at line 250 of file AButton.h.
Referenced by TemporarilyAllowFocus().