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  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU 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, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef __STATUS_POPUP_H_
26 #define __STATUS_POPUP_H_
27 
28 
29 #include <math/vector2d.h>
30 #include <wx/popupwin.h>
31 #include <wx/timer.h>
32 #include <wx/panel.h>
33 #include <wx/stattext.h>
34 #include <wx/sizer.h>
35 
36 class EDA_DRAW_FRAME;
37 
45 class STATUS_POPUP: public wxPopupWindow
46 {
47 public:
48  STATUS_POPUP( wxWindow* aParent );
49  virtual ~STATUS_POPUP() {}
50 
51  virtual void Popup( wxWindow* aFocus = nullptr );
52  virtual void PopupFor( int aMsecs );
53  virtual void Move( const wxPoint &aWhere );
54  virtual void Move( const VECTOR2I& aWhere );
55 
61  void Expire( int aMsecs );
62 
63 protected:
64  void updateSize();
65 
66  void onCharHook( wxKeyEvent& aEvent );
67 
69  void onExpire( wxTimerEvent& aEvent );
70 
71  wxPanel* m_panel;
72  wxBoxSizer* m_topSizer;
73  wxTimer m_expireTimer;
74 };
75 
76 
83 {
84 public:
85  STATUS_TEXT_POPUP( wxWindow* aParent );
86  virtual ~STATUS_TEXT_POPUP() {}
87 
92  void SetText( const wxString& aText );
93 
98  void SetTextColor( const wxColour& aColor );
99 
100 protected:
101  wxStaticText* m_statusLine;
102 };
103 
104 #endif /* __STATUS_POPUP_H_*/
void onExpire(wxTimerEvent &aEvent)
Expire timer even handler
void SetTextColor(const wxColour &aColor)
Change text color.
STATUS_POPUP(wxWindow *aParent)
Transient mouse following popup window implementation.
STATUS_TEXT_POPUP.
Definition: status_popup.h:82
VECTOR2 defines 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:71
void onCharHook(wxKeyEvent &aEvent)
wxStaticText * m_statusLine
Definition: status_popup.h:101
wxTimer m_expireTimer
Definition: status_popup.h:73
virtual void Popup(wxWindow *aFocus=nullptr)
virtual void Move(const wxPoint &aWhere)
STATUS_POPUP.
Definition: status_popup.h:45
void Expire(int aMsecs)
Hides the popup after a specified time.
virtual void PopupFor(int aMsecs)
wxBoxSizer * m_topSizer
Definition: status_popup.h:72
virtual ~STATUS_POPUP()
Definition: status_popup.h:49
virtual ~STATUS_TEXT_POPUP()
Definition: status_popup.h:86
STATUS_TEXT_POPUP(wxWindow *aParent)
void SetText(const wxString &aText)
Display a text.