Audacity  2.2.0
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.

Member Typedef Documentation

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

Member Enumeration Documentation

Enumerator
AButtonUp 
AButtonOver 
AButtonDown 
AButtonOverDown 
AButtonDis 

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 
)

References Init().

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

References Init().

AButton::~AButton ( )
virtual

Member Function Documentation

bool AButton::AcceptsFocus ( ) const
inlineoverride

References s_AcceptsFocus.

bool AButton::AcceptsFocusFromKeyboard ( ) const
inlineoverride

References mEnabled.

void AButton::ClearDoubleClicked ( )
inline

References mIsDoubleClicked.

void AButton::Click ( )

Referenced by OnKeyDown(), and OnMouseEvent().

void AButton::Disable ( )

References mEnabled.

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

void AButton::Enable ( )
void AButton::FollowModifierKeys ( )
bool AButton::HasAlternateImages ( unsigned  idx)
private

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

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
void AButton::InteractionOver ( )
inline

References mToggle, and PopUp().

Referenced by SelectionBar::OnButton(), and EditToolBar::OnButton().

bool AButton::IsDoubleClicked ( ) const
inline

References mIsDoubleClicked.

bool AButton::IsEnabled ( ) const
inline

References mEnabled.

void AButton::OnCaptureLost ( wxMouseCaptureLostEvent &  event)

References OnMouseEvent().

void AButton::OnErase ( wxEraseEvent &  event)
void AButton::OnKeyDown ( wxKeyEvent &  event)
void AButton::OnKillFocus ( wxFocusEvent &  event)
void AButton::OnPaint ( wxPaintEvent &  event)
void AButton::OnSetFocus ( wxFocusEvent &  event)
void AButton::OnSize ( wxSizeEvent &  event)

References mFocusRect, and mForceFocusRect.

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

References mImages.

Referenced by ToolBar::MakeAlternateImages().

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

References mImages.

void AButton::SetButtonToggles ( bool  toggler)
inline

References mToggle.

void AButton::SetControl ( bool  control)

References mWasControlDown.

Referenced by ControlToolBar::SetPlay().

void AButton::SetFocusFromKbd ( )
override
void AButton::SetFocusRect ( wxRect &  r)

References mFocusRect, and mForceFocusRect.

Referenced by ControlToolBar::MakeButton().

void AButton::SetShift ( bool  shift)
auto AButton::TemporarilyAllowFocus ( )
static
void AButton::Toggle ( )
inline

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

void AButton::UseDisabledAsDownHiliteImage ( bool  flag)
bool AButton::WasControlDown ( )

Friends And Related Function Documentation

friend class AButtonAx
friend

Referenced by Init().

Member Data Documentation

unsigned AButton::mAlternateIdx
private

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

bool AButton::mButtonIsDown
private
bool AButton::mCursorIsInWindow
private
wxRect AButton::mFocusRect
private

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

bool AButton::mForceFocusRect
private

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

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

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

bool AButton::mIsDoubleClicked {}
private
std::unique_ptr<Listener> AButton::mListener
private

Referenced by FollowModifierKeys().

bool AButton::mToggle
private
bool AButton::mUseDisabledAsDownHiliteImage
private
bool AButton::mWasControlDown
private
bool AButton::mWasShiftDown
private
bool AButton::s_AcceptsFocus { false }
staticprivate

Referenced by AcceptsFocus().


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