Audacity 3.2.0
Public Member Functions | Protected Member Functions | List of all members
StatusBarFieldItem Class Referenceabstract

Abstract base class for status bar fields. More...

#include <ProjectStatus.h>

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

Public Member Functions

 StatusBarFieldItem (StatusBarField identifier)
 
virtual ~StatusBarFieldItem ()
 
virtual int GetDefaultWidth (const AudacityProject &project) const =0
 
virtual void OnSize (AudacityProject &project)
 
virtual void SetText (AudacityProject &project, const TranslatableString &msg)=0
 Sets the current text of the field. More...
 
virtual TranslatableString GetText (const AudacityProject &project) const =0
 Retrieves the current text of the field. More...
 
virtual bool IsVisible (const AudacityProject &project) const =0
 Returns true if the field is visible in the status bar of the given project. More...
 
- Public Member Functions inherited from Registry::SingleItem
 ~SingleItem () override=0
 
- Public Member Functions inherited from Registry::detail::BaseItem
 BaseItem (const Identifier &internalName)
 
virtual ~BaseItem ()
 

Protected Member Functions

void DispatchFieldChanged (const AudacityProject &project)
 Derived classes should call this method to notify the status bar that the field has changed. More...
 

Additional Inherited Members

- Public Attributes inherited from Registry::detail::BaseItem
const Identifier name
 
OrderingHint orderingHint
 

Detailed Description

Abstract base class for status bar fields.

Definition at line 36 of file ProjectStatus.h.

Constructor & Destructor Documentation

◆ StatusBarFieldItem()

StatusBarFieldItem::StatusBarFieldItem ( StatusBarField  identifier)
explicit

Definition at line 174 of file ProjectStatus.cpp.

175 : SingleItem { identifier }
176{
177 Dispatcher::Get().NewFieldRegistered(identifier);
178}
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:200

References BasicUI::Get().

Here is the call graph for this function:

◆ ~StatusBarFieldItem()

StatusBarFieldItem::~StatusBarFieldItem ( )
virtual

Definition at line 180 of file ProjectStatus.cpp.

181{
182}

Member Function Documentation

◆ DispatchFieldChanged()

void StatusBarFieldItem::DispatchFieldChanged ( const AudacityProject project)
protected

Derived classes should call this method to notify the status bar that the field has changed.

Definition at line 188 of file ProjectStatus.cpp.

189{
190 Dispatcher::Get().Dispatch(project, name);
191}
const auto project
const Identifier name
Definition: Registry.h:86

References BasicUI::Get(), Registry::detail::BaseItem::name, and project.

Referenced by ProjectStatus::ProjectStatusTextField::SetText().

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

◆ GetDefaultWidth()

virtual int StatusBarFieldItem::GetDefaultWidth ( const AudacityProject project) const
pure virtual

Return the default width of the field in pixels. This is used to determine the initial width of the field in the status bar. The value may be overridden using StatusWidthFunctions. Returning -1 means that the field is expandable.In this case StatusWidthFunctions have no effect.

Implemented in ProjectStatus::ProjectStatusTextField, and audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem.

◆ GetText()

virtual TranslatableString StatusBarFieldItem::GetText ( const AudacityProject project) const
pure virtual

◆ IsVisible()

virtual bool StatusBarFieldItem::IsVisible ( const AudacityProject project) const
pure virtual

Returns true if the field is visible in the status bar of the given project.

Implemented in ProjectStatus::ProjectStatusTextField, and audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem.

Referenced by ProjectStatusFieldsRegistry::Count(), and ProjectStatusFieldsRegistry::GetFieldIndex().

Here is the caller graph for this function:

◆ OnSize()

void StatusBarFieldItem::OnSize ( AudacityProject project)
virtual

Called when the status bar associated with the project is resized. Could be used to update the position of the custom status bar field. Default implementation does nothing.

Parameters
projectThe project whose status bar has been resized. The reference is non constant, as the field is likely implemented as a client site.

Reimplemented in audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem.

Definition at line 184 of file ProjectStatus.cpp.

185{
186}

◆ SetText()

virtual void StatusBarFieldItem::SetText ( AudacityProject project,
const TranslatableString msg 
)
pure virtual

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