KiCad PCB EDA Suite
Loading...
Searching...
No Matches
wx_infobar.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Ian McInerney <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
22#include <id.h>
23#include <kiplatform/ui.h>
24#include <widgets/wx_infobar.h>
25#include "wx/artprov.h"
26#include <wx/bmpbuttn.h>
27#include <wx/debug.h>
28#include <wx/hyperlink.h>
29#include <wx/infobar.h>
30#include <wx/sizer.h>
31#include <wx/stattext.h>
32#include <wx/timer.h>
33#include <wx/dcclient.h>
34
35#ifdef __WXMSW__
36#include <dpi_scaling_common.h>
37#endif
38
39
40wxDEFINE_EVENT( KIEVT_SHOW_INFOBAR, wxCommandEvent );
41wxDEFINE_EVENT( KIEVT_DISMISS_INFOBAR, wxCommandEvent );
42
43BEGIN_EVENT_TABLE( WX_INFOBAR, wxInfoBarGeneric )
44 EVT_COMMAND( wxID_ANY, KIEVT_SHOW_INFOBAR, WX_INFOBAR::onShowInfoBar )
45 EVT_COMMAND( wxID_ANY, KIEVT_DISMISS_INFOBAR, WX_INFOBAR::onDismissInfoBar )
46
47 EVT_SYS_COLOUR_CHANGED( WX_INFOBAR::onThemeChange )
50END_EVENT_TABLE()
51
52
53static const wxString OVERLAY_HOST_NAME = wxS( "InfobarOverlayHost" );
54
55
56// Overlay infobars on the same window share one host where the platform needs one
57static wxWindow* overlayParent( wxWindow* aParent, bool aOverlay )
58{
59 if( !aOverlay )
60 return aParent;
61
62 for( wxWindow* child : aParent->GetChildren() )
63 {
64 if( child->GetName() == OVERLAY_HOST_NAME )
65 return child;
66 }
67
68 if( wxWindow* host = KIPLATFORM::UI::CreateCanvasOverlay( aParent ) )
69 {
70 host->SetName( OVERLAY_HOST_NAME );
71 return host;
72 }
73
74 return aParent;
75}
76
77
78WX_INFOBAR::WX_INFOBAR( wxWindow* aParent, wxWindowID aWinid, bool aOverlay )
79 : wxInfoBarGeneric( overlayParent( aParent, aOverlay ), aWinid ),
80 m_showTime( 0 ),
81 m_updateLock( false ),
82 m_overlay( aOverlay ),
83 m_anchor( aParent ),
84 m_showTimer( nullptr ),
86{
87 m_showTimer = new wxTimer( this, ID_CLOSE_INFOBAR );
88
89 wxColour fg, bg;
91 SetBackgroundColour( bg );
92 SetForegroundColour( fg );
93
94#ifdef __WXMAC__
95 // Infobar is broken on Mac without the effects
96 SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP );
97 SetEffectDuration( 200 );
98#else
99 // Infobar freezes canvas on Windows with the effect, and GTK looks bad with it
100 SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
101#endif
102
103 // The infobar seems to start too small, so increase its height
104 int sx, sy;
105 GetSize( &sx, &sy );
106 sy = 1.5 * sy;
107
108 // The bitmap gets cutoff sometimes with the default size, so force it to be the same
109 // height as the infobar.
110 wxSizer* sizer = GetSizer();
111 wxSize iconSize = wxArtProvider::GetSizeHint( wxART_BUTTON );
112
113#ifdef __WXMSW__
114 DPI_SCALING_COMMON dpi( nullptr, aParent );
115 iconSize.x *= dpi.GetContentScaleFactor();
116 sx *= dpi.GetContentScaleFactor();
117 sy *= dpi.GetContentScaleFactor();
118#endif
119
120 SetSize( sx, sy );
121
122 sizer->SetItemMinSize( (size_t) 0, iconSize.x, sy );
123
124 // The default close button doesn't work with the AUI manager update scheme, so take it out
125 // of the layout to ensure any close button displayed is ours. It must not be destroyed
126 // because wxInfoBarGeneric keeps a private pointer to it and recolors it on every system
127 // color change.
128 wxSizerItem* lastItem = sizer->GetItem( sizer->GetItemCount() - 1 );
129
130 if( wxWindow* defaultCloseButton = lastItem ? lastItem->GetWindow() : nullptr )
131 {
132 sizer->Detach( defaultCloseButton );
133 defaultCloseButton->Hide();
134 }
135
136 Layout();
137
138 m_anchor->Bind( wxEVT_SIZE, &WX_INFOBAR::onSize, this );
139}
140
141
143{
144 m_anchor->Unbind( wxEVT_SIZE, &WX_INFOBAR::onSize, this );
145
146 delete m_showTimer;
147}
148
149
150void WX_INFOBAR::SetShowTime( int aTime )
151{
152 m_showTime = aTime;
153}
154
155
156void WX_INFOBAR::QueueShowMessage( const wxString& aMessage, int aFlags )
157{
158 wxCommandEvent* evt = new wxCommandEvent( KIEVT_SHOW_INFOBAR );
159
160 evt->SetString( aMessage.c_str() );
161 evt->SetInt( aFlags );
162
163 GetEventHandler()->QueueEvent( evt );
164}
165
166
168{
169 wxCommandEvent* evt = new wxCommandEvent( KIEVT_DISMISS_INFOBAR );
170
171 GetEventHandler()->QueueEvent( evt );
172}
173
174
175void WX_INFOBAR::ShowMessageFor( const wxString& aMessage, int aTime, int aFlags,
176 MESSAGE_TYPE aType )
177{
178 // Don't do anything if we requested the UI update
179 if( m_updateLock )
180 return;
181
182 m_showTime = aTime;
183 ShowMessage( aMessage, aFlags );
184
185 m_type = aType;
186}
187
188
189void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags )
190{
191 // Don't do anything if we requested the UI update
192 if( m_updateLock )
193 return;
194
195 m_updateLock = true;
196
197 m_message = aMessage;
198 m_message.Trim();
199
200 wxInfoBarGeneric::ShowMessage( m_message, aFlags );
201
203
204 // Force infoBar to full-width. Yes, this should happen automatically, and it does -- sometimes.
205 FixSize();
207
208 if( m_showTime > 0 )
209 m_showTimer->StartOnce( m_showTime );
210
211 m_type = MESSAGE_TYPE::GENERIC;
212 m_updateLock = false;
213}
214
215
216void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags, MESSAGE_TYPE aType )
217{
218 // Don't do anything if we requested the UI update
219 if( m_updateLock )
220 return;
221
222 ShowMessage( aMessage, aFlags );
223
224 m_type = aType;
225}
226
227
229{
230 if( !IsShownOnScreen() )
231 return;
232
233 // Don't do anything if we requested the UI update
234 if( m_updateLock )
235 return;
236
237 m_updateLock = true;
238
239 wxInfoBarGeneric::Dismiss();
240
243
244 if( m_callback )
245 (*m_callback)();
246
247 m_updateLock = false;
248}
249
250
251void WX_INFOBAR::onThemeChange( wxSysColourChangedEvent& aEvent )
252{
253 wxColour fg, bg;
255 SetBackgroundColour( bg );
256 SetForegroundColour( fg );
257
258 // The close button bitmaps are filled with the old background, so put a new button in its place
259 if( wxBitmapButton* btn = GetCloseButton() )
260 {
261 wxBitmapButton* fresh = wxBitmapButton::NewCloseButton( this, ID_CLOSE_INFOBAR );
262#ifdef __WXMAC__
263 fresh->SetWindowVariant( wxWINDOW_VARIANT_SMALL );
264#endif
265 fresh->SetToolTip( btn->GetToolTipText() );
266 GetSizer()->Replace( btn, fresh, true );
267 btn->Destroy();
268 Layout();
269 }
270}
271
272
273// Big hack here. We've had many bugs for a long time with the info bar not being full-width. Things got
274// better in the 9.0 time-frame, but then started to degrade again in 10.0/11.0.
275//
276// This attempts to fix things by correcting the size every time the infobar is shown. But even that has
277// flies in the ointment, as the "normal" infobar height is calculated before the icon is added to it, and
278// is shorter.
279//
280// So we have to squirrel away the icon, calculate the size, and then re-attach the icon.
281
283{
284 wxSizer* sizer = GetSizer();
285
286 if( !sizer || sizer->GetItemCount() == 0 )
287 return;
288
289#if wxCHECK_VERSION( 3, 3, 0 )
290 // On wx 3.3 item 0 is not the icon. It is a nested sizer that holds everything.
291 // Detaching it leaves the infobar empty. Then doSize() reads a null item and crashes.
292 doSize();
293 Layout();
294#else
295 wxWindow* icon = sizer->GetItem( (size_t) 0 )->GetWindow();
296 sizer->Detach( 0 );
297
298 doSize();
299
300 sizer->Prepend( icon, 0, wxLEFT | wxRIGHT, 5 );
301 Layout();
302#endif
303}
304
305
306void WX_INFOBAR::onSize( wxSizeEvent& aEvent )
307{
308 doSize();
310
311 aEvent.Skip();
312}
313
314
316{
317 int barWidth = GetSize().GetWidth();
318 wxSizer* sizer = GetSizer();
319
320 if( !sizer )
321 return;
322
323 // wx3.3 moved the sizer we previously wanted deeper into sizers...
324 // do we actually still need this for wx3.3?
325 #if wxCHECK_VERSION( 3, 3, 0 )
326 wxSizerItem* outerSizer = sizer->GetItem( (size_t) 0 );
327 wxSizerItem* textSizer = nullptr;
328
329 if (outerSizer->IsSizer())
330 {
331 wxBoxSizer* innerSizer1 = dynamic_cast<wxBoxSizer*>( outerSizer->GetSizer() );
332 wxBoxSizer* innerSizer2 =
333 dynamic_cast<wxBoxSizer*>( innerSizer1->GetItem((size_t)0)->GetSizer() );
334
335 if( innerSizer2 )
336 textSizer = innerSizer2->GetItem( 1 );
337 }
338 #else
339 wxSizerItem* textSizer = sizer->GetItem( 1 );
340 #endif
341
342 if( textSizer )
343 {
344 if( wxStaticText* textCtrl = dynamic_cast<wxStaticText*>( textSizer->GetWindow() ) )
345 textCtrl->SetLabelText( m_message );
346 }
347
348 int parentWidth = m_anchor->GetClientSize().GetWidth();
349
350 if( barWidth != parentWidth )
351 SetSize( parentWidth, GetSize().GetHeight() );
352
353 if( textSizer )
354 {
355 if( wxStaticText* textCtrl = dynamic_cast<wxStaticText*>( textSizer->GetWindow() ) )
356 {
357 // Re-wrap the text (this is done automatically later but we need it now)
358 // And count how many lines we need. If we have embedded newlines, then
359 // multiply the number of lines by the text min height to find the correct
360 // min height for the control. The min height of the text control will be the size
361 // of a single line of text. This assumes that two lines of text are larger
362 // than the height of the icon for the bar.
363 textCtrl->Wrap( -1 );
364 wxString wrapped_text = textCtrl->GetLabel();
365 int line_count = wrapped_text.Freq( '\n' ) + 1;
366 int txt_h, txt_v;
367 wxWindowDC dc( textCtrl );
368 dc.GetTextExtent( wxT( "Xp" ), &txt_h, &txt_v );
369
370 int height = txt_v * line_count;
371 int margins = txt_v - 1;
372 SetMinSize( wxSize( GetSize().GetWidth(), height + margins ) );
373
374 textCtrl->Wrap( -1 );
375 }
376 }
377}
378
379
381{
382 if( !m_overlay )
383 return;
384
385 int width = m_anchor->GetClientSize().GetWidth();
386 int y = 0;
387
388 for( wxWindow* child : m_parent->GetChildren() )
389 {
390 WX_INFOBAR* bar = dynamic_cast<WX_INFOBAR*>( child );
391
392 if( !bar || !bar->IsShown() )
393 continue;
394
395 int height = bar->GetEffectiveMinSize().GetHeight();
396
397 bar->SetSize( 0, y, width, height );
398
399 // The GAL backend window is a sibling that raises itself whenever it is shown
400 bar->Raise();
401
402 y += height;
403 }
404
405 if( m_parent != m_anchor )
406 {
407 if( y > 0 )
408 m_parent->SetSize( wxDefaultCoord, wxDefaultCoord, width, y );
409
410 m_parent->Show( y > 0 );
411 }
412
413 if( EDA_DRAW_PANEL_GAL* canvas = dynamic_cast<EDA_DRAW_PANEL_GAL*>( m_anchor ) )
414 canvas->UpdateOverlayExclusions();
415}
416
417
419{
420 if( !m_overlay )
421 return;
422
423 // A GAL canvas skips repaints when no target is dirty, leaving the uncovered strip stale
424 if( EDA_DRAW_PANEL_GAL* canvas = dynamic_cast<EDA_DRAW_PANEL_GAL*>( m_anchor ) )
425 {
426 canvas->ForceRefresh();
427
428 // ForceRefresh() gives up silently if the context is busy, so queue a backstop
429 canvas->RequestRefresh();
430 }
431 else
432 {
433 m_anchor->Refresh();
434 }
435}
436
437
438void WX_INFOBAR::AddButton( wxWindowID aId, const wxString& aLabel )
439{
440 wxButton* button = new wxButton( this, aId, aLabel );
441
442 AddButton( button );
443}
444
445
446void WX_INFOBAR::AddButton( wxButton* aButton )
447{
448 wxSizer* sizer = GetSizer();
449
450 wxASSERT( aButton );
451
452#ifdef __WXMAC__
453 // Based on the code in the original class:
454 // smaller buttons look better in the (narrow) info bar under OS X
455 aButton->SetWindowVariant( wxWINDOW_VARIANT_SMALL );
456#endif // __WXMAC__
457
458 auto element = sizer->Add( aButton, wxSizerFlags( 0 ).Centre().Border( wxRIGHT ) );
459
460 element->SetFlag( wxSTRETCH_MASK );
461
462 if( IsShownOnScreen() )
463 {
464 Layout();
465 sizer->Fit( this );
466 }
467}
468
469
470void WX_INFOBAR::AddLink(const wxString& aLinkText, const std::function<void(wxHyperlinkEvent&)>& aFn )
471{
472 wxSizer* sizer = GetSizer();
473 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( this, wxID_ANY, aLinkText, wxEmptyString );
474
475 button->Bind( wxEVT_COMMAND_HYPERLINK, aFn );
476
477 sizer->Add( button, wxSizerFlags().Centre().Border( wxRIGHT ).Shaped() );
478
479 if( IsShownOnScreen() )
480 {
481 Layout();
482 sizer->Fit( this );
483 }
484}
485
486
487void WX_INFOBAR::AddCloseButton( const wxString& aTooltip )
488{
489 wxBitmapButton* button = wxBitmapButton::NewCloseButton( this, ID_CLOSE_INFOBAR );
490
491 button->SetToolTip( aTooltip );
492
493 AddButton( button );
494}
495
496
498{
499 wxSizer* sizer = GetSizer();
500
501 if( sizer->GetItemCount() == 0 )
502 return;
503
504 // The last item is already the spacer
505 if( sizer->GetItem( sizer->GetItemCount() - 1 )->IsSpacer() )
506 return;
507
508 for( int i = (int) sizer->GetItemCount() - 1; i >= 0; i-- )
509 {
510 wxSizerItem* sItem = sizer->GetItem( i );
511
512 // The spacer is the end of the custom buttons
513 if( sItem->IsSpacer() )
514 break;
515
516 if( wxWindow* button = sItem->GetWindow() )
517 {
518 sizer->Detach( button );
519 button->Destroy();
520 }
521 }
522}
523
524
526{
527 return GetCloseButton();
528}
529
530
531wxBitmapButton* WX_INFOBAR::GetCloseButton() const
532{
533 wxSizer* sizer = GetSizer();
534
535 if( !sizer )
536 return nullptr;
537
538 if( sizer->GetItemCount() == 0 )
539 return nullptr;
540
541 if( sizer->GetItem( sizer->GetItemCount() - 1 )->IsSpacer() )
542 return nullptr;
543
544 wxSizerItem* item = sizer->GetItem( sizer->GetItemCount() - 1 );
545
546 if( item && item->GetWindow() && item->GetWindow()->GetId() == ID_CLOSE_INFOBAR )
547 return static_cast<wxBitmapButton*>( item->GetWindow() );
548
549 return nullptr;
550}
551
552
553void WX_INFOBAR::onShowInfoBar( wxCommandEvent& aEvent )
554{
557 ShowMessage( aEvent.GetString(), aEvent.GetInt() );
558}
559
560
561void WX_INFOBAR::onDismissInfoBar( wxCommandEvent& aEvent )
562{
563 Dismiss();
564}
565
566
567void WX_INFOBAR::onCloseButton( wxCommandEvent& aEvent )
568{
569 Dismiss();
570}
571
572
573void WX_INFOBAR::onTimer( wxTimerEvent& aEvent )
574{
575 // Reset and clear the timer
576 m_showTimer->Stop();
577 m_showTime = 0;
578
579 Dismiss();
580}
581
582
583EDA_INFOBAR_PANEL::EDA_INFOBAR_PANEL( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos,
584 const wxSize& aSize, long aStyle, const wxString& aName )
585 : wxPanel( aParent, aId, aPos, aSize, aStyle, aName )
586{
587 m_mainSizer = new wxFlexGridSizer( 1, 0, 0 );
588
589 m_mainSizer->SetFlexibleDirection( wxBOTH );
590 m_mainSizer->AddGrowableCol( 0, 1 );
591
592 SetSizer( m_mainSizer );
593}
594
595
597{
598 wxASSERT( aInfoBar );
599
600 aInfoBar->Reparent( this );
601 m_mainSizer->Add( aInfoBar, 1, wxEXPAND, 0 );
602 m_mainSizer->Layout();
603}
604
605
606void EDA_INFOBAR_PANEL::AddOtherItem( wxWindow* aOtherItem )
607{
608 wxASSERT( aOtherItem );
609
610 aOtherItem->Reparent( this );
611 m_mainSizer->Add( aOtherItem, 1, wxEXPAND, 0 );
612
613 m_mainSizer->AddGrowableRow( 1, 1 );
614 m_mainSizer->Layout();
615}
616
617
618REPORTER& INFOBAR_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
619{
620 m_message.reset( new wxString( aText ) );
621 m_severity = aSeverity;
622 m_messageSet = true;
623
624 return *this;
625}
626
627
629{
630 return m_message && !m_message->IsEmpty();
631}
632
633
635{
636 // Don't do anything if no message was ever given
637 if( !m_infoBar || !m_messageSet )
638 return;
639
640 // Consume the pending report
641 m_messageSet = false;
642
643 // Short circuit if the message is empty and it is already hidden
644 if( !HasMessage() && !m_infoBar->IsShownOnScreen() )
645 return;
646
647 int icon = wxICON_NONE;
648
649 switch( m_severity )
650 {
651 case RPT_SEVERITY_UNDEFINED: icon = wxICON_INFORMATION; break;
652 case RPT_SEVERITY_INFO: icon = wxICON_INFORMATION; break;
653 case RPT_SEVERITY_EXCLUSION: icon = wxICON_WARNING; break;
654 case RPT_SEVERITY_ACTION: icon = wxICON_WARNING; break;
655 case RPT_SEVERITY_WARNING: icon = wxICON_WARNING; break;
656 case RPT_SEVERITY_ERROR: icon = wxICON_ERROR; break;
657 case RPT_SEVERITY_IGNORE: icon = wxICON_INFORMATION; break;
658 case RPT_SEVERITY_DEBUG: icon = wxICON_INFORMATION; break;
659 }
660
661 if( m_message->EndsWith( wxS( "\n" ) ) )
662 *m_message = m_message->Left( m_message->Length() - 1 );
663
664 if( HasMessage() )
665 m_infoBar->QueueShowMessage( *m_message, icon );
666 else
667 m_infoBar->QueueDismiss();
668}
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
double GetContentScaleFactor() const override
Get the content scale factor, which may be different from the scale factor on some platforms.
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
Definition wx_infobar.h:315
void AddInfoBar(WX_INFOBAR *aInfoBar)
Add the given infobar object to the panel.
void AddOtherItem(wxWindow *aOtherItem)
Add the other item to the panel.
WX_INFOBAR * m_infoBar
Definition wx_infobar.h:352
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.
SEVERITY m_severity
Definition wx_infobar.h:354
std::unique_ptr< wxString > m_message
Definition wx_infobar.h:353
bool HasMessage() const override
Returns true if any messages were reported.
REPORTER()
Definition reporter.h:75
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:76
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.
Definition wx_infobar.h:266
bool m_overlay
True if this infobar is drawn on top of its parent.
Definition wx_infobar.h:263
INFOBAR_MESSAGE_TYPE MESSAGE_TYPE
Definition wx_infobar.h:97
void AddLink(const wxString &aLinkText, const std::function< void(wxHyperlinkEvent &)> &aFn)
Add a hypertext link to the 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.
Definition wx_infobar.h:269
wxString m_message
The original message without wrapping.
Definition wx_infobar.h:267
WX_INFOBAR(wxWindow *aParent, wxWindowID aWinId=wxID_ANY, bool aOverlay=false)
Construct an infobar.
int m_showTime
The time to show the infobar. 0 = don't auto hide.
Definition wx_infobar.h:261
bool m_updateLock
True if this infobar requested the UI update.
Definition wx_infobar.h:262
void onShowInfoBar(wxCommandEvent &aEvent)
Event handler for showing the infobar using a wxCommandEvent of the type KIEVT_SHOW_INFOBAR.
void doSize()
wxWindow * m_anchor
The window this infobar spans, its parent unless hosted.
Definition wx_infobar.h:264
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.
wxTimer * m_showTimer
The timer counting the autoclose period.
Definition wx_infobar.h:265
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.
wxWindow * CreateCanvasOverlay(wxWindow *aCanvas)
Create a window for widgets that are shown over a canvas without taking space from it.
Definition wxgtk/ui.cpp:197
void GetInfoBarColours(wxColour &aFGColour, wxColour &aBGColour)
Return the background and foreground colors for info bars in the current scheme.
Definition wxgtk/ui.cpp:73
void KeepAboveExternalRendering(wxWindow *aChild)
Keep a child visible on top of a parent prepared with PrepareForExternalRendering().
SEVERITY
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_UNDEFINED
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_IGNORE
@ RPT_SEVERITY_DEBUG
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
wxDEFINE_EVENT(KIEVT_SHOW_INFOBAR, wxCommandEvent)
static wxWindow * overlayParent(wxWindow *aParent, bool aOverlay)
static const wxString OVERLAY_HOST_NAME
@ ID_CLOSE_INFOBAR
ID for the close button on the frame's infobar.
Definition wx_infobar.h:41
@ GENERIC
GENERIC Are messages that do not have special handling.