Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
ToolBar Class Referenceabstract

Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed. More...

#include <ToolBar.h>

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

Public Types

enum  DockID { TopDockID = 1 , BotDockID = 2 }
 Identifies one of the docking areas for toolbars. More...
 
using Holder = wxWindowPtr< ToolBar >
 

Public Member Functions

 ToolBar (AudacityProject &project, const TranslatableString &label, const Identifier &section, bool resizable=false)
 
virtual ~ToolBar ()
 
virtual bool ShownByDefault () const
 Whether the toolbar should be shown by default. Default implementation returns true. More...
 
virtual bool HideAfterReset () const
 Default implementation returns false. More...
 
virtual DockID DefaultDockID () const
 Which dock the toolbar defaults into. Default implementation chooses the top dock. More...
 
bool AcceptsFocus () const override
 
bool AcceptsFocusFromKeyboard () const override
 
virtual void SetToDefaultSize ()
 
virtual void Create (wxWindow *parent)
 
virtual void EnableDisableButtons ()=0
 
virtual void ReCreateButtons ()
 
void UpdatePrefs () override
 
virtual void RegenerateTooltips ()=0
 
int GetIndex () const
 Get a value used for computing cascading positions of undocked bars. More...
 
void SetIndex (int index)
 Set a value used for computing cascading positions of undocked bars. More...
 
TranslatableString GetTitle ()
 
TranslatableString GetLabel ()
 
Identifier GetSection ()
 
ToolDockGetDock ()
 
void SetPreferredNeighbors (Identifier left, Identifier top={})
 
void SetLabel (const TranslatableString &label)
 
virtual void SetDocked (ToolDock *dock, bool pushed)
 
std::pair< Identifier, IdentifierPreferredNeighbors () const noexcept
 Defaults to (NoBarID, NoBarId) More...
 
virtual bool Expose (bool show=true)
 
bool IsResizable () const
 
bool IsVisible () const
 
bool IsDocked () const
 
bool IsPositioned ()
 
void SetVisible (bool bVisible)
 
void SetPositioned ()
 
virtual int GetInitialWidth ()
 Resizable toolbars should implement these. More...
 
virtual int GetMinToolbarWidth ()
 
virtual wxSize GetDockedSize ()
 
wxSize GetSmartDockedSize ()
 
virtual void ResizingDone ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static AButtonMakeButton (wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
 
static AButtonMakeButton (ToolBar *parent, teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, int id, bool processdownevents, const TranslatableString &label)
 
static void MakeAlternateImages (AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size)
 
static void SetButtonToolTip (AudacityProject &project, AButton &button, const ComponentInterfaceSymbol commands[], size_t nCommands)
 
static void MakeButtonBackgroundsSmall ()
 
static void MakeButtonBackgroundsLarge ()
 

Protected Member Functions

void SetButton (bool down, AButton *button)
 
wxBoxSizer * GetSizer ()
 
void Add (wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
 
void Add (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
 
void Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
 
void AddSpacer (int size=14)
 
void AddStretchSpacer (int prop=1)
 
void Detach (wxWindow *window)
 
void Detach (wxSizer *sizer)
 
void Updated ()
 
int GetResizeGrabberWidth ()
 Returns the width in pixels of the resizer element. More...
 
virtual void Populate ()=0
 
virtual void Repaint (wxDC *dc)=0
 
void OnErase (wxEraseEvent &event)
 
void OnPaint (wxPaintEvent &event)
 
void OnMouseEvents (wxMouseEvent &event)
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Static Protected Member Functions

static void MakeMacRecoloredImage (teBmps eBmpOut, teBmps eBmpIn)
 
static void MakeMacRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size)
 
static void MakeRecoloredImage (teBmps eBmpOut, teBmps eBmpIn)
 
static void MakeRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size)
 
- Static Protected Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Protected Attributes

AudacityProjectmProject
 
TranslatableString mLabel
 
Identifier mSection
 
int mIndex {0}
 

Private Member Functions

void SetLabel (const wxString &label) override
 
void Init (wxWindow *parent, int type, const wxString &title, const wxString &label)
 

Private Attributes

wxWindow * mParent
 
GrabbermGrabber
 
ToolBarResizermResizer
 
wxBoxSizer * mHSizer
 
Identifier mPreferredLeftNeighbor
 
Identifier mPreferredTopNeighbor
 
bool mVisible
 
bool mResizable
 
bool mPositioned
 

Friends

class ToolBarResizer
 

Detailed Description

Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.

Definition at line 71 of file ToolBar.h.

Member Typedef Documentation

◆ Holder

using ToolBar::Holder = wxWindowPtr<ToolBar>

Definition at line 78 of file ToolBar.h.

Member Enumeration Documentation

◆ DockID

Identifies one of the docking areas for toolbars.

Enumerator
TopDockID 
BotDockID 

Definition at line 92 of file ToolBar.h.

92 {
93 TopDockID = 1,
94 BotDockID = 2
95 };
@ TopDockID
Definition: ToolBar.h:93
@ BotDockID
Definition: ToolBar.h:94

Constructor & Destructor Documentation

◆ ToolBar()

ToolBar::ToolBar ( AudacityProject project,
const TranslatableString label,
const Identifier section,
bool  resizable = false 
)

Definition at line 328 of file ToolBar.cpp.

333, mProject{ project }
334{
335 // Save parameters
336 mLabel = label;
337 mSection = section;
338 mResizable = resizable;
339
340 // Initialize everything
341 mParent = NULL;
342 mHSizer = NULL;
343 mVisible = false;
344 mPositioned = false;
345
346 mGrabber = NULL;
347 mResizer = NULL;
348}
TranslatableString label
Definition: TagsEditor.cpp:165
const auto project
Identifier mSection
Definition: ToolBar.h:250
AudacityProject & mProject
Definition: ToolBar.h:248
bool mVisible
Definition: ToolBar.h:265
wxWindow * mParent
Definition: ToolBar.h:255
TranslatableString mLabel
Definition: ToolBar.h:249
wxBoxSizer * mHSizer
Definition: ToolBar.h:260
bool mPositioned
Definition: ToolBar.h:267
bool mResizable
Definition: ToolBar.h:266
Grabber * mGrabber
Definition: ToolBar.h:257
ToolBarResizer * mResizer
Definition: ToolBar.h:258

References project.

◆ ~ToolBar()

ToolBar::~ToolBar ( )
virtual

Definition at line 353 of file ToolBar.cpp.

354{
355}

Member Function Documentation

◆ AcceptsFocus()

bool ToolBar::AcceptsFocus ( ) const
inlineoverride

Definition at line 100 of file ToolBar.h.

100{ return false; };

◆ AcceptsFocusFromKeyboard()

bool ToolBar::AcceptsFocusFromKeyboard ( ) const
override

Definition at line 357 of file ToolBar.cpp.

358{
359 for(auto& child : GetChildren())
360 if(child->AcceptsFocusFromKeyboard())
361 return true;
362 return false;
363}

◆ Add() [1/3]

void ToolBar::Add ( int  width,
int  height,
int  proportion = 0,
int  flag = 0,
int  border = 0,
wxObject *  userData = NULL 
)
protected

Definition at line 741 of file ToolBar.cpp.

747{
748 mHSizer->Add( width,
749 height,
750 proportion,
751 flag,
752 border,
753 userData );
754}
static std::once_flag flag

References flag, and mHSizer.

◆ Add() [2/3]

void ToolBar::Add ( wxSizer *  sizer,
int  proportion = 0,
int  flag = 0,
int  border = 0,
wxObject *  userData = NULL 
)
protected

Definition at line 725 of file ToolBar.cpp.

730{
731 mHSizer->Add( sizer,
732 proportion,
733 flag,
734 border,
735 userData );
736}

References flag, and mHSizer.

◆ Add() [3/3]

void ToolBar::Add ( wxWindow *  window,
int  proportion = 0,
int  flag = wxALIGN_TOP,
int  border = 0,
wxObject *  userData = NULL 
)
protected

◆ AddSpacer()

void ToolBar::AddSpacer ( int  size = 14)
protected

Definition at line 759 of file ToolBar.cpp.

760{
761 mHSizer->AddSpacer( size );
762}

References mHSizer, and size.

◆ AddStretchSpacer()

void ToolBar::AddStretchSpacer ( int  prop = 1)
protected

Definition at line 767 of file ToolBar.cpp.

768{
769 mHSizer->AddStretchSpacer( prop );
770}

References mHSizer.

◆ Create()

void ToolBar::Create ( wxWindow *  parent)
virtual

Reimplemented in audacity::cloud::ShareAudioToolbar, AudioSetupToolBar, ControlToolBar, CutCopyPasteToolBar, DeviceToolBar, EditToolBar, MeterToolBar, SelectionBar, SnappingToolBar, SpectralSelectionBar, TimeSignatureToolBar, ToolsToolBar, and TranscriptionToolBar.

Definition at line 492 of file ToolBar.cpp.

493{
494 // Save parameters
495 mParent = parent;
496
497 // Create the window and label it
499 wxID_ANY,
500 wxDefaultPosition,
501 wxDefaultSize,
502 wxNO_BORDER | wxTAB_TRAVERSAL,
503 GetTitle() );
505
506 // Go do the rest of the creation
508
509 // ToolManager depends on this appearing to be visible for proper dock construction
510 mVisible = true;
511}
virtual void ReCreateButtons()
Definition: ToolBar.cpp:533
TranslatableString GetTitle()
Definition: ToolBar.cpp:383
TranslatableString GetLabel()
Definition: ToolBar.cpp:392
void SetLabel(const TranslatableString &label)
bool Create(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))

References wxPanelWrapper::Create(), GetLabel(), GetTitle(), mParent, mVisible, ReCreateButtons(), and wxPanelWrapper::SetLabel().

Referenced by audacity::cloud::ShareAudioToolbar::Create(), AudioSetupToolBar::Create(), ControlToolBar::Create(), CutCopyPasteToolBar::Create(), DeviceToolBar::Create(), EditToolBar::Create(), MeterToolBar::Create(), SelectionBar::Create(), SnappingToolBar::Create(), SpectralSelectionBar::Create(), TimeSignatureToolBar::Create(), ToolsToolBar::Create(), TranscriptionToolBar::Create(), and ToolManager::ReadConfig().

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

◆ DefaultDockID()

ToolBar::DockID ToolBar::DefaultDockID ( ) const
virtual

Which dock the toolbar defaults into. Default implementation chooses the top dock.

Reimplemented in SelectionBar, SnappingToolBar, SpectralSelectionBar, TimeSignatureToolBar, TimeToolBar, and TranscriptionToolBar.

Definition at line 375 of file ToolBar.cpp.

376{
377 return TopDockID;
378}

References TopDockID.

Referenced by ToolManager::ReadConfig(), and ToolManager::Reset().

Here is the caller graph for this function:

◆ Detach() [1/2]

void ToolBar::Detach ( wxSizer *  sizer)
protected

Definition at line 783 of file ToolBar.cpp.

784{
785 mHSizer->Detach( sizer );
786}

References mHSizer.

◆ Detach() [2/2]

void ToolBar::Detach ( wxWindow *  window)
protected

Definition at line 775 of file ToolBar.cpp.

776{
777 mHSizer->Detach( window );
778}

References mHSizer.

Referenced by AudioSetupToolBar::ArrangeButtons(), ControlToolBar::ArrangeButtons(), audacity::cloud::ShareAudioToolbar::DestroySizer(), AudioSetupToolBar::ReCreateButtons(), and ControlToolBar::ReCreateButtons().

Here is the caller graph for this function:

◆ EnableDisableButtons()

virtual void ToolBar::EnableDisableButtons ( )
pure virtual

Implemented in audacity::cloud::ShareAudioToolbar, AudioSetupToolBar, ControlToolBar, CutCopyPasteToolBar, DeviceToolBar, EditToolBar, MeterToolBar, SelectionBar, SnappingToolBar, SpectralSelectionBar, TimeSignatureToolBar, TimeToolBar, ToolsToolBar, and TranscriptionToolBar.

Referenced by ToolManager::Reset().

Here is the caller graph for this function:

◆ Expose()

bool ToolBar::Expose ( bool  show = true)
virtual

Reimplemented in MeterToolBar.

Definition at line 459 of file ToolBar.cpp.

460{
461 bool was = mVisible;
462
463 SetVisible( show );
464
465 if( IsDocked() )
466 {
467 Show( show );
468 if( show )
469 {
470 Refresh();
471 }
472 }
473 else
474 {
475 wxWindow * pParent = GetParent();
476 if( !IsPositioned() && show ){
478 pParent->CentreOnParent();
479 // Cascade the undocked bars
480 pParent->Move( pParent->GetPosition() +
481 wxSize{ mIndex * 10, mIndex * 10 });
482 }
483 pParent->Show( show );
484 }
485
486 return was;
487}
bool IsDocked() const
Definition: ToolBar.cpp:433
void SetVisible(bool bVisible)
Definition: ToolBar.cpp:446
bool IsPositioned()
Definition: ToolBar.h:138
void SetPositioned()
Definition: ToolBar.h:140
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)

References IsDocked(), IsPositioned(), mVisible, SetPositioned(), SetVisible(), and ExportProgressUI::Show().

Referenced by MeterToolBar::Expose(), ToolDock::Expose(), ToolManager::Expose(), and ToolManager::ReadConfig().

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

◆ GetDock()

ToolDock * ToolBar::GetDock ( )

Definition at line 647 of file ToolBar.cpp.

648{
649 return dynamic_cast<ToolDock*>(GetParent());
650}
A dynamic panel where a ToolBar can be docked.
Definition: ToolDock.h:292

Referenced by ToolManager::DoneDragging(), ToolManager::Expose(), IsDocked(), ToolManager::ReadConfig(), ReCreateButtons(), ToolManager::Reset(), Updated(), and ToolManager::WriteConfig().

Here is the caller graph for this function:

◆ GetDockedSize()

virtual wxSize ToolBar::GetDockedSize ( )
inlinevirtual

Reimplemented in MeterToolBar, and TimeToolBar.

Definition at line 146 of file ToolBar.h.

146{ return GetMinSize(); }

Referenced by ToolDock::Dock(), and ToolFrame::ToolFrame().

Here is the caller graph for this function:

◆ GetIndex()

int ToolBar::GetIndex ( ) const
inline

Get a value used for computing cascading positions of undocked bars.

Definition at line 112 of file ToolBar.h.

112{ return mIndex; }
int mIndex
Definition: ToolBar.h:251

Referenced by ToolManager::Reset().

Here is the caller graph for this function:

◆ GetInitialWidth()

virtual int ToolBar::GetInitialWidth ( )
inlinevirtual

Resizable toolbars should implement these.

Reimplemented in DeviceToolBar, MeterToolBar, TimeToolBar, and TranscriptionToolBar.

Definition at line 144 of file ToolBar.h.

144{ return -1; }

Referenced by SetToDefaultSize().

Here is the caller graph for this function:

◆ GetLabel()

TranslatableString ToolBar::GetLabel ( )

Definition at line 392 of file ToolBar.cpp.

393{
394 return mLabel;
395}

References mLabel.

Referenced by Create(), and GetTitle().

Here is the caller graph for this function:

◆ GetMinToolbarWidth()

virtual int ToolBar::GetMinToolbarWidth ( )
inlinevirtual

Reimplemented in DeviceToolBar, MeterToolBar, TimeToolBar, and TranscriptionToolBar.

Definition at line 145 of file ToolBar.h.

145{ return GetInitialWidth(); }
virtual int GetInitialWidth()
Resizable toolbars should implement these.
Definition: ToolBar.h:144

Referenced by ReCreateButtons().

Here is the caller graph for this function:

◆ GetResizeGrabberWidth()

int ToolBar::GetResizeGrabberWidth ( )
protected

Returns the width in pixels of the resizer element.

Definition at line 1027 of file ToolBar.cpp.

1028{
1029 return RWIDTH;
1030}
#define RWIDTH
ToolBarResizer.
Definition: ToolBar.cpp:63

References RWIDTH.

◆ GetSection()

Identifier ToolBar::GetSection ( )

Definition at line 400 of file ToolBar.cpp.

401{
402 return mSection;
403}

References mSection.

Referenced by ToolDock::Dock(), ToolManager::Expose(), ToolManager::ReadConfig(), ReCreateButtons(), ToolManager::Reset(), ToolDock::Undock(), ToolDock::VisitLayout(), and ToolManager::WriteConfig().

Here is the caller graph for this function:

◆ GetSizer()

wxBoxSizer * ToolBar::GetSizer ( )
protected

Definition at line 701 of file ToolBar.cpp.

702{
703 return mHSizer;
704}

References mHSizer.

Referenced by audacity::cloud::ShareAudioToolbar::ArrangeButtons(), AudioSetupToolBar::ArrangeButtons(), ControlToolBar::ArrangeButtons(), TimeToolBar::OnSize(), MeterToolBar::RebuildLayout(), and TimeToolBar::SetResizingLimits().

Here is the caller graph for this function:

◆ GetSmartDockedSize()

wxSize ToolBar::GetSmartDockedSize ( )

Definition at line 520 of file ToolBar.cpp.

521{
522 const int tbs = toolbarSingle + toolbarGap;
523 wxSize sz = GetSize();
524 // 46 is the size where we switch from expanded to compact.
525 if( sz.y < 46 )
526 sz.y = tbs-1;
527 else
528 sz.y = 2 * tbs -1;
529 return sz;
530}
#define toolbarSingle
Definition: ToolBar.h:59
#define toolbarGap
Definition: ToolBar.h:64

References toolbarGap, and toolbarSingle.

Referenced by MeterToolBar::GetDockedSize().

Here is the caller graph for this function:

◆ GetTitle()

TranslatableString ToolBar::GetTitle ( )

Definition at line 383 of file ToolBar.cpp.

384{
385 /* i18n-hint: %s will be replaced by the name of the kind of toolbar.*/
386 return XO("Audacity %s Toolbar").Format( GetLabel() );
387}
XO("Cut/Copy/Paste")

References GetLabel(), and XO().

Referenced by Create(), SetDocked(), and UpdatePrefs().

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

◆ HideAfterReset()

bool ToolBar::HideAfterReset ( ) const
virtual

Default implementation returns false.

Reimplemented in CutCopyPasteToolBar.

Definition at line 370 of file ToolBar.cpp.

371{
372 return false;
373}

Referenced by ToolManager::Reset().

Here is the caller graph for this function:

◆ Init()

void ToolBar::Init ( wxWindow *  parent,
int  type,
const wxString &  title,
const wxString &  label 
)
private

◆ IsDocked()

bool ToolBar::IsDocked ( ) const

Definition at line 433 of file ToolBar.cpp.

434{
435 return const_cast<ToolBar*>(this)->GetDock() != nullptr;
436}
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:74
ToolDock * GetDock()
Definition: ToolBar.cpp:647

References GetDock().

Referenced by Expose(), ToolManager::Expose(), ToolManager::OnGrabber(), ToolFrame::OnMotion(), ReCreateButtons(), ToolManager::Reset(), TimeToolBar::SetResizingLimits(), Updated(), and ToolManager::WriteConfig().

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

◆ IsPositioned()

bool ToolBar::IsPositioned ( )
inline

Definition at line 138 of file ToolBar.h.

138{ return mPositioned; };

Referenced by Expose(), and ToolManager::WriteConfig().

Here is the caller graph for this function:

◆ IsResizable()

bool ToolBar::IsResizable ( ) const

Definition at line 425 of file ToolBar.cpp.

426{
427 return mResizable;
428}

References mResizable.

Referenced by ToolFrame::OnMotion(), ToolFrame::OnPaint(), ReCreateButtons(), ToolManager::Reset(), and ToolFrame::ToolFrame().

Here is the caller graph for this function:

◆ IsVisible()

bool ToolBar::IsVisible ( ) const

Definition at line 441 of file ToolBar.cpp.

442{
443 return mVisible;
444}

References mVisible.

Referenced by ToolDock::Dock(), and ToolBarConfiguration::Write().

Here is the caller graph for this function:

◆ MakeAlternateImages()

void ToolBar::MakeAlternateImages ( AButton button,
int  idx,
teBmps  eUp,
teBmps  eDown,
teBmps  eHilite,
teBmps  eDownHi,
teBmps  eStandardUp,
teBmps  eStandardDown,
teBmps  eDisabled,
wxSize  size 
)
static

Definition at line 945 of file ToolBar.cpp.

954{
955 // wxMax to cater for case of image being bigger than the button.
956 int xoff = wxMax( 0, (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2);
957 int yoff = wxMax( 0, (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2);
958
959 typedef std::unique_ptr<wxImage> wxImagePtr;
960 wxImagePtr up (OverlayImage(eUp, eStandardUp, xoff, yoff));
961 wxImagePtr hilite (OverlayImage(eHilite, eStandardUp, xoff, yoff));
962 wxImagePtr down (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
963 wxImagePtr downHi (OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
964 wxImagePtr disable (OverlayImage(eUp, eDisabled, xoff, yoff));
965
966 button.SetAlternateImages(idx, *up, *hilite, *down, *downHi, *disable);
967}
std::unique_ptr< wxImage > OverlayImage(wxImage *background, wxImage *foreground, wxImage *mask, int xoff, int yoff)
THEME_API Theme theTheme
Definition: Theme.cpp:82
void SetAlternateImages(unsigned idx, const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis)
Definition: AButton.cpp:210
wxImage & Image(int iIndex)

References ThemeBase::Image(), OverlayImage(), AButton::SetAlternateImages(), size, and theTheme.

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

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

◆ MakeButton() [1/2]

AButton * ToolBar::MakeButton ( ToolBar parent,
teBmps  eEnabledUp,
teBmps  eEnabledDown,
teBmps  eDisabled,
int  id,
bool  processdownevents,
const TranslatableString label 
)
static
Parameters
parentParent window for the button.
eEnabledUpBackground for when button is Up.
eEnabledDownBackground for when button is Down.
eDisabledForeground when disabled.
idWindows Id.
processdowneventstrue iff button handles down events.
labelButton label

Definition at line 916 of file ToolBar.cpp.

923{
924 AButton *r = ToolBar::MakeButton(parent,
925 bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
926 eEnabledUp, eEnabledDown, eDisabled,
927 wxWindowID( id ),
928 wxDefaultPosition, processdownevents,
929 theTheme.ImageSize( bmpRecoloredUpLarge ));
930 r->SetLabel( label );
931 enum {
932 deflation =
933#ifdef __WXMAC__
934 6
935#else
936 12
937#endif
938 };
939 r->SetFocusRect( r->GetClientRect().Deflate( deflation, deflation ) );
940
941 return r;
942}
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
void SetFocusRect(const wxRect &r)
Definition: AButton.cpp:249
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:189
wxSize ImageSize(int iIndex)
static AButton * MakeButton(wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
Definition: ToolBar.cpp:875

References ThemeBase::ImageSize(), label, MakeButton(), AButton::SetFocusRect(), AButton::SetLabel(), and theTheme.

Here is the call graph for this function:

◆ MakeButton() [2/2]

AButton * ToolBar::MakeButton ( wxWindow *  parent,
teBmps  eUp,
teBmps  eDown,
teBmps  eHilite,
teBmps  eDownHi,
teBmps  eStandardUp,
teBmps  eStandardDown,
teBmps  eDisabled,
wxWindowID  id,
wxPoint  placement,
bool  processdownevents,
wxSize  size 
)
static

Makes a button and its four different state bitmaps

Parameters
parentParent window for the button.
eUpBackground for when button is Up.
eDownBackground for when button is Down.
eHiliteBackground for when button is Hilit.
eStandardUpForeground when enabled, up.
eStandardDownForeground when enabled, down.
eDisabledForeground when disabled.
idWindows Id.
placementPlacement position
processdowneventstrue iff button handles down events.
sizeSize of the background.

Definition at line 875 of file ToolBar.cpp.

887{
888 // wxMax to cater for case of image being bigger than the button.
889 int xoff = wxMax( 0, (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2);
890 int yoff = wxMax( 0, (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2);
891
892 typedef std::unique_ptr<wxImage> wxImagePtr;
893 wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff));
894 wxImagePtr hilite2 (OverlayImage(eHilite, eStandardUp, xoff, yoff));
895 wxImagePtr down2 (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
896 wxImagePtr downHi2 (OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
897 wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff));
898
899 wxASSERT(parent); // to justify safenew
900 AButton * button =
901 safenew AButton(parent, id, placement, size, *up2, *hilite2, *down2, *downHi2,
902 *disable2, processdownevents);
903
904 return button;
905}
#define safenew
Definition: MemoryX.h:9

References ThemeBase::Image(), OverlayImage(), safenew, size, and theTheme.

Referenced by TranscriptionToolBar::AddButton(), ToolBarButtons::CreateButton(), MakeButton(), ToolsToolBar::MakeTool(), ControlToolBar::Populate(), and AdornedRulerPanel::ReCreateButtons().

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

◆ MakeButtonBackgroundsLarge()

void ToolBar::MakeButtonBackgroundsLarge ( )
static

Definition at line 811 of file ToolBar.cpp.

812{
813
814 bool bUseAqua = false;
815
816#ifdef EXPERIMENTAL_THEME_PREFS
817 gPrefs->Read( wxT("/GUI/ShowMac"), &bUseAqua, false);
818#endif
819
820#ifdef USE_AQUA_THEME
821 bUseAqua = !bUseAqua;
822#endif
823
824 if( bUseAqua ){
825 MakeMacRecoloredImage( bmpRecoloredUpLarge, bmpMacUpButton );
826 MakeMacRecoloredImage( bmpRecoloredDownLarge, bmpMacDownButton );
827 MakeMacRecoloredImage( bmpRecoloredUpHiliteLarge, bmpMacHiliteUpButton );
828 MakeMacRecoloredImage( bmpRecoloredHiliteLarge, bmpMacHiliteButton );
829 } else {
830 MakeRecoloredImage( bmpRecoloredUpLarge, bmpUpButtonLarge );
831 MakeRecoloredImage( bmpRecoloredDownLarge, bmpDownButtonLarge );
832 MakeRecoloredImage( bmpRecoloredUpHiliteLarge, bmpHiliteUpButtonLarge );
833 MakeRecoloredImage( bmpRecoloredHiliteLarge, bmpHiliteButtonLarge );
834 }
835}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
static void MakeMacRecoloredImage(teBmps eBmpOut, teBmps eBmpIn)
Definition: ToolBar.cpp:788
static void MakeRecoloredImage(teBmps eBmpOut, teBmps eBmpIn)
Definition: ToolBar.cpp:799
virtual bool Read(const wxString &key, bool *value) const =0

References gPrefs, MakeMacRecoloredImage(), MakeRecoloredImage(), audacity::BasicSettings::Read(), and wxT().

Referenced by ControlToolBar::Populate().

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

◆ MakeButtonBackgroundsSmall()

void ToolBar::MakeButtonBackgroundsSmall ( )
static

Definition at line 837 of file ToolBar.cpp.

838{
839
840 bool bUseAqua = false;
841
842#ifdef EXPERIMENTAL_THEME_PREFS
843 gPrefs->Read( wxT("/GUI/ShowMac"), &bUseAqua, false);
844#endif
845
846#ifdef USE_AQUA_THEME
847 bUseAqua = !bUseAqua;
848#endif
849
850 if( bUseAqua ){
851 MakeMacRecoloredImage( bmpRecoloredUpSmall, bmpMacUpButtonSmall );
852 MakeMacRecoloredImage( bmpRecoloredDownSmall, bmpMacDownButtonSmall );
853 MakeMacRecoloredImage( bmpRecoloredUpHiliteSmall, bmpMacHiliteUpButtonSmall );
854 MakeMacRecoloredImage( bmpRecoloredHiliteSmall, bmpMacHiliteButtonSmall );
855 } else {
856 MakeRecoloredImage( bmpRecoloredUpSmall, bmpUpButtonSmall );
857 MakeRecoloredImage( bmpRecoloredDownSmall, bmpDownButtonSmall );
858 MakeRecoloredImage( bmpRecoloredUpHiliteSmall, bmpHiliteUpButtonSmall );
859 MakeRecoloredImage( bmpRecoloredHiliteSmall, bmpHiliteButtonSmall );
860 }
861}

References gPrefs, MakeMacRecoloredImage(), MakeRecoloredImage(), audacity::BasicSettings::Read(), and wxT().

Referenced by audacity::cloud::ShareAudioToolbar::Populate(), AudioSetupToolBar::Populate(), CutCopyPasteToolBar::Populate(), EditToolBar::Populate(), MeterToolBar::Populate(), ToolsToolBar::Populate(), TranscriptionToolBar::Populate(), and AdornedRulerPanel::ReCreateButtons().

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

◆ MakeMacRecoloredImage()

void ToolBar::MakeMacRecoloredImage ( teBmps  eBmpOut,
teBmps  eBmpIn 
)
staticprotected

Definition at line 788 of file ToolBar.cpp.

789{
790 theTheme.ReplaceImage( eBmpOut, &theTheme.Image( eBmpIn ));
791}
void ReplaceImage(int iIndex, wxImage *pImage)

References ThemeBase::Image(), ThemeBase::ReplaceImage(), and theTheme.

Referenced by MakeButtonBackgroundsLarge(), MakeButtonBackgroundsSmall(), MakeMacRecoloredImageSize(), and MakeRecoloredImage().

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

◆ MakeMacRecoloredImageSize()

void ToolBar::MakeMacRecoloredImageSize ( teBmps  eBmpOut,
teBmps  eBmpIn,
const wxSize &  size 
)
staticprotected

Definition at line 793 of file ToolBar.cpp.

794{
795 MakeMacRecoloredImage( eBmpOut, eBmpIn );
796 theTheme.Image( eBmpOut ).Rescale( size.GetWidth(), size.GetHeight() );
797}

References ThemeBase::Image(), MakeMacRecoloredImage(), size, and theTheme.

Here is the call graph for this function:

◆ MakeRecoloredImage()

void ToolBar::MakeRecoloredImage ( teBmps  eBmpOut,
teBmps  eBmpIn 
)
staticprotected

Definition at line 799 of file ToolBar.cpp.

800{
801 // Don't recolour the buttons...
802 MakeMacRecoloredImage( eBmpOut, eBmpIn );
803}

References MakeMacRecoloredImage().

Referenced by MakeButtonBackgroundsLarge(), MakeButtonBackgroundsSmall(), and MakeRecoloredImageSize().

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

◆ MakeRecoloredImageSize()

void ToolBar::MakeRecoloredImageSize ( teBmps  eBmpOut,
teBmps  eBmpIn,
const wxSize &  size 
)
staticprotected

Definition at line 805 of file ToolBar.cpp.

806{
807 MakeRecoloredImage( eBmpOut, eBmpIn );
808 theTheme.Image( eBmpOut ).Rescale( size.GetWidth(), size.GetHeight() );
809}

References ThemeBase::Image(), MakeRecoloredImage(), size, and theTheme.

Here is the call graph for this function:

◆ OnErase()

void ToolBar::OnErase ( wxEraseEvent &  event)
protected

Definition at line 1001 of file ToolBar.cpp.

1002{
1003 // Ignore it to prevent flashing
1004}

◆ OnMouseEvents()

void ToolBar::OnMouseEvents ( wxMouseEvent &  event)
protected

Definition at line 1020 of file ToolBar.cpp.

1021{
1022 // Do this hack so scrubber can detect mouse drags anywhere
1023 event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
1024 event.Skip();
1025}

◆ OnPaint()

void ToolBar::OnPaint ( wxPaintEvent &  event)
protected

Definition at line 1009 of file ToolBar.cpp.

1010{
1011 wxPaintDC dc( this );
1012
1013 // Themed background colour.
1014 dc.SetBackground( wxBrush( theTheme.Colour( clrMedium ) ) );
1015 dc.Clear();
1016
1017 Repaint( &dc );
1018}
wxColour & Colour(int iIndex)
virtual void Repaint(wxDC *dc)=0

References ThemeBase::Colour(), Repaint(), and theTheme.

Here is the call graph for this function:

◆ Populate()

virtual void ToolBar::Populate ( )
protectedpure virtual

Implemented in audacity::cloud::ShareAudioToolbar, AudioSetupToolBar, ControlToolBar, CutCopyPasteToolBar, DeviceToolBar, EditToolBar, MeterToolBar, SelectionBar, SnappingToolBar, SpectralSelectionBar, TimeSignatureToolBar, TimeToolBar, ToolsToolBar, and TranscriptionToolBar.

Referenced by ReCreateButtons().

Here is the caller graph for this function:

◆ PreferredNeighbors()

std::pair< Identifier, Identifier > ToolBar::PreferredNeighbors ( ) const
noexcept

Defaults to (NoBarID, NoBarId)

Definition at line 451 of file ToolBar.cpp.

452{
454}
Identifier mPreferredTopNeighbor
Definition: ToolBar.h:263
Identifier mPreferredLeftNeighbor
Definition: ToolBar.h:262

References mPreferredLeftNeighbor, and mPreferredTopNeighbor.

Referenced by ToolBarConfiguration::Show().

Here is the caller graph for this function:

◆ ReCreateButtons()

void ToolBar::ReCreateButtons ( )
virtual

Reimplemented in audacity::cloud::ShareAudioToolbar, AudioSetupToolBar, ControlToolBar, and MeterToolBar.

Definition at line 533 of file ToolBar.cpp.

534{
535 wxSize sz3 = GetSize();
536 //wxLogDebug( "x:%i y:%i",sz3.x, sz3.y);
537
538 // SetSizer(NULL) detaches mHSizer and deletes it.
539 // Do not use Detach() here, as that attempts to detach mHSizer from itself!
540 SetSizer( NULL );
541
542 // Get rid of any children we may have
543 DestroyChildren();
544 mGrabber = NULL;
545 mResizer = NULL;
546 SetLayoutDirection(wxLayout_LeftToRight);
547
548 // Refresh the background before populating
549 if (!IsDocked())
550 {
551 GetParent()->Refresh();
552 }
553
554 {
555 // Create the main sizer
556 auto ms = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
557
558 // Create the grabber and add it to the main sizer
560 ms->Add(mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1);
561
562 // Use a box sizer for laying out controls
563 ms->Add((mHSizer = safenew wxBoxSizer(wxHORIZONTAL)), 1, wxEXPAND);
564
565 // Go add all the rest of the gadgets
566 Populate();
567
568 // Add some space for the resize border
569 if (IsResizable())
570 {
571 // Create the resizer and add it to the main sizer
573 ms->Add(mResizer, 0, wxEXPAND | wxALIGN_TOP | wxLEFT, 1);
574 mResizer->SetToolTip(_("Click and drag to resize toolbar"));
575 }
576
577 // Set dock after possibly creating resizer.
578 // (Re)Establish dock state
579 SetDocked(GetDock(), false);
580
581 // Set the sizer
582 SetSizerAndFit(ms.release());
583 }
584
585 // Recalculate the height to be a multiple of toolbarSingle
586 const int tbs = toolbarSingle + toolbarGap;
587 wxSize sz = GetSize();
588 sz.y = ( ( ( sz.y + tbs -1) / tbs ) * tbs ) - 1;
589
590 // Set the true AND minimum sizes and do final layout
591 if(IsResizable())
592 {
593 // JKC we're going to allow all resizable toolbars to be resized
594 // to 1 unit high, typically 27 pixels.
595 wxSize sz2 = sz;
596 sz2.SetWidth(GetMinToolbarWidth());
597 sz2.y = tbs -1;
598 SetMinSize(sz2);
599
600 // sz2 is now the minimum size.
601 // sz3 is the size we were.
602
603 // We're recreating buttons, and we want to preserve original size.
604 // But not if that makes the size too small.
605
606 // Size at least as big as minimum.
607 if( sz3.y < sz2.y )
608 sz3.y = sz2.y;
609 if( sz3.x < sz2.x )
610 sz3.x = sz2.x;
611 SetSize(sz3);
612 }
613 else
614 {
615 SetInitialSize(sz);
616 }
617 Layout();
618}
#define _(s)
Definition: Internat.h:73
The widget to the left of a ToolBar that allows it to be dragged around to NEW positions.
Definition: Grabber.h:107
friend class ToolBarResizer
Definition: ToolBar.h:274
virtual void Populate()=0
virtual void SetDocked(ToolDock *dock, bool pushed)
Definition: ToolBar.cpp:661
virtual int GetMinToolbarWidth()
Definition: ToolBar.h:145
bool IsResizable() const
Definition: ToolBar.cpp:425
Identifier GetSection()
Definition: ToolBar.cpp:400

References _, GetDock(), GetMinToolbarWidth(), GetSection(), IsDocked(), IsResizable(), mGrabber, mHSizer, mResizer, Populate(), safenew, SetDocked(), toolbarGap, ToolBarResizer, and toolbarSingle.

Referenced by Create(), SelectionBar::OnUpdate(), SpectralSelectionBar::OnUpdate(), TimeToolBar::OnUpdate(), audacity::cloud::ShareAudioToolbar::ReCreateButtons(), AudioSetupToolBar::ReCreateButtons(), ControlToolBar::ReCreateButtons(), MeterToolBar::ReCreateButtons(), and ToolManager::Reset().

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

◆ RegenerateTooltips()

virtual void ToolBar::RegenerateTooltips ( )
pure virtual

◆ Repaint()

virtual void ToolBar::Repaint ( wxDC *  dc)
protectedpure virtual

Implemented in audacity::cloud::ShareAudioToolbar, AudioSetupToolBar, and ControlToolBar.

Referenced by OnPaint().

Here is the caller graph for this function:

◆ ResizingDone()

virtual void ToolBar::ResizingDone ( )
inlinevirtual

Reimplemented in TimeToolBar.

Definition at line 197 of file ToolBar.h.

197{};

Referenced by ToolBarResizer::OnLeftUp(), and ToolManager::ReadConfig().

Here is the caller graph for this function:

◆ SetButton()

void ToolBar::SetButton ( bool  down,
AButton button 
)
protected

Definition at line 986 of file ToolBar.cpp.

987{
988 if( down )
989 {
990 button->PushDown();
991 }
992 else
993 {
994 button->PopUp();
995 }
996}
void PushDown()
Definition: AButton.cpp:577
void PopUp()
Definition: AButton.cpp:585

References AButton::PopUp(), and AButton::PushDown().

Here is the call graph for this function:

◆ SetButtonToolTip()

void ToolBar::SetButtonToolTip ( AudacityProject project,
AButton button,
const ComponentInterfaceSymbol  commands[],
size_t  nCommands 
)
static

Definition at line 969 of file ToolBar.cpp.

972{
973 TranslatableString result;
974 const auto project = &theProject;
975 const auto commandManager =
976 project ? &CommandManager::Get( *project ) : nullptr;
977 if (commandManager)
978 result =
979 commandManager->DescribeCommandsAndShortcuts(commands, nCommands);
980 button.SetToolTip( result );
981}
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:184
static CommandManager & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.

References CommandManager::Get(), project, and AButton::SetToolTip().

Referenced by ToolBarButtons::ForAllButtons(), audacity::cloud::ShareAudioToolbar::RegenerateTooltips(), AudioSetupToolBar::RegenerateTooltips(), ControlToolBar::RegenerateTooltips(), ToolsToolBar::RegenerateTooltips(), TranscriptionToolBar::RegenerateTooltips(), and AdornedRulerPanel::UpdateButtonStates().

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

◆ SetDocked()

void ToolBar::SetDocked ( ToolDock dock,
bool  pushed 
)
virtual

Reimplemented in TimeToolBar.

Definition at line 661 of file ToolBar.cpp.

662{
663 // Remember it
664// mDock = dock;
665
666 // Change the tooltip of the grabber
667#if wxUSE_TOOLTIPS
669#endif
670
671 // Set the grabber button state
672 mGrabber->PushButton( pushed );
673
674 if (mResizer)
675 {
676 mResizer->Show(dock != NULL);
677 Layout();
678 }
679}
void SetToolTip(const TranslatableString &toolTip)
Definition: Grabber.cpp:109
void PushButton(bool state)
Definition: Grabber.cpp:187

References GetTitle(), mGrabber, mResizer, Grabber::PushButton(), and Grabber::SetToolTip().

Referenced by ToolDock::Dock(), ToolManager::DoneDragging(), ToolManager::HandleEscapeKey(), ToolManager::OnMouse(), ToolManager::ReadConfig(), ReCreateButtons(), ToolManager::Reset(), TimeToolBar::SetDocked(), ToolFrame::ToolFrame(), and ToolManager::UndockBar().

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

◆ SetIndex()

void ToolBar::SetIndex ( int  index)
inline

Set a value used for computing cascading positions of undocked bars.

Definition at line 114 of file ToolBar.h.

114{ mIndex = index; }

Referenced by ToolManager::CreateWindows().

Here is the caller graph for this function:

◆ SetLabel() [1/2]

void ToolBar::SetLabel ( const TranslatableString label)

Definition at line 415 of file ToolBar.cpp.

416{
417 // Only this overload is publicly accessible when you have a pointer to
418 // Toolbar or a subclass of it
419 mLabel = label;
420}

References label, and mLabel.

◆ SetLabel() [2/2]

void ToolBar::SetLabel ( const wxString &  label)
overrideprivate

Definition at line 408 of file ToolBar.cpp.

409{
410 // Probably shouldn't reach this overload, but perhaps virtual function
411 // dispatch will take us here from a pointer to the wxPanel base class
412 mLabel = Verbatim( label );
413}
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.

References label, mLabel, and Verbatim().

Referenced by AudioSetupToolBar::UpdatePrefs(), ControlToolBar::UpdatePrefs(), CutCopyPasteToolBar::UpdatePrefs(), DeviceToolBar::UpdatePrefs(), EditToolBar::UpdatePrefs(), MeterToolBar::UpdatePrefs(), SelectionBar::UpdatePrefs(), SnappingToolBar::UpdatePrefs(), SpectralSelectionBar::UpdatePrefs(), TimeSignatureToolBar::UpdatePrefs(), TimeToolBar::UpdatePrefs(), and TranscriptionToolBar::UpdatePrefs().

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

◆ SetPositioned()

void ToolBar::SetPositioned ( )
inline

Definition at line 140 of file ToolBar.h.

140{ mPositioned = true;};

Referenced by Expose(), ToolManager::ReadConfig(), and ToolManager::UndockBar().

Here is the caller graph for this function:

◆ SetPreferredNeighbors()

void ToolBar::SetPreferredNeighbors ( Identifier  left,
Identifier  top = {} 
)

Definition at line 652 of file ToolBar.cpp.

653{
656}

References mPreferredLeftNeighbor, and mPreferredTopNeighbor.

Referenced by ToolManager::ReadConfig().

Here is the caller graph for this function:

◆ SetToDefaultSize()

void ToolBar::SetToDefaultSize ( )
virtual

Reimplemented in TimeToolBar.

Definition at line 513 of file ToolBar.cpp.

513 {
514 wxSize sz;
515 sz.SetHeight( -1 );
516 sz.SetWidth( GetInitialWidth());
517 SetSize( sz );
518}

References GetInitialWidth().

Referenced by ToolManager::Reset().

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

◆ SetVisible()

void ToolBar::SetVisible ( bool  bVisible)

Definition at line 446 of file ToolBar.cpp.

447{
448 mVisible = bVisible;
449}

References mVisible.

Referenced by Expose(), and ToolManager::ReadConfig().

Here is the caller graph for this function:

◆ ShownByDefault()

bool ToolBar::ShownByDefault ( ) const
virtual

Whether the toolbar should be shown by default. Default implementation returns true.

Reimplemented in CutCopyPasteToolBar, DeviceToolBar, MeterToolBar, SelectionBar, SnappingToolBar, SpectralSelectionBar, TimeSignatureToolBar, and TranscriptionToolBar.

Definition at line 365 of file ToolBar.cpp.

366{
367 return true;
368}

Referenced by ToolManager::ReadConfig(), and ToolManager::Reset().

Here is the caller graph for this function:

◆ Updated()

void ToolBar::Updated ( )
protected

Definition at line 684 of file ToolBar.cpp.

685{
686 if( IsDocked() )
687 GetDock()->Updated();
688 else
689 // Bug 2120. Changing the choice also changes the size of the toolbar so
690 // we need to update the client size, even if undocked.
691 // If modifying/improving this, remember to test both changing the choice,
692 // and clicking on the choice but not actually changing it.
693 GetParent()->SetClientSize( GetSize() + wxSize( 2,2));
694 //wxCommandEvent e( EVT_TOOLBAR_UPDATED, GetId() );
695 //GetParent()->GetEventHandler()->AddPendingEvent( e );
696}
void Updated()
Definition: ToolDock.cpp:877

References GetDock(), IsDocked(), and ToolDock::Updated().

Referenced by SelectionBar::FitToTimeControls(), SpectralSelectionBar::OnChoice(), SelectionBar::OnUpdate(), SpectralSelectionBar::OnUpdate(), TimeToolBar::OnUpdate(), ToolBarResizer::ResizeBar(), TimeToolBar::ResizingDone(), TimeToolBar::SetDocked(), TimeToolBar::SetToDefaultSize(), and ControlToolBar::UpdatePrefs().

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

◆ UpdatePrefs()

void ToolBar::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Reimplemented in ToolsToolBar, and TranscriptionToolBar.

Definition at line 622 of file ToolBar.cpp.

623{
624#if wxUSE_TOOLTIPS
625 // Change the tooltip of the grabber
626 if ( mGrabber )
627 {
629 }
630
631 // Change the tooltip of the resizer
632 if ( mResizer )
633 {
634 mResizer->SetToolTip( _("Click and drag to resize toolbar") );
635 wxSizeEvent e;
636 GetParent()->GetEventHandler()->AddPendingEvent( e );
637 GetParent()->Refresh();
638 }
639#endif
640
641 return;
642}

References _, GetTitle(), mGrabber, mResizer, and Grabber::SetToolTip().

Referenced by AudioSetupToolBar::UpdatePrefs(), ControlToolBar::UpdatePrefs(), CutCopyPasteToolBar::UpdatePrefs(), DeviceToolBar::UpdatePrefs(), EditToolBar::UpdatePrefs(), MeterToolBar::UpdatePrefs(), SelectionBar::UpdatePrefs(), SnappingToolBar::UpdatePrefs(), SpectralSelectionBar::UpdatePrefs(), TimeSignatureToolBar::UpdatePrefs(), TimeToolBar::UpdatePrefs(), ToolsToolBar::UpdatePrefs(), and TranscriptionToolBar::UpdatePrefs().

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

Friends And Related Function Documentation

◆ ToolBarResizer

friend class ToolBarResizer
friend

Definition at line 274 of file ToolBar.h.

Referenced by ReCreateButtons().

Member Data Documentation

◆ mGrabber

Grabber* ToolBar::mGrabber
private

Definition at line 257 of file ToolBar.h.

Referenced by ReCreateButtons(), SetDocked(), and UpdatePrefs().

◆ mHSizer

wxBoxSizer* ToolBar::mHSizer
private

Definition at line 260 of file ToolBar.h.

Referenced by Add(), AddSpacer(), AddStretchSpacer(), Detach(), GetSizer(), and ReCreateButtons().

◆ mIndex

int ToolBar::mIndex {0}
protected

Definition at line 251 of file ToolBar.h.

◆ mLabel

TranslatableString ToolBar::mLabel
protected

Definition at line 249 of file ToolBar.h.

Referenced by GetLabel(), and SetLabel().

◆ mParent

wxWindow* ToolBar::mParent
private

Definition at line 255 of file ToolBar.h.

Referenced by Create().

◆ mPositioned

bool ToolBar::mPositioned
private

Definition at line 267 of file ToolBar.h.

◆ mPreferredLeftNeighbor

Identifier ToolBar::mPreferredLeftNeighbor
private

Definition at line 262 of file ToolBar.h.

Referenced by PreferredNeighbors(), and SetPreferredNeighbors().

◆ mPreferredTopNeighbor

Identifier ToolBar::mPreferredTopNeighbor
private

Definition at line 263 of file ToolBar.h.

Referenced by PreferredNeighbors(), and SetPreferredNeighbors().

◆ mProject

AudacityProject& ToolBar::mProject
protected

Definition at line 248 of file ToolBar.h.

Referenced by SelectionBar::AddTime(), AudioSetupToolBar::CommonMenuItemSteps(), ToolsToolBar::DoToolChanged(), audacity::cloud::ShareAudioToolbar::EnableDisableButtons(), ControlToolBar::EnableDisableButtons(), DeviceToolBar::EnableDisableButtons(), TranscriptionToolBar::EnableDisableButtons(), MeterToolBar::Expose(), TranscriptionToolBar::GetSamples(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), SelectionBar::ModifySelection(), SpectralSelectionBar::ModifySpectralSelection(), ControlToolBar::OnFF(), SpectralSelectionBar::OnFormatsChanged(), TimeToolBar::OnFormatsChanged(), SelectionBar::OnFormatsChanged(), ControlToolBar::OnIdle(), SelectionBar::OnIdle(), SpectralSelectionBar::OnIdle(), TimeToolBar::OnIdle(), ControlToolBar::OnKeyEvent(), ControlToolBar::OnLoop(), ControlToolBar::OnPause(), ControlToolBar::OnPlay(), ControlToolBar::OnRecord(), ControlToolBar::OnRewind(), SnappingToolBar::OnSnapModeChanged(), ControlToolBar::OnStop(), ToolsToolBar::OnTool(), ToolsToolBar::OnToolChanged(), SelectionBar::OnUpdate(), SpectralSelectionBar::OnUpdate(), TimeToolBar::OnUpdate(), TranscriptionToolBar::PlayAtSpeed(), ControlToolBar::PlayDefault(), MeterToolBar::Populate(), SelectionBar::Populate(), SnappingToolBar::Populate(), SpectralSelectionBar::Populate(), TimeSignatureToolBar::Populate(), TimeToolBar::Populate(), MeterToolBar::ReCreateButtons(), audacity::cloud::ShareAudioToolbar::RegenerateTooltips(), AudioSetupToolBar::RegenerateTooltips(), ControlToolBar::RegenerateTooltips(), ToolsToolBar::RegenerateTooltips(), TranscriptionToolBar::RegenerateTooltips(), TranscriptionToolBar::SetPlaySpeed(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StateForStatusBar(), ControlToolBar::StopScrolling(), SelectionBar::UpdatePrefs(), and ControlToolBar::UpdateStatusBar().

◆ mResizable

bool ToolBar::mResizable
private

Definition at line 266 of file ToolBar.h.

Referenced by IsResizable().

◆ mResizer

ToolBarResizer* ToolBar::mResizer
private

Definition at line 258 of file ToolBar.h.

Referenced by ReCreateButtons(), SetDocked(), and UpdatePrefs().

◆ mSection

Identifier ToolBar::mSection
protected

Definition at line 250 of file ToolBar.h.

Referenced by GetSection().

◆ mVisible

bool ToolBar::mVisible
private

Definition at line 265 of file ToolBar.h.

Referenced by Create(), Expose(), IsVisible(), and SetVisible().


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