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, MESSAGE_TYPE::DRC_RULES_ERROR, MESSAGE_TYPE::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. More...
 
 ~WX_INFOBAR ()
 
MESSAGE_TYPE GetMessageType () const
 
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, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
 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 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 automatically 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 73 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.

DRC_RULES_ERROR 
DRC_VIOLATION 

Definition at line 91 of file infobar.h.

92  {
93  GENERIC,
94  OUTDATED_SAVE,
95  DRC_RULES_ERROR,
96  DRC_VIOLATION
97  };

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 47 of file infobar.cpp.

48  : wxInfoBarGeneric( aParent, aWinid ),
49  m_showTime( 0 ),
50  m_updateLock( false ),
51  m_showTimer( nullptr ),
52  m_auiManager( aMgr ),
54 {
55  m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
56 
57 #ifdef __WXMAC__
58  // wxWidgets hard-codes wxSYS_COLOUR_INFOBK to { 0xFF, 0xFF, 0xD3 } on Mac.
60  SetBackgroundColour( wxColour( 28, 27, 20 ) );
61  else
62  SetBackgroundColour( wxColour( 255, 249, 189 ) );
63 
64  // Infobar is broken on Mac without the effects
65  SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP );
66  SetEffectDuration( 300 );
67 #else
68  // Infobar freezes canvas on Windows with the effect, and GTK looks bad with it
69  SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
70 #endif
71 
72 
73  // The infobar seems to start too small, so increase its height
74  int sx, sy;
75  GetSize( &sx, &sy );
76  sy = 1.5 * sy;
77  SetSize( sx, sy );
78 
79  // The bitmap gets cutoff sometimes with the default size, so force it to be the same
80  // height as the infobar.
81  wxSizer* sizer = GetSizer();
82  wxSize iconSize = wxArtProvider::GetSizeHint( wxART_BUTTON );
83 
84  sizer->SetItemMinSize( (size_t) 0, iconSize.x, sy );
85 
86  // Forcefully remove all existing buttons added by the wx constructors.
87  // The default close button doesn't work with the AUI manager update scheme, so this
88  // ensures any close button displayed is ours.
90 
91  Layout();
92 
93  m_parent->Bind( wxEVT_SIZE, &WX_INFOBAR::onSize, this );
94 }
void onSize(wxSizeEvent &aEvent)
Definition: infobar.cpp:195
GENERIC Are messages that do not have special handling.
bool IsDarkTheme()
Determine if the desktop interface is currently using a dark theme or a light theme.
Definition: gtk/ui.cpp:31
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:253
ID for the close button on the frame's infobar.
Definition: infobar.h:39
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:286
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:254
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:252
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:255
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:251

References ID_CLOSE_INFOBAR, KIPLATFORM::UI::IsDarkTheme(), and onSize().

◆ ~WX_INFOBAR()

WX_INFOBAR::~WX_INFOBAR ( )

Definition at line 97 of file infobar.cpp.

98 {
99  delete m_showTimer;
100 }
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:253

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 245 of file infobar.cpp.

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

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

◆ 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 263 of file infobar.cpp.

264 {
265  wxSizer* sizer = GetSizer();
266 
267  wxASSERT( aHypertextButton );
268 
269  sizer->Add( aHypertextButton, wxSizerFlags().Centre().Border( wxRIGHT ) );
270 
271  if( IsShown() )
272  sizer->Layout();
273 }

◆ 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 position.

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

Definition at line 237 of file infobar.cpp.

238 {
239  wxButton* button = new wxButton( this, aId, aLabel );
240 
241  AddButton( button );
242 }
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:245

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 276 of file infobar.cpp.

277 {
278  wxBitmapButton* button = wxBitmapButton::NewCloseButton( this, ID_CLOSE_INFOBAR );
279 
280  button->SetToolTip( aTooltip );
281 
282  AddButton( button );
283 }
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
Definition: infobar.cpp:245
ID for the close button on the frame's infobar.
Definition: infobar.h:39

References AddButton(), and ID_CLOSE_INFOBAR.

Referenced by FOOTPRINT_EDIT_FRAME::AddFootprintToBoard(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), 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 175 of file infobar.cpp.

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

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

Referenced by SCH_EDIT_FRAME::ClearFindReplaceStatus(), DRAWING_TOOL::DrawVia(), PAD_TOOL::EditPad(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), PL_EDITOR_FRAME::LoadDrawingSheetFile(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), 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(), SCH_EDIT_FRAME::SaveProject(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_DRAWING_TOOLS::SingleClickPlace(), and PCB_CONTROL::unfilledZoneCheck().

◆ GetMessageType()

MESSAGE_TYPE WX_INFOBAR::GetMessageType ( ) const
inline

Definition at line 99 of file infobar.h.

99 { return m_type; }
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:255

References m_type.

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

◆ HasCloseButton()

bool WX_INFOBAR::HasCloseButton ( ) const

Definition at line 310 of file infobar.cpp.

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

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

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

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 340 of file infobar.cpp.

341 {
342  Dismiss();
343 }
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175

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 334 of file infobar.cpp.

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

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 326 of file infobar.cpp.

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

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

◆ onSize()

void WX_INFOBAR::onSize ( wxSizeEvent &  aEvent)
protected

Definition at line 195 of file infobar.cpp.

196 {
197  int barWidth = GetSize().GetWidth();
198 
199  // Calculate the horizontal size: because the infobar is shown on top of the draw canvas
200  // it is adjusted to the canvas width.
201  // On Mac, the canvas is the parent
202  // On other OS the parent is EDA_BASE_FRAME that contains the canvas
203  int parentWidth = m_parent->GetClientSize().GetWidth();
204  EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_parent );
205 
206  if( frame && frame->GetToolCanvas() )
207  parentWidth = frame->GetToolCanvas()->GetSize().GetWidth();
208 
209 
210  if( barWidth != parentWidth )
211  SetSize( parentWidth, GetSize().GetHeight() );
212 
213  aEvent.Skip();
214 }
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 346 of file infobar.cpp.

347 {
348  // Reset and clear the timer
349  m_showTimer->Stop();
350  m_showTime = 0;
351 
352  Dismiss();
353 }
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:253
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:251

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 120 of file infobar.cpp.

121 {
122  wxCommandEvent* evt = new wxCommandEvent( KIEVT_DISMISS_INFOBAR );
123 
124  GetEventHandler()->QueueEvent( evt );
125 }

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 109 of file infobar.cpp.

110 {
111  wxCommandEvent* evt = new wxCommandEvent( KIEVT_SHOW_INFOBAR );
112 
113  evt->SetString( aMessage.c_str() );
114  evt->SetInt( aFlags );
115 
116  GetEventHandler()->QueueEvent( evt );
117 }

Referenced by INFOBAR_REPORTER::Finalize().

◆ RemoveAllButtons()

void WX_INFOBAR::RemoveAllButtons ( )

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

Definition at line 286 of file infobar.cpp.

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

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::LoadDrawingSheetFile(), APPEARANCE_CONTROLS::onReadOnlySwatch(), onShowInfoBar(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), EDA_BASE_FRAME::ShowInfoBarError(), EDA_BASE_FRAME::ShowInfoBarMsg(), EDA_BASE_FRAME::ShowInfoBarWarning(), and PCB_CONTROL::unfilledZoneCheck().

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

157  {
158  m_callback = aCallback;
159  }
OPT< std::function< void(void)> > m_callback
Optional callback made when closing infobar.
Definition: infobar.h:257

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 103 of file infobar.cpp.

104 {
105  m_showTime = aTime;
106 }
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:251

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 142 of file infobar.cpp.

143 {
144  // Don't do anything if we requested the UI update
145  if( m_updateLock )
146  return;
147 
148  m_updateLock = true;
149 
150  wxInfoBarGeneric::ShowMessage( aMessage, aFlags );
151 
152  if( m_auiManager )
153  updateAuiLayout( true );
154 
155  if( m_showTime > 0 )
156  m_showTimer->StartOnce( m_showTime );
157 
159  m_updateLock = false;
160 }
void updateAuiLayout(bool aShow)
Update the AUI pane to show or hide this infobar.
Definition: infobar.cpp:217
GENERIC Are messages that do not have special handling.
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition: infobar.h:253
wxAuiManager * m_auiManager
The AUI manager that contains this infobar.
Definition: infobar.h:254
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:252
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:255
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:251

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::LoadDrawingSheetFile(), DIALOG_BOARD_SETUP::OnPageChange(), onShowInfoBar(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::SetCurSymbol(), 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 163 of file infobar.cpp.

164 {
165  // Don't do anything if we requested the UI update
166  if( m_updateLock )
167  return;
168 
169  ShowMessage( aMessage, aFlags );
170 
171  m_type = aType;
172 }
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:142
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:252
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:255

References m_type, m_updateLock, and ShowMessage().

◆ ShowMessageFor()

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.

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 128 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_showTime = aTime;
136  ShowMessage( aMessage, aFlags );
137 
138  m_type = aType;
139 }
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:142
bool m_updateLock
True if this infobar requested the UI update.
Definition: infobar.h:252
MESSAGE_TYPE m_type
The type of message being displayed.
Definition: infobar.h:255
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition: infobar.h:251

References m_showTime, m_type, 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(), EDA_BASE_FRAME::ShowInfoBarWarning(), and PCB_CONTROL::unfilledZoneCheck().

◆ 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 217 of file infobar.cpp.

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

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 254 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 257 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 251 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 253 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 255 of file infobar.h.

Referenced by GetMessageType(), ShowMessage(), and ShowMessageFor().

◆ m_updateLock

bool WX_INFOBAR::m_updateLock
protected

True if this infobar requested the UI update.

Definition at line 252 of file infobar.h.

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


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