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