KiCad PCB EDA Suite
|
A modified version of the wxInfoBar class that allows us to: More...
#include <wx_infobar.h>
Public Types | |
enum class | MESSAGE_TYPE { GENERIC , OUTDATED_SAVE , DRC_RULES_ERROR , DRC_VIOLATION } |
Sets the type of message for special handling if needed. More... | |
Public Member Functions | |
WX_INFOBAR (wxWindow *aParent, wxAuiManager *aMgr=nullptr, wxWindowID aWinid=wxID_ANY) | |
Construct an infobar that can exist inside an AUI managed frame. | |
~WX_INFOBAR () | |
MESSAGE_TYPE | GetMessageType () const |
void | SetShowTime (int aTime) |
Set the time period to show the infobar. | |
void | AddCloseButton (const wxString &aTooltip=_("Hide this message.")) |
Add the default close button to the infobar on the right side. | |
void | AddButton (wxButton *aButton) |
Add an already created button to the infobar. | |
void | AddButton (wxHyperlinkCtrl *aHypertextButton) |
Add an already created hypertext link to the infobar. | |
void | AddButton (wxWindowID aId, const wxString &aLabel=wxEmptyString) override |
Add a button with the provided ID and text. | |
void | RemoveAllButtons () |
Remove all the buttons that have been added by the user. | |
bool | HasCloseButton () const |
void | SetCallback (std::function< void(void)> aCallback) |
Provide a callback to be called when the infobar is dismissed (either by user action or timer). | |
void | ShowMessageFor (const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC) |
Show the infobar with the provided message and icon for a specific period of time. | |
void | ShowMessage (const wxString &aMessage, int aFlags=wxICON_INFORMATION) override |
Show the info bar with the provided message and icon. | |
void | ShowMessage (const wxString &aMessage, int aFlags, MESSAGE_TYPE aType) |
Show the info bar with the provided message and icon, setting the type. | |
void | Dismiss () override |
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided). | |
void | QueueShowMessage (const wxString &aMessage, int aFlags=wxICON_INFORMATION) |
Send the infobar an event telling it to show a message. | |
void | QueueDismiss () |
Send the infobar an event telling it to hide itself. | |
bool | IsLocked () |
Returns true if the infobar is being updated. | |
Protected Member Functions | |
void | onShowInfoBar (wxCommandEvent &aEvent) |
Event handler for showing the infobar using a wxCommandEvent of the type KIEVT_SHOW_INFOBAR. | |
void | onDismissInfoBar (wxCommandEvent &aEvent) |
Event handler for dismissing the infobar using a wxCommandEvent of the type KIEVT_DISMISS_INFOBAR. | |
void | onCloseButton (wxCommandEvent &aEvent) |
Event handler for the close button. | |
void | onTimer (wxTimerEvent &aEvent) |
Event handler for the automatic closing timer. | |
void | onSize (wxSizeEvent &aEvent) |
void | updateAuiLayout (bool aShow) |
Update the AUI pane to show or hide this infobar. | |
Protected Attributes | |
int | m_showTime |
The time to show the infobar. 0 = don't auto hide. | |
bool | m_updateLock |
True if this infobar requested the UI update. | |
wxTimer * | m_showTimer |
The timer counting the autoclose period. | |
wxAuiManager * | m_auiManager |
The AUI manager that contains this infobar. | |
MESSAGE_TYPE | m_type |
The type of message being displayed. | |
std::optional< std::function< void(void)> > | m_callback |
Optional callback made when closing infobar. | |
A modified version of the wxInfoBar class that allows us to:
This inherits from the generic infobar because the native infobar on GTK doesn't include the icon on the left and it looks worse.
There are 2 events associated with the infobar:
KIEVT_SHOW_INFOBAR: An event that tells the infobar to show a message.
The message text is contained inside the string component, and the message flag is contained inside the int component.
Sample event creation code: wxCommandEvent* evt = new wxCommandEvent( KIEVT_SHOW_INFOBAR ); evt->SetString( "A message to show" ); evt->SetInt( wxICON_WARNING );
KIEVT_DISMISS_INFOBAR: An event that tells the infobar to hide itself.
Definition at line 75 of file wx_infobar.h.
|
strong |
Sets the type of message for special handling if needed.
Enumerator | |
---|---|
GENERIC | GENERIC Are messages that do not have special handling. |
OUTDATED_SAVE | OUTDATED_SAVE Messages that should be cleared on save. |
DRC_RULES_ERROR | |
DRC_VIOLATION |
Definition at line 93 of file wx_infobar.h.
WX_INFOBAR::WX_INFOBAR | ( | wxWindow * | aParent, |
wxAuiManager * | aMgr = nullptr , |
||
wxWindowID | aWinid = wxID_ANY |
||
) |
Construct an infobar that can exist inside an AUI managed frame.
aParent | is the parent |
aMgr | is the AUI manager that this infobar is added to |
aWinId | is the ID for this infobar object |
Definition at line 51 of file wx_infobar.cpp.
References DPI_SCALING_COMMON::GetContentScaleFactor(), ID_CLOSE_INFOBAR, KIPLATFORM::UI::IsDarkTheme(), and onSize().
WX_INFOBAR::~WX_INFOBAR | ( | ) |
Definition at line 109 of file wx_infobar.cpp.
References m_showTimer.
void WX_INFOBAR::AddButton | ( | wxButton * | aButton | ) |
Add an already created button to the infobar.
New buttons are added in the right-most position.
aButton | is the button to add |
Definition at line 263 of file wx_infobar.cpp.
Referenced by AddButton(), AddCloseButton(), ZONE_FILLER_TOOL::FillAllZones(), APPEARANCE_CONTROLS::onReadOnlySwatch(), SYMBOL_EDIT_FRAME::SetCurSymbol(), DIALOG_PIN_PROPERTIES::TransferDataToWindow(), PCB_CONTROL::unfilledZoneCheck(), DIALOG_ERC::UpdateAnnotationWarning(), and ZONE_FILLER_TOOL::ZoneFillDirty().
void WX_INFOBAR::AddButton | ( | wxHyperlinkCtrl * | aHypertextButton | ) |
Add an already created hypertext link to the infobar.
New buttons are added in the right-most position.
aHypertextButton | is the button to add |
Definition at line 281 of file wx_infobar.cpp.
|
override |
Add a button with the provided ID and text.
The new button is created on the right-most position.
aId | is the ID to assign to the button |
aLabel | is the text for the button |
Definition at line 255 of file wx_infobar.cpp.
References AddButton().
void WX_INFOBAR::AddCloseButton | ( | const wxString & | aTooltip = _( "Hide this message." ) | ) |
Add the default close button to the infobar on the right side.
aTooltip | is the tooltip to give the close button |
Definition at line 294 of file wx_infobar.cpp.
References AddButton(), and ID_CLOSE_INFOBAR.
Referenced by DIALOG_SIM_MODEL< T >::DIALOG_SIM_MODEL(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), PCB_EDIT_FRAME::onBoardLoaded(), APPEARANCE_CONTROLS::onReadOnlySwatch(), onShowInfoBar(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), APPEARANCE_CONTROLS_3D::rebuildLayers(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), DIALOG_EDIT_LIBRARY_TABLES::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), and EDA_BASE_FRAME::ShowInfoBarWarning().
|
override |
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition at line 190 of file wx_infobar.cpp.
References m_auiManager, m_callback, m_updateLock, and updateAuiLayout().
Referenced by SCH_EDIT_FRAME::ClearFindReplaceStatus(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_MOVE_TOOL::doMoveSelection(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), SCH_DRAWING_TOOLS::ImportSheet(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), PL_EDIT_TOOL::Main(), onCloseButton(), onDismissInfoBar(), DIALOG_LIB_NEW_SYMBOL::onParentSymbolSelect(), onTimer(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), SYMBOL_EDIT_FRAME::saveAllLibraries(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), PL_EDITOR_FRAME::SaveDrawingSheetFile(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), SCH_EDIT_FRAME::saveSchematicFile(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_DRAWING_TOOLS::SingleClickPlace(), DIALOG_PIN_PROPERTIES::TransferDataToWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and EDA_BASE_FRAME::windowClosing().
|
inline |
Definition at line 101 of file wx_infobar.h.
References m_type.
Referenced by DRAWING_TOOL::DrawVia(), PL_EDITOR_FRAME::SaveDrawingSheetFile(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), and SCH_EDIT_FRAME::saveSchematicFile().
bool WX_INFOBAR::HasCloseButton | ( | ) | const |
Definition at line 328 of file wx_infobar.cpp.
References ID_CLOSE_INFOBAR.
Referenced by FOOTPRINT_EDITOR_CONTROL::SaveAs(), and PCB_EDIT_FRAME::SavePcbFile().
|
inline |
Returns true if the infobar is being updated.
Definition at line 213 of file wx_infobar.h.
References m_updateLock.
Referenced by EDA_DRAW_PANEL_GAL::onSize().
|
protected |
Event handler for the close button.
This is bound to ID_CLOSE_INFOBAR on the infobar.
Definition at line 358 of file wx_infobar.cpp.
References Dismiss().
|
protected |
Event handler for dismissing the infobar using a wxCommandEvent of the type KIEVT_DISMISS_INFOBAR.
Definition at line 352 of file wx_infobar.cpp.
References Dismiss().
|
protected |
Event handler for showing the infobar using a wxCommandEvent of the type KIEVT_SHOW_INFOBAR.
The message is stored inside the string field, and the icon flag is stored inside the int field.
Definition at line 344 of file wx_infobar.cpp.
References AddCloseButton(), RemoveAllButtons(), and ShowMessage().
|
protected |
Definition at line 213 of file wx_infobar.cpp.
References TOOLS_HOLDER::GetToolCanvas().
Referenced by WX_INFOBAR().
|
protected |
Event handler for the automatic closing timer.
Definition at line 364 of file wx_infobar.cpp.
References Dismiss(), m_showTime, and m_showTimer.
void WX_INFOBAR::QueueDismiss | ( | ) |
Send the infobar an event telling it to hide itself.
Definition at line 132 of file wx_infobar.cpp.
Referenced by INFOBAR_REPORTER::Finalize().
void WX_INFOBAR::QueueShowMessage | ( | const wxString & | aMessage, |
int | aFlags = wxICON_INFORMATION |
||
) |
Send the infobar an event telling it to show a message.
aMessage | is the message to display |
aFlags | is the flag containing the icon to display on the left side of the infobar |
Definition at line 121 of file wx_infobar.cpp.
Referenced by INFOBAR_REPORTER::Finalize(), and SCH_EDIT_FRAME::OpenProjectFiles().
void WX_INFOBAR::RemoveAllButtons | ( | ) |
Remove all the buttons that have been added by the user.
Definition at line 304 of file wx_infobar.cpp.
Referenced by DIALOG_ANNOTATE::DIALOG_ANNOTATE(), PAD_TOOL::enterPadEditMode(), ZONE_FILLER_TOOL::FillAllZones(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_LIB_NEW_SYMBOL::onParentSymbolSelect(), APPEARANCE_CONTROLS::onReadOnlySwatch(), onShowInfoBar(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), APPEARANCE_CONTROLS_3D::rebuildLayers(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), DIALOG_EDIT_LIBRARY_TABLES::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), EDA_BASE_FRAME::ShowInfoBarWarning(), DIALOG_PIN_PROPERTIES::TransferDataToWindow(), PCB_CONTROL::unfilledZoneCheck(), DIALOG_ERC::UpdateAnnotationWarning(), and ZONE_FILLER_TOOL::ZoneFillDirty().
|
inline |
Provide a callback to be called when the infobar is dismissed (either by user action or timer).
aCallback |
Definition at line 158 of file wx_infobar.h.
References m_callback.
Referenced by EDA_BASE_FRAME::ShowInfoBarError().
void WX_INFOBAR::SetShowTime | ( | int | aTime | ) |
Set the time period to show the infobar.
This only applies for the next showing of the infobar, so it must be reset every time. A value of 0 disables the automatic hiding (this is the default).
aTime | is the time in milliseconds to show the infobar |
Definition at line 115 of file wx_infobar.cpp.
References m_showTime.
void WX_INFOBAR::ShowMessage | ( | const wxString & | aMessage, |
int | aFlags, | ||
MESSAGE_TYPE | aType | ||
) |
Show the info bar with the provided message and icon, setting the type.
aMessage | is the message to display |
aFlags | is the flag containing the icon to display on the left side of the infobar |
aType | is the type of message being displayed |
Definition at line 178 of file wx_infobar.cpp.
References m_type, m_updateLock, and ShowMessage().
|
override |
Show the info bar with the provided message and icon.
aMessage | is the message to display |
aFlags | is the flag containing the icon to display on the left side of the infobar |
Definition at line 154 of file wx_infobar.cpp.
References GENERIC, m_auiManager, m_showTime, m_showTimer, m_type, m_updateLock, and updateAuiLayout().
Referenced by DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_TABLE_PROPERTIES::DIALOG_TABLE_PROPERTIES(), DIALOG_TABLECELL_PROPERTIES::DIALOG_TABLECELL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), PAD_TOOL::enterPadEditMode(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_LIB_NEW_SYMBOL::onParentSymbolSelect(), DIALOG_PIN_PROPERTIES::OnPropertiesChange(), onShowInfoBar(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::SetCurSymbol(), ShowMessage(), ShowMessageFor(), DIALOG_PIN_PROPERTIES::TransferDataToWindow(), and DIALOG_ERC::UpdateAnnotationWarning().
void WX_INFOBAR::ShowMessageFor | ( | const wxString & | aMessage, |
int | aTime, | ||
int | aFlags = wxICON_INFORMATION , |
||
MESSAGE_TYPE | aType = WX_INFOBAR::MESSAGE_TYPE::GENERIC |
||
) |
Show the infobar with the provided message and icon for a specific period of time.
aMessage | is the message to display |
aTime | is the amount of time in milliseconds to show the infobar |
aFlags | is the flag containing the icon to display on the left side of the infobar |
Definition at line 140 of file wx_infobar.cpp.
References m_showTime, m_type, m_updateLock, and ShowMessage().
Referenced by FOOTPRINT_EDIT_FRAME::CanCloseFPFromBoard(), ZONE_FILLER_TOOL::FillAllZones(), ROUTER_TOOL::handleLayerSwitch(), APPEARANCE_CONTROLS::onReadOnlySwatch(), APPEARANCE_CONTROLS_3D::rebuildLayers(), SYMBOL_EDIT_FRAME::saveAllLibraries(), PAGED_DIALOG::SetError(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), DIALOG_EDIT_LIBRARY_TABLES::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), EDA_BASE_FRAME::ShowInfoBarWarning(), PCB_CONTROL::unfilledZoneCheck(), and ZONE_FILLER_TOOL::ZoneFillDirty().
|
protected |
Update the AUI pane to show or hide this infobar.
aShow | is true to show the pane |
Definition at line 235 of file wx_infobar.cpp.
References m_auiManager.
Referenced by Dismiss(), and ShowMessage().
|
protected |
The AUI manager that contains this infobar.
Definition at line 256 of file wx_infobar.h.
Referenced by Dismiss(), ShowMessage(), and updateAuiLayout().
|
protected |
Optional callback made when closing infobar.
Definition at line 259 of file wx_infobar.h.
Referenced by Dismiss(), and SetCallback().
|
protected |
The time to show the infobar. 0 = don't auto hide.
Definition at line 253 of file wx_infobar.h.
Referenced by onTimer(), SetShowTime(), ShowMessage(), and ShowMessageFor().
|
protected |
The timer counting the autoclose period.
Definition at line 255 of file wx_infobar.h.
Referenced by onTimer(), ShowMessage(), and ~WX_INFOBAR().
|
protected |
The type of message being displayed.
Definition at line 257 of file wx_infobar.h.
Referenced by GetMessageType(), ShowMessage(), and ShowMessageFor().
|
protected |
True if this infobar requested the UI update.
Definition at line 254 of file wx_infobar.h.
Referenced by Dismiss(), IsLocked(), ShowMessage(), and ShowMessageFor().