KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KISTATUSBAR Class Reference

#include <kistatusbar.h>

Inheritance diagram for KISTATUSBAR:

Public Types

enum  STYLE_FLAGS : int { NONE_STYLE = 0x00 , NOTIFICATION_ICON = 0x01 , CANCEL_BUTTON = 0x02 , WARNING_ICON = 0x04 }
 

Public Member Functions

 KISTATUSBAR (int aNumberFields, wxWindow *parent, wxWindowID id, STYLE_FLAGS aFlags=DEFAULT_STYLE)
 
 ~KISTATUSBAR ()
 
void SetEllipsedTextField (const wxString &aText, int aFieldId)
 Set the text in a field using wxELLIPSIZE_MIDDLE option to adjust the text size to the field size.
 
void ShowBackgroundProgressBar (bool aCancellable=false)
 Show the background progress bar.
 
void HideBackgroundProgressBar ()
 Hide the background progress bar.
 
void SetBackgroundProgress (int aAmount)
 Set the current progress of the progress bar.
 
void SetBackgroundProgressMax (int aAmount)
 Set the max progress of the progress bar.
 
void SetBackgroundStatusText (const wxString &aTxt)
 Set the status text that displays next to the progress bar.
 
void SetNotificationCount (int aCount)
 Set the notification count on the notifications button.
 
void ClearWarningMessages (const wxString &aSource=wxEmptyString)
 Clears all warning messages from the given source (or all sources if aSource is empty)
 
void AddWarningMessages (const wxString &aSource, const wxString &aMessages)
 Add warning/error messages (not thread-safe, use the std::vector<LOAD_MESSAGE> variant from other threads)
 
void AddWarningMessages (const wxString &aSource, const std::vector< LOAD_MESSAGE > &aMessages)
 Add warning/error messages thread-safely.
 
size_t GetLoadWarningCount () const
 Get current message count (thread-safe).
 

Static Public Attributes

static constexpr auto DEFAULT_STYLE
 

Private Types

enum class  FIELD {
  BGJOB_LABEL , BGJOB_GAUGE , BGJOB_CANCEL , WARNING ,
  NOTIFICATION
}
 

Private Member Functions

void onSize (wxSizeEvent &aEvent)
 
void onBackgroundProgressClick (wxMouseEvent &aEvent)
 
void onNotificationsIconClick (wxCommandEvent &aEvent)
 
void onLoadWarningsIconClick (wxCommandEvent &aEvent)
 
void updateWarningUI ()
 Update warning button visibility and badge (main thread only)
 
void updateAuxFieldWidths ()
 
void updateBackgroundText ()
 
void layoutControls ()
 
std::optional< int > fieldIndex (FIELD aField) const
 

Private Attributes

wxGauge * m_backgroundProgressBar
 
wxButton * m_backgroundStopButton
 
wxStaticText * m_backgroundTxt
 
BITMAP_BUTTONm_notificationsButton
 
BITMAP_BUTTONm_warningButton
 
std::mutex m_warningMutex
 Protects m_warningMessages.
 
std::unordered_map< wxString, std::vector< LOAD_MESSAGE > > m_warningMessages
 
int m_normalFieldsCount
 
STYLE_FLAGS m_styleFlags
 
wxString m_savedStatusText
 Saved text from adjacent field during background jobs.
 
wxString m_backgroundRawText
 Unellipsized background status text.
 
std::vector< int > m_fieldWidths
 

Detailed Description

Definition at line 60 of file kistatusbar.h.

Member Enumeration Documentation

◆ FIELD

enum class KISTATUSBAR::FIELD
strongprivate
Enumerator
BGJOB_LABEL 
BGJOB_GAUGE 
BGJOB_CANCEL 
WARNING 
NOTIFICATION 

Definition at line 151 of file kistatusbar.h.

◆ STYLE_FLAGS

Enumerator
NONE_STYLE 
NOTIFICATION_ICON 
CANCEL_BUTTON 
WARNING_ICON 

Definition at line 63 of file kistatusbar.h.

Constructor & Destructor Documentation

◆ KISTATUSBAR()

◆ ~KISTATUSBAR()

Member Function Documentation

◆ AddWarningMessages() [1/2]

void KISTATUSBAR::AddWarningMessages ( const wxString & aSource,
const std::vector< LOAD_MESSAGE > & aMessages )

Add warning/error messages thread-safely.

Can be called from any thread. UI update is deferred to main thread.

Definition at line 440 of file kistatusbar.cpp.

References end, m_warningMessages, m_warningMutex, traceLibraries, and updateWarningUI().

◆ AddWarningMessages() [2/2]

void KISTATUSBAR::AddWarningMessages ( const wxString & aSource,
const wxString & aMessages )

Add warning/error messages (not thread-safe, use the std::vector<LOAD_MESSAGE> variant from other threads)

Definition at line 420 of file kistatusbar.cpp.

References m_warningMessages, m_warningMutex, LOAD_MESSAGE::message, RPT_SEVERITY_WARNING, LOAD_MESSAGE::severity, and updateWarningUI().

Referenced by STATUSBAR_WARNING_REPORTER::Report().

◆ ClearWarningMessages()

void KISTATUSBAR::ClearWarningMessages ( const wxString & aSource = wxEmptyString)

Clears all warning messages from the given source (or all sources if aSource is empty)

Definition at line 530 of file kistatusbar.cpp.

References m_warningMessages, m_warningMutex, and updateWarningUI().

◆ fieldIndex()

std::optional< int > KISTATUSBAR::fieldIndex ( FIELD aField) const
private

◆ GetLoadWarningCount()

size_t KISTATUSBAR::GetLoadWarningCount ( ) const

Get current message count (thread-safe).

Definition at line 466 of file kistatusbar.cpp.

References m_warningMessages, and m_warningMutex.

◆ HideBackgroundProgressBar()

void KISTATUSBAR::HideBackgroundProgressBar ( )

Hide the background progress bar.

Definition at line 295 of file kistatusbar.cpp.

References m_backgroundProgressBar, m_backgroundStopButton, and updateAuxFieldWidths().

Referenced by KISTATUSBAR().

◆ layoutControls()

◆ onBackgroundProgressClick()

void KISTATUSBAR::onBackgroundProgressClick ( wxMouseEvent & aEvent)
private

◆ onLoadWarningsIconClick()

void KISTATUSBAR::onLoadWarningsIconClick ( wxCommandEvent & aEvent)
private

◆ onNotificationsIconClick()

void KISTATUSBAR::onNotificationsIconClick ( wxCommandEvent & aEvent)
private

◆ onSize()

void KISTATUSBAR::onSize ( wxSizeEvent & aEvent)
private

Definition at line 219 of file kistatusbar.cpp.

References layoutControls().

Referenced by KISTATUSBAR(), and ~KISTATUSBAR().

◆ SetBackgroundProgress()

void KISTATUSBAR::SetBackgroundProgress ( int aAmount)

Set the current progress of the progress bar.

Definition at line 306 of file kistatusbar.cpp.

References m_backgroundProgressBar.

◆ SetBackgroundProgressMax()

void KISTATUSBAR::SetBackgroundProgressMax ( int aAmount)

Set the max progress of the progress bar.

Definition at line 317 of file kistatusbar.cpp.

References m_backgroundProgressBar.

◆ SetBackgroundStatusText()

void KISTATUSBAR::SetBackgroundStatusText ( const wxString & aTxt)

Set the status text that displays next to the progress bar.

Definition at line 323 of file kistatusbar.cpp.

References m_backgroundRawText, m_normalFieldsCount, m_savedStatusText, and updateBackgroundText().

◆ SetEllipsedTextField()

void KISTATUSBAR::SetEllipsedTextField ( const wxString & aText,
int aFieldId )

Set the text in a field using wxELLIPSIZE_MIDDLE option to adjust the text size to the field size.

Note
Unfortunately, setting the wxStatusBar style to wxELLIPSIZE_MIDDLE does not work.

Definition at line 567 of file kistatusbar.cpp.

References KIUI::GetTextSize().

Referenced by PROJECT_TREE_PANE::FileWatcherReset(), KICAD_MANAGER_FRAME::OnSize(), and KICAD_MANAGER_FRAME::PrintPrjInfo().

◆ SetNotificationCount()

void KISTATUSBAR::SetNotificationCount ( int aCount)

Set the notification count on the notifications button.

A value of 0 will hide the count.

Definition at line 405 of file kistatusbar.cpp.

References m_notificationsButton.

Referenced by NOTIFICATIONS_MANAGER::RegisterStatusBar().

◆ ShowBackgroundProgressBar()

void KISTATUSBAR::ShowBackgroundProgressBar ( bool aCancellable = false)

Show the background progress bar.

Definition at line 284 of file kistatusbar.cpp.

References m_backgroundProgressBar, m_backgroundStopButton, and updateAuxFieldWidths().

◆ updateAuxFieldWidths()

◆ updateBackgroundText()

void KISTATUSBAR::updateBackgroundText ( )
private

◆ updateWarningUI()

void KISTATUSBAR::updateWarningUI ( )
private

Update warning button visibility and badge (main thread only)

Definition at line 479 of file kistatusbar.cpp.

References _, m_warningButton, m_warningMessages, m_warningMutex, traceLibraries, and updateAuxFieldWidths().

Referenced by AddWarningMessages(), AddWarningMessages(), and ClearWarningMessages().

Member Data Documentation

◆ DEFAULT_STYLE

auto KISTATUSBAR::DEFAULT_STYLE
staticconstexpr
Initial value:

Definition at line 71 of file kistatusbar.h.

◆ m_backgroundProgressBar

◆ m_backgroundRawText

wxString KISTATUSBAR::m_backgroundRawText
private

Unellipsized background status text.

Definition at line 173 of file kistatusbar.h.

Referenced by SetBackgroundStatusText(), and updateBackgroundText().

◆ m_backgroundStopButton

wxButton* KISTATUSBAR::m_backgroundStopButton
private

◆ m_backgroundTxt

wxStaticText* KISTATUSBAR::m_backgroundTxt
private

Definition at line 165 of file kistatusbar.h.

Referenced by KISTATUSBAR(), layoutControls(), and updateBackgroundText().

◆ m_fieldWidths

std::vector<int> KISTATUSBAR::m_fieldWidths
private

Definition at line 174 of file kistatusbar.h.

Referenced by KISTATUSBAR(), and updateAuxFieldWidths().

◆ m_normalFieldsCount

◆ m_notificationsButton

BITMAP_BUTTON* KISTATUSBAR::m_notificationsButton
private

◆ m_savedStatusText

wxString KISTATUSBAR::m_savedStatusText
private

Saved text from adjacent field during background jobs.

Definition at line 172 of file kistatusbar.h.

Referenced by SetBackgroundStatusText().

◆ m_styleFlags

STYLE_FLAGS KISTATUSBAR::m_styleFlags
private

Definition at line 171 of file kistatusbar.h.

Referenced by fieldIndex(), and KISTATUSBAR().

◆ m_warningButton

BITMAP_BUTTON* KISTATUSBAR::m_warningButton
private

◆ m_warningMessages

std::unordered_map<wxString, std::vector<LOAD_MESSAGE> > KISTATUSBAR::m_warningMessages
private

◆ m_warningMutex

std::mutex KISTATUSBAR::m_warningMutex
mutableprivate

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