KiCad PCB EDA Suite
STATUS_POPUP Class Reference

Class STATUS_POPUP. More...

#include <status_popup.h>

Inheritance diagram for STATUS_POPUP:
STATUS_TEXT_POPUP PNS_TUNE_STATUS_POPUP

Public Member Functions

 STATUS_POPUP (wxWindow *aParent)
 Transient mouse following popup window implementation. More...
 
virtual ~STATUS_POPUP ()
 
virtual void Popup (wxWindow *aFocus=nullptr)
 
virtual void PopupFor (int aMsecs)
 
virtual void Move (const wxPoint &aWhere)
 
virtual void Move (const VECTOR2I &aWhere)
 
void Expire (int aMsecs)
 Hides the popup after a specified time. More...
 

Protected Member Functions

void updateSize ()
 
void onCharHook (wxKeyEvent &aEvent)
 
void onExpire (wxTimerEvent &aEvent)
 

Expire timer even handler

More...
 

Protected Attributes

wxPanel * m_panel
 
wxBoxSizer * m_topSizer
 
wxTimer m_expireTimer
 

Detailed Description

Class STATUS_POPUP.

A tiny, headerless popup window used to display useful status (e.g. line length tuning info) next to the mouse cursor.

Definition at line 42 of file status_popup.h.

Constructor & Destructor Documentation

◆ STATUS_POPUP()

STATUS_POPUP::STATUS_POPUP ( wxWindow *  aParent)

Transient mouse following popup window implementation.

Definition at line 32 of file status_popup.cpp.

32  :
33  wxPopupWindow( aParent ),
34  m_expireTimer( this )
35 {
36  m_panel = new wxPanel( this, wxID_ANY );
37  m_topSizer = new wxBoxSizer( wxVERTICAL );
38  m_panel->SetSizer( m_topSizer );
39  m_panel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
40 
41  Connect( wxEVT_TIMER, wxTimerEventHandler( STATUS_POPUP::onExpire ), NULL, this );
42 
43 #ifdef __WXOSX_MAC__
44  // Key events from popups don't get put through the wxWidgets event system on OSX,
45  // so we have to fall back to the CHAR_HOOK to forwared hotkeys from the popup to
46  // the canvas / frame.
47  Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( STATUS_POPUP::onCharHook ), nullptr, this );
48 #endif
49 }
void onExpire(wxTimerEvent &aEvent)
Expire timer even handler
wxPanel * m_panel
Definition: status_popup.h:68
void onCharHook(wxKeyEvent &aEvent)
wxTimer m_expireTimer
Definition: status_popup.h:70
wxBoxSizer * m_topSizer
Definition: status_popup.h:69

References m_panel, m_topSizer, onCharHook(), and onExpire().

◆ ~STATUS_POPUP()

virtual STATUS_POPUP::~STATUS_POPUP ( )
inlinevirtual

Definition at line 46 of file status_popup.h.

46 {}

Member Function Documentation

◆ Expire()

void STATUS_POPUP::Expire ( int  aMsecs)

Hides the popup after a specified time.

Parameters
aMsecsis the time expressed in milliseconds

Definition at line 94 of file status_popup.cpp.

95 {
96  m_expireTimer.StartOnce( aMsecs );
97 }
wxTimer m_expireTimer
Definition: status_popup.h:70

References m_expireTimer.

Referenced by EDIT_TOOL::pickCopyReferencePoint(), and PopupFor().

◆ Move() [1/2]

void STATUS_POPUP::Move ( const wxPoint &  aWhere)
virtual

Definition at line 88 of file status_popup.cpp.

89 {
90  SetPosition( aWhere );
91 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References PCAD2KICAD::SetPosition().

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), EDIT_TOOL::pickCopyReferencePoint(), EDIT_TOOL::Remove(), SCH_EDIT_FRAME::ShowFindReplaceStatus(), and LENGTH_TUNER_TOOL::updateStatusPopup().

◆ Move() [2/2]

void STATUS_POPUP::Move ( const VECTOR2I aWhere)
virtual

Definition at line 82 of file status_popup.cpp.

83 {
84  SetPosition( wxPoint( aWhere.x, aWhere.y ) );
85 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References PCAD2KICAD::SetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ onCharHook()

void STATUS_POPUP::onCharHook ( wxKeyEvent &  aEvent)
protected

Definition at line 52 of file status_popup.cpp.

53 {
54  // Key events from the status popup don't get put through the wxWidgets event system on
55  // OSX, so we have to fall back to the CHAR_HOOK to forward hotkeys from the popup to
56  // the canvas / frame.
57  aEvent.SetEventType( wxEVT_CHAR );
58 
59  EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( GetParent() );
60 
61  if( frame )
62  frame->GetCanvas()->OnEvent( aEvent );
63  else
64  GetParent()->GetEventHandler()->ProcessEvent( aEvent );
65 }
void OnEvent(wxEvent &aEvent)
Used to forward events to the canvas from popups, etc.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
The base class for create windows for drawing purpose.

References EDA_DRAW_FRAME::GetCanvas(), and EDA_DRAW_PANEL_GAL::OnEvent().

Referenced by STATUS_POPUP().

◆ onExpire()

void STATUS_POPUP::onExpire ( wxTimerEvent &  aEvent)
protected

Expire timer even handler

Definition at line 107 of file status_popup.cpp.

108 {
109  Hide();
110 }

Referenced by STATUS_POPUP().

◆ Popup()

void STATUS_POPUP::Popup ( wxWindow *  aFocus = nullptr)
virtual

Definition at line 68 of file status_popup.cpp.

69 {
70  Show( true );
71  Raise();
72 }

Referenced by PAD_TOOL::EnumeratePads(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), and PopupFor().

◆ PopupFor()

void STATUS_POPUP::PopupFor ( int  aMsecs)
virtual

Definition at line 75 of file status_popup.cpp.

76 {
77  Popup();
78  Expire( aMsecs );
79 }
virtual void Popup(wxWindow *aFocus=nullptr)
void Expire(int aMsecs)
Hides the popup after a specified time.

References Expire(), and Popup().

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Remove(), and SCH_EDIT_FRAME::ShowFindReplaceStatus().

◆ updateSize()

void STATUS_POPUP::updateSize ( )
protected

Definition at line 100 of file status_popup.cpp.

101 {
102  m_topSizer->Fit( m_panel );
103  SetClientSize( m_panel->GetSize() );
104 }
wxPanel * m_panel
Definition: status_popup.h:68
wxBoxSizer * m_topSizer
Definition: status_popup.h:69

References m_panel, and m_topSizer.

Referenced by STATUS_TEXT_POPUP::SetText().

Member Data Documentation

◆ m_expireTimer

wxTimer STATUS_POPUP::m_expireTimer
protected

Definition at line 70 of file status_popup.h.

Referenced by Expire().

◆ m_panel

wxPanel* STATUS_POPUP::m_panel
protected

◆ m_topSizer

wxBoxSizer* STATUS_POPUP::m_topSizer
protected

Definition at line 69 of file status_popup.h.

Referenced by STATUS_POPUP(), STATUS_TEXT_POPUP::STATUS_TEXT_POPUP(), and updateSize().


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