26#include <wx/infobar.h>
32#include <wx/hyperlink.h>
89 WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid = wxID_ANY,
bool aOverlay =
false );
114 void AddCloseButton(
const wxString& aTooltip =
_(
"Hide this message." ) );
130 void AddLink(
const wxString& aLinkText,
const std::function<
void( wxHyperlinkEvent& )>& aFn );
139 void AddButton( wxWindowID aId,
const wxString& aLabel = wxEmptyString )
override;
168 void ShowMessageFor(
const wxString& aMessage,
int aTime,
int aFlags = wxICON_INFORMATION,
169 MESSAGE_TYPE aType = WX_INFOBAR::MESSAGE_TYPE::GENERIC );
177 void ShowMessage(
const wxString& aMessage,
int aFlags = wxICON_INFORMATION )
override;
200 void QueueShowMessage(
const wxString& aMessage,
int aFlags = wxICON_INFORMATION );
240 void onTimer( wxTimerEvent& aEvent );
242 void onSize( wxSizeEvent& aEvent );
266 DECLARE_EVENT_TABLE()
288 const wxPoint& aPos = wxDefaultPosition,
289 const wxSize& aSize = wxSize( -1,-1 ),
290 long aStyle = wxTAB_TRAVERSAL,
291 const wxString& aName = wxEmptyString );
EDA_INFOBAR_PANEL(wxWindow *aParent, wxWindowID aId=wxID_ANY, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxSize(-1,-1), long aStyle=wxTAB_TRAVERSAL, const wxString &aName=wxEmptyString)
wxFlexGridSizer * m_mainSizer
void AddInfoBar(WX_INFOBAR *aInfoBar)
Add the given infobar object to the panel.
void AddOtherItem(wxWindow *aOtherItem)
Add the other item to the panel.
INFOBAR_REPORTER(WX_INFOBAR *aInfoBar)
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Finalize() override
Update the infobar with the reported text.
std::unique_ptr< wxString > m_message
virtual ~INFOBAR_REPORTER()
bool HasMessage() const override
Returns true if any messages were reported.
A pure virtual class used to derive REPORTER objects from.
A modified version of the wxInfoBar class that allows us to:
void FixSize()
Address some long-standing bugs regarding infobars comming up only partial-width.
void SetShowTime(int aTime)
Set the time period to show the infobar.
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void refreshParent()
Repaint the parent so that the area the infobar covered is not left stale.
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.
bool HasCloseButton() const
MESSAGE_TYPE m_type
The type of message being displayed.
bool m_overlay
True if this infobar is drawn on top of its parent.
INFOBAR_MESSAGE_TYPE MESSAGE_TYPE
void AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link to the infobar.
WX_INFOBAR(wxWindow *aParent, wxWindowID aWinid=wxID_ANY, bool aOverlay=false)
Construct an infobar.
void stackOverlays()
Lay out every overlay infobar sharing this one's parent as a top-anchored stack, so that two infobars...
std::optional< std::function< void(void)> > m_callback
Optional callback made when closing infobar.
wxString m_message
The original message without wrapping.
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.
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 AddButton(wxButton *aButton)
Add an already created button to the infobar.
void QueueShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION)
Send the infobar an event telling it to show a message.
void onCloseButton(wxCommandEvent &aEvent)
Event handler for the close button.
wxBitmapButton * GetCloseButton() const
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
void onThemeChange(wxSysColourChangedEvent &aEvent)
Event handler for the color theme change event.
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
MESSAGE_TYPE GetMessageType() 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).
wxTimer * m_showTimer
The timer counting the autoclose period.
void onTimer(wxTimerEvent &aEvent)
Event handler for the automatic closing timer.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
void onSize(wxSizeEvent &aEvent)
void QueueDismiss()
Send the infobar an event telling it to hide itself.
@ ID_CLOSE_INFOBAR
ID for the close button on the frame's infobar.
wxDECLARE_EVENT(KIEVT_SHOW_INFOBAR, wxCommandEvent)
INFOBAR_MESSAGE_TYPE
Sets the type of message for special handling if needed.