KiCad PCB EDA Suite
WX_INFOBAR Class Reference

A modified version of the wxInfoBar class that allows us to: More...

#include <infobar.h>

Inheritance diagram for WX_INFOBAR:

Public Types

enum  MESSAGE_TYPE { MESSAGE_TYPE::GENERIC, MESSAGE_TYPE::OUTDATED_SAVE }
 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. More...
 
 ~WX_INFOBAR ()
 
void SetShowTime (int aTime)
 Set the time period to show the infobar. More...
 
void AddCloseButton (const wxString &aTooltip=_("Hide this message."))
 Add the default close button to the infobar on the right side. More...
 
void AddButton (wxButton *aButton)
 Add an already created button to the infobar. More...
 
void AddButton (wxHyperlinkCtrl *aHypertextButton)
 Add an already created hypertext link to the infobar. More...
 
void AddButton (wxWindowID aId, const wxString &aLabel=wxEmptyString) override
 Add a button with the provided ID and text. More...
 
void RemoveAllButtons ()
 Remove all the buttons that have been added by the user. More...
 
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). More...
 
void ShowMessageFor (const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION)
 Show the infobar with the provided message and icon for a specific period of time. More...
 
void ShowMessage (const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
 Show the info bar with the provided message and icon. More...
 
void ShowMessage (const wxString &aMessage, int aFlags, MESSAGE_TYPE aType)
 Show the info bar with the provided message and icon, setting the type. More...
 
void Dismiss () override
 Dismisses the infobar and updates the containing layout and AUI manager (if one is provided). More...
 
void DismissOutdatedSave ()
 Dismisses the infobar for outdated save warnings and updates the containing layout and AUI manager (if one is provided). More...
 
void QueueShowMessage (const wxString &aMessage, int aFlags=wxICON_INFORMATION)
 Send the infobar an event telling it to show a message. More...
 
void QueueDismiss ()
 Send the infobar an event telling it to hide itself. More...
 
bool IsLocked ()
 Returns true if the infobar is being updated. More...
 

Protected Member Functions

void onShowInfoBar (wxCommandEvent &aEvent)
 Event handler for showing the infobar using a wxCommandEvent of the type KIEVT_SHOW_INFOBAR. More...
 
void onDismissInfoBar (wxCommandEvent &aEvent)
 Event handler for dismissing the infobar using a wxCommandEvent of the type KIEVT_DISMISS_INFOBAR. More...
 
void onCloseButton (wxCommandEvent &aEvent)
 Event handler for the close button. More...
 
void onTimer (wxTimerEvent &aEvent)
 Event handler for the automatic closing timer. More...
 
void onSize (wxSizeEvent &aEvent)
 
void updateAuiLayout (bool aShow)
 Update the AUI pane to show or hide this infobar. More...
 

Protected Attributes

int m_showTime
 The time to show the infobar. 0 = don't auto hide. More...
 
bool m_updateLock
 True if this infobar requested the UI update. More...
 
wxTimer * m_showTimer
 The timer counting the autoclose period. More...
 
wxAuiManager * m_auiManager
 The AUI manager that contains this infobar. More...
 
MESSAGE_TYPE m_type
 The type of message being displayed. More...
 
OPT< std::function< void(void)> > m_callback
 Optional callback made when closing infobar. More...
 

Detailed Description

A modified version of the wxInfoBar class that allows us to:

  • Show the close button along with the other buttons
  • Remove all user-provided buttons at once
  • Allow automaticly hiding the infobar after a time period
  • Show/hide using events
  • Place it inside an AUI manager

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 71 of file infobar.h.

Member Enumeration Documentation

◆ MESSAGE_TYPE

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.

Definition at line 89 of file infobar.h.

90  {
91  GENERIC,
92  OUTDATED_SAVE
93  };

Constructor & Destructor Documentation

◆ WX_INFOBAR()

WX_INFOBAR::WX_INFOBAR ( wxWindow *  aParent,
wxAuiManager *  aMgr = nullptr,
wxWindowID  aWinid = wxID_ANY 
)

Construct an infobar that can exist inside an AUI managed frame.

Parameters
aParentis the parent
aMgris the AUI manager that this infobar is added to
aWinIdis the ID for this infobar object

Definition at line 45 of file infobar.cpp.

46  : wxInfoBarGeneric( aParent, aWinid ),
47  m_showTime( 0 ),
48  m_updateLock( false ),
49  m_showTimer( nullptr ),
50  m_auiManager( aMgr ),
52 {
53  m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
54 
55 #ifdef __WXMAC__
56  // wxWidgets hard-codes wxSYS_COLOUR_INFOBK to { 0xFF, 0xFF, 0xD3 } on Mac.
57  SetBackgroundColour( wxColour( 255, 249, 189 ) );
58 #endif
59 
60  SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP );
61  SetEffectDuration( 300 );
62 
63  // The infobar seems to start too small, so increase its height
64  int sx, sy;
65  GetSize( &sx, &sy );
66  sy = 1.5 * sy;
67  SetSize( sx, sy );
68 
69  // The bitmap gets cutoff sometimes with the default size, so force it to be the same
70  // height as the infobar.
71  wxSizer* sizer = GetSizer();
72  wxSize iconSize = wxArtProvider::GetSizeHint( wxART_BUTTON );
73 
74  sizer->SetItemMinSize( (size_t) 0, iconSize.x, sy );
75 
76  // Forcefully remove all existing buttons added by the wx constructors.
77  // The default close button doesn't work with the AUI manager update scheme, so this
78  // ensures any close button displayed is ours.
80 
81  Layout();
82 
83  m_parent->Bind( wxEVT_SIZE, &WX_INFOBAR::onSize, this );
84 }
void onSize(wxSizeEvent &aEvent)
Definition: infobar.cpp:191
GENERIC Are messages that do not have special handling.
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:252
ID for the close button on the frame's infobar.
Definition: infobar.h:37
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:282
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:253
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:254
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:250

References ID_CLOSE_INFOBAR, and onSize().

◆ ~WX_INFOBAR()

WX_INFOBAR::~WX_INFOBAR ( )

Definition at line 87 of file infobar.cpp.

88 {
89  delete m_showTimer;
90 }
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:252

References m_showTimer.

Member Function Documentation

◆ AddButton() [1/3]

void WX_INFOBAR::AddButton ( wxButton *  aButton)

Add an already created button to the infobar.

New buttons are added in the right-most position.

Parameters
aButtonis the button to add

Definition at line 241 of file infobar.cpp.

242 {
243  wxSizer* sizer = GetSizer();
244 
245  wxASSERT( aButton );
246 
247 #ifdef __WXMAC__
248  // Based on the code in the original class:
249  // smaller buttons look better in the (narrow) info bar under OS X
250  aButton->SetWindowVariant( wxWINDOW_VARIANT_SMALL );
251 #endif // __WXMAC__
252  sizer->Add( aButton, wxSizerFlags().Centre().Border( wxRIGHT ) );
253 
254  if( IsShown() )
255  sizer->Layout();
256 }

Referenced by AddButton(), AddCloseButton(), DIALOG_ERC::DIALOG_ERC(), ZONE_FILLER_TOOL::FillAllZones(), ROUTER_TOOL::handleLayerSwitch(), APPEARANCE_CONTROLS::onReadOnlySwatch(), and SYMBOL_EDIT_FRAME::SetCurPart().

◆ AddButton() [2/3]

void WX_INFOBAR::AddButton ( wxHyperlinkCtrl *  aHypertextButton)

Add an already created hypertext link to the infobar.

New buttons are added in the right-most position.

Parameters
aHypertextButtonis the button to add

Definition at line 259 of file infobar.cpp.

260 {
261  wxSizer* sizer = GetSizer();
262 
263  wxASSERT( aHypertextButton );
264 
265  sizer->Add( aHypertextButton, wxSizerFlags().Centre().Border( wxRIGHT ) );
266 
267  if( IsShown() )
268  sizer->Layout();
269 }

◆ AddButton() [3/3]

void WX_INFOBAR::AddButton ( wxWindowID  aId,
const wxString &  aLabel = wxEmptyString 
)
override

Add a button with the provided ID and text.

The new button is created on the right-most positon.

Parameters
aIdis the ID to assign to the button
aLabelis the text for the button

Definition at line 233 of file infobar.cpp.

234 {
235  wxButton* button = new wxButton( this, aId, aLabel );
236 
237  AddButton( button );
238 }
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:241

References AddButton().

◆ AddCloseButton()

void WX_INFOBAR::AddCloseButton ( const wxString &  aTooltip = _( "Hide this message." ))

Add the default close button to the infobar on the right side.

Parameters
aTooltipis the tooltip to give the close button

Definition at line 272 of file infobar.cpp.

273 {
274  wxBitmapButton* button = wxBitmapButton::NewCloseButton( this, ID_CLOSE_INFOBAR );
275 
276  button->SetToolTip( aTooltip );
277 
278  AddButton( button );
279 }
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:241
ID for the close button on the frame's infobar.
Definition: infobar.h:37

References AddButton(), and ID_CLOSE_INFOBAR.

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), APPEARANCE_CONTROLS::onReadOnlySwatch(), onShowInfoBar(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), and EDA_BASE_FRAME::ShowInfoBarWarning().

◆ Dismiss()

void WX_INFOBAR::Dismiss ( )
override

Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).

Definition at line 171 of file infobar.cpp.

172 {
173  // Don't do anything if we requested the UI update
174  if( m_updateLock )
175  return;
176 
177  m_updateLock = true;
178 
179  wxInfoBarGeneric::Dismiss();
180 
181  if( m_auiManager )
182  updateAuiLayout( false );
183 
184  if( m_callback )
185  (*m_callback)();
186 
187  m_updateLock = false;
188 }
void updateAuiLayout(bool aShow)
Update the AUI pane to show or hide this infobar.
Definition: infobar.cpp:213
OPT< std::function< void(void)> > m_callback
Optional callback made when closing infobar.
Definition: infobar.h:256
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:253
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251

References m_auiManager, m_callback, m_updateLock, and updateAuiLayout().

Referenced by SCH_EDIT_FRAME::ClearFindReplaceStatus(), DismissOutdatedSave(), DRAWING_TOOL::DrawVia(), PAD_TOOL::EditPad(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), onCloseButton(), onDismissInfoBar(), DIALOG_BOARD_SETUP::OnPageChange(), onTimer(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::saveAllLibraries(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), PCB_EDIT_FRAME::SavePcbFile(), SYMBOL_EDIT_FRAME::SetCurPart(), and SCH_DRAWING_TOOLS::SingleClickPlace().

◆ DismissOutdatedSave()

void WX_INFOBAR::DismissOutdatedSave ( )

Dismisses the infobar for outdated save warnings and updates the containing layout and AUI manager (if one is provided).

Definition at line 162 of file infobar.cpp.

163 {
165  return;
166 
167  Dismiss();
168 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:171
OUTDATED_SAVE Messages that should be cleared on save.
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:254

References Dismiss(), m_type, m_updateLock, and OUTDATED_SAVE.

Referenced by PCB_EDIT_FRAME::SavePcbFile(), and SCH_EDIT_FRAME::SaveProject().

◆ HasCloseButton()

bool WX_INFOBAR::HasCloseButton ( ) const

Definition at line 306 of file infobar.cpp.

307 {
308  wxSizer* sizer = GetSizer();
309 
310  if( sizer->GetItemCount() == 0 )
311  return false;
312 
313  if( sizer->GetItem( sizer->GetItemCount() - 1 )->IsSpacer() )
314  return false;
315 
316  wxSizerItem* item = sizer->GetItem( sizer->GetItemCount() - 1 );
317 
318  return ( item->GetWindow()->GetId() == ID_CLOSE_INFOBAR );
319 }
ID for the close button on the frame's infobar.
Definition: infobar.h:37

References ID_CLOSE_INFOBAR.

Referenced by FOOTPRINT_EDITOR_CONTROL::SaveAs(), and PCB_EDIT_FRAME::SavePcbFile().

◆ IsLocked()

bool WX_INFOBAR::IsLocked ( )
inline

Returns true if the infobar is being updated.

Definition at line 210 of file infobar.h.

211  {
212  return m_updateLock;
213  }
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251

References m_updateLock.

Referenced by EDA_DRAW_PANEL_GAL::onSize().

◆ onCloseButton()

void WX_INFOBAR::onCloseButton ( wxCommandEvent &  aEvent)
protected

Event handler for the close button.

This is bound to ID_CLOSE_INFOBAR on the infobar.

Definition at line 336 of file infobar.cpp.

337 {
338  Dismiss();
339 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:171

References Dismiss().

◆ onDismissInfoBar()

void WX_INFOBAR::onDismissInfoBar ( wxCommandEvent &  aEvent)
protected

Event handler for dismissing the infobar using a wxCommandEvent of the type KIEVT_DISMISS_INFOBAR.

Definition at line 330 of file infobar.cpp.

331 {
332  Dismiss();
333 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:171

References Dismiss().

◆ onShowInfoBar()

void WX_INFOBAR::onShowInfoBar ( wxCommandEvent &  aEvent)
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 322 of file infobar.cpp.

323 {
325  AddCloseButton();
326  ShowMessage( aEvent.GetString(), aEvent.GetInt() );
327 }
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:129
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:282
void AddCloseButton(const wxString &aTooltip=_("Hide this message."))
Add the default close button to the infobar on the right side.
Definition: infobar.cpp:272

References AddCloseButton(), RemoveAllButtons(), and ShowMessage().

◆ onSize()

void WX_INFOBAR::onSize ( wxSizeEvent &  aEvent)
protected

Definition at line 191 of file infobar.cpp.

192 {
193  int barWidth = GetSize().GetWidth();
194 
195  // Calculate the horizontal size: because the infobar is shown on top of the draw canvas
196  // it is adjusted to the canvas width.
197  // On Mac, the canvas is the parent
198  // On other OS the parent is EDA_BASE_FRAME that contains the canvas
199  int parentWidth = m_parent->GetClientSize().GetWidth();
200  EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_parent );
201 
202  if( frame && frame->GetToolCanvas() )
203  parentWidth = frame->GetToolCanvas()->GetSize().GetWidth();
204 
205 
206  if( barWidth != parentWidth )
207  SetSize( parentWidth, GetSize().GetHeight() );
208 
209  aEvent.Skip();
210 }
virtual wxWindow * GetToolCanvas() const =0
Canvas access.
The base frame for deriving all KiCad main window classes.

References TOOLS_HOLDER::GetToolCanvas().

Referenced by WX_INFOBAR().

◆ onTimer()

void WX_INFOBAR::onTimer ( wxTimerEvent &  aEvent)
protected

Event handler for the automatic closing timer.

Definition at line 342 of file infobar.cpp.

343 {
344  // Reset and clear the timer
345  m_showTimer->Stop();
346  m_showTime = 0;
347 
348  Dismiss();
349 }
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:252
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:171
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:250

References Dismiss(), m_showTime, and m_showTimer.

◆ QueueDismiss()

void WX_INFOBAR::QueueDismiss ( )

Send the infobar an event telling it to hide itself.

Definition at line 110 of file infobar.cpp.

111 {
112  wxCommandEvent* evt = new wxCommandEvent( KIEVT_DISMISS_INFOBAR );
113 
114  GetEventHandler()->QueueEvent( evt );
115 }

Referenced by INFOBAR_REPORTER::Finalize().

◆ QueueShowMessage()

void WX_INFOBAR::QueueShowMessage ( const wxString &  aMessage,
int  aFlags = wxICON_INFORMATION 
)

Send the infobar an event telling it to show a message.

Parameters
aMessageis the message to display
aFlagsis the flag containing the icon to display on the left side of the infobar

Definition at line 99 of file infobar.cpp.

100 {
101  wxCommandEvent* evt = new wxCommandEvent( KIEVT_SHOW_INFOBAR );
102 
103  evt->SetString( aMessage.c_str() );
104  evt->SetInt( aFlags );
105 
106  GetEventHandler()->QueueEvent( evt );
107 }

Referenced by INFOBAR_REPORTER::Finalize().

◆ RemoveAllButtons()

void WX_INFOBAR::RemoveAllButtons ( )

Remove all the buttons that have been added by the user.

Definition at line 282 of file infobar.cpp.

283 {
284  wxSizer* sizer = GetSizer();
285 
286  if( sizer->GetItemCount() == 0 )
287  return;
288 
289  // The last item is already the spacer
290  if( sizer->GetItem( sizer->GetItemCount() - 1 )->IsSpacer() )
291  return;
292 
293  for( int i = sizer->GetItemCount() - 1; i >= 0; i-- )
294  {
295  wxSizerItem* sItem = sizer->GetItem( i );
296 
297  // The spacer is the end of the custom buttons
298  if( sItem->IsSpacer() )
299  break;
300 
301  delete sItem->GetWindow();
302  }
303 }

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), AUTOPLACE_TOOL::autoplace(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ERC::DIALOG_ERC(), PAD_TOOL::EditPad(), ZONE_FILLER_TOOL::FillAllZones(), ROUTER_TOOL::handleLayerSwitch(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), APPEARANCE_CONTROLS::onReadOnlySwatch(), onShowInfoBar(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::SetCurPart(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), and EDA_BASE_FRAME::ShowInfoBarWarning().

◆ SetCallback()

void WX_INFOBAR::SetCallback ( std::function< void(void)>  aCallback)
inline

Provide a callback to be called when the infobar is dismissed (either by user action or timer).

Parameters
aCallback

Definition at line 150 of file infobar.h.

151  {
152  m_callback = aCallback;
153  }
OPT< std::function< void(void)> > m_callback
Optional callback made when closing infobar.
Definition: infobar.h:256

References m_callback.

Referenced by EDA_BASE_FRAME::ShowInfoBarError().

◆ SetShowTime()

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).

Parameters
aTimeis the time in milliseconds to show the infobar

Definition at line 93 of file infobar.cpp.

94 {
95  m_showTime = aTime;
96 }
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:250

References m_showTime.

◆ ShowMessage() [1/2]

void WX_INFOBAR::ShowMessage ( const wxString &  aMessage,
int  aFlags = wxICON_INFORMATION 
)
override

Show the info bar with the provided message and icon.

Parameters
aMessageis the message to display
aFlagsis the flag containing the icon to display on the left side of the infobar

Definition at line 129 of file infobar.cpp.

130 {
131  // Don't do anything if we requested the UI update
132  if( m_updateLock )
133  return;
134 
135  m_updateLock = true;
136 
137  wxInfoBarGeneric::ShowMessage( aMessage, aFlags );
138 
139  if( m_auiManager )
140  updateAuiLayout( true );
141 
142  if( m_showTime > 0 )
143  m_showTimer->StartOnce( m_showTime );
144 
146  m_updateLock = false;
147 }
void updateAuiLayout(bool aShow)
Update the AUI pane to show or hide this infobar.
Definition: infobar.cpp:213
GENERIC Are messages that do not have special handling.
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:252
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:253
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:254
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:250

References GENERIC, m_auiManager, m_showTime, m_showTimer, m_type, m_updateLock, and updateAuiLayout().

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_ERC::DIALOG_ERC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), PAD_TOOL::EditPad(), PL_EDITOR_FRAME::LoadPageLayoutDescrFile(), DIALOG_BOARD_SETUP::OnPageChange(), onShowInfoBar(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::SetCurPart(), ShowMessage(), ShowMessageFor(), and PAGED_DIALOG::TransferDataFromWindow().

◆ ShowMessage() [2/2]

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.

Parameters
aMessageis the message to display
aFlagsis the flag containing the icon to display on the left side of the infobar
aTypeis the type of message being displayed

Definition at line 150 of file infobar.cpp.

151 {
152  // Don't do anything if we requested the UI update
153  if( m_updateLock )
154  return;
155 
156  ShowMessage( aMessage, aFlags );
157 
158  m_type = aType;
159 }
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:129
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:254

References m_type, m_updateLock, and ShowMessage().

◆ ShowMessageFor()

void WX_INFOBAR::ShowMessageFor ( const wxString &  aMessage,
int  aTime,
int  aFlags = wxICON_INFORMATION 
)

Show the infobar with the provided message and icon for a specific period of time.

Parameters
aMessageis the message to display
aTimeis the amount of time in milliseconds to show the infobar
aFlagsis the flag containing the icon to display on the left side of the infobar

Definition at line 118 of file infobar.cpp.

119 {
120  // Don't do anything if we requested the UI update
121  if( m_updateLock )
122  return;
123 
124  m_showTime = aTime;
125  ShowMessage( aMessage, aFlags );
126 }
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:129
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:251
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:250

References m_showTime, m_updateLock, and ShowMessage().

Referenced by AUTOPLACE_TOOL::autoplace(), ZONE_FILLER_TOOL::FillAllZones(), ROUTER_TOOL::handleLayerSwitch(), APPEARANCE_CONTROLS::onReadOnlySwatch(), PAGED_DIALOG::OnUpdateUI(), SYMBOL_EDIT_FRAME::saveAllLibraries(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), and EDA_BASE_FRAME::ShowInfoBarWarning().

◆ updateAuiLayout()

void WX_INFOBAR::updateAuiLayout ( bool  aShow)
protected

Update the AUI pane to show or hide this infobar.

Parameters
aShowis true to show the pane

Definition at line 213 of file infobar.cpp.

214 {
215  wxASSERT( m_auiManager );
216 
217  wxAuiPaneInfo& pane = m_auiManager->GetPane( this );
218 
219  // If the infobar is in a pane, then show/hide the pane
220  if( pane.IsOk() )
221  {
222  if( aShow )
223  pane.Show();
224  else
225  pane.Hide();
226  }
227 
228  // Update the AUI manager regardless
229  m_auiManager->Update();
230 }
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:253

References m_auiManager.

Referenced by Dismiss(), and ShowMessage().

Member Data Documentation

◆ m_auiManager

wxAuiManager* WX_INFOBAR::m_auiManager
protected

The AUI manager that contains this infobar.

Definition at line 253 of file infobar.h.

Referenced by Dismiss(), ShowMessage(), and updateAuiLayout().

◆ m_callback

OPT<std::function<void(void)> > WX_INFOBAR::m_callback
protected

Optional callback made when closing infobar.

Definition at line 256 of file infobar.h.

Referenced by Dismiss(), and SetCallback().

◆ m_showTime

int WX_INFOBAR::m_showTime
protected

The time to show the infobar. 0 = don't auto hide.

Definition at line 250 of file infobar.h.

Referenced by onTimer(), SetShowTime(), ShowMessage(), and ShowMessageFor().

◆ m_showTimer

wxTimer* WX_INFOBAR::m_showTimer
protected

The timer counting the autoclose period.

Definition at line 252 of file infobar.h.

Referenced by onTimer(), ShowMessage(), and ~WX_INFOBAR().

◆ m_type

MESSAGE_TYPE WX_INFOBAR::m_type
protected

The type of message being displayed.

Definition at line 254 of file infobar.h.

Referenced by DismissOutdatedSave(), and ShowMessage().

◆ m_updateLock

bool WX_INFOBAR::m_updateLock
protected

True if this infobar requested the UI update.

Definition at line 251 of file infobar.h.

Referenced by Dismiss(), DismissOutdatedSave(), IsLocked(), ShowMessage(), and ShowMessageFor().


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