KiCad PCB EDA Suite
status_popup.h
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) 2014-2015 CERN
5  * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #ifndef __STATUS_POPUP_H_
27 #define __STATUS_POPUP_H_
28 
29 
30 #include <math/vector2d.h>
31 #include <wx/popupwin.h>
32 #include <wx/timer.h>
33 #include <wx/panel.h>
34 #include <wx/stattext.h>
35 #include <wx/sizer.h>
36 
37 class EDA_DRAW_FRAME;
38 
44 class STATUS_POPUP: public wxPopupWindow
45 {
46 public:
47  STATUS_POPUP( wxWindow* aParent );
48  virtual ~STATUS_POPUP() {}
49 
50  virtual void Popup( wxWindow* aFocus = nullptr );
51  virtual void PopupFor( int aMsecs );
52  virtual void Move( const wxPoint& aWhere );
53  virtual void Move( const VECTOR2I& aWhere );
54 
60  void Expire( int aMsecs );
61 
62 protected:
63  void updateSize();
64 
65  void onCharHook( wxKeyEvent& aEvent );
66 
68  void onExpire( wxTimerEvent& aEvent );
69 
70  wxPanel* m_panel;
71  wxBoxSizer* m_topSizer;
72  wxTimer m_expireTimer;
73 };
74 
75 
80 {
81 public:
82  STATUS_TEXT_POPUP( wxWindow* aParent );
83  virtual ~STATUS_TEXT_POPUP() {}
84 
90  void SetText( const wxString& aText );
91 
97  void SetTextColor( const wxColour& aColor );
98 
99 protected:
100  wxStaticText* m_statusLine;
101 };
102 
103 #endif /* __STATUS_POPUP_H_*/
void onExpire(wxTimerEvent &aEvent)
void SetTextColor(const wxColour &aColor)
Change text color.
STATUS_POPUP(wxWindow *aParent)
Transient mouse following popup window implementation.
Extension of STATUS_POPUP for displaying a single line text.
Definition: status_popup.h:79
Define a general 2D-vector/point.
Definition: vector2d.h:61
The base class for create windows for drawing purpose.
wxPanel * m_panel
Definition: status_popup.h:70
void onCharHook(wxKeyEvent &aEvent)
Expire timer even handler.
wxStaticText * m_statusLine
Definition: status_popup.h:100
wxTimer m_expireTimer
Definition: status_popup.h:72
virtual void Popup(wxWindow *aFocus=nullptr)
virtual void Move(const wxPoint &aWhere)
A tiny, headerless popup window used to display useful status (e.g.
Definition: status_popup.h:44
void Expire(int aMsecs)
Hide the popup after a specified time.
virtual void PopupFor(int aMsecs)
wxBoxSizer * m_topSizer
Definition: status_popup.h:71
virtual ~STATUS_POPUP()
Definition: status_popup.h:48
virtual ~STATUS_TEXT_POPUP()
Definition: status_popup.h:83
STATUS_TEXT_POPUP(wxWindow *aParent)
void SetText(const wxString &aText)
Display a text.