You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.6 KiB

11 years ago
  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. #ifndef __STATUS_POPUP_H_
  25. #define __STATUS_POPUP_H_
  26. #include <common.h>
  27. #include <math/vector2d.h>
  28. #include <wx/popupwin.h>
  29. class EDA_DRAW_FRAME;
  30. /**
  31. * STATUS_POPUP
  32. *
  33. * A tiny, headerless popup window used to display useful status (e.g. line length
  34. * tuning info) next to the mouse cursor.
  35. */
  36. class STATUS_POPUP: public wxPopupWindow
  37. {
  38. public:
  39. STATUS_POPUP( wxWindow* aParent );
  40. virtual ~STATUS_POPUP() {}
  41. virtual void Popup( wxWindow* aFocus = nullptr );
  42. virtual void PopupFor( int aMsecs );
  43. virtual void Move( const wxPoint &aWhere );
  44. virtual void Move( const VECTOR2I& aWhere );
  45. /**
  46. * Hides the popup after a specified time.
  47. *
  48. * @param aMsecs is the time expressed in milliseconds
  49. */
  50. void Expire( int aMsecs );
  51. protected:
  52. void updateSize();
  53. void onCharHook( wxKeyEvent& aEvent );
  54. ///> Expire timer even handler
  55. void onExpire( wxTimerEvent& aEvent );
  56. wxPanel* m_panel;
  57. wxBoxSizer* m_topSizer;
  58. wxTimer m_expireTimer;
  59. };
  60. /**
  61. * STATUS_TEXT_POPUP
  62. *
  63. * Extension of STATUS_POPUP, displaying a single line text.
  64. */
  65. class STATUS_TEXT_POPUP : public STATUS_POPUP
  66. {
  67. public:
  68. STATUS_TEXT_POPUP( wxWindow* aParent );
  69. virtual ~STATUS_TEXT_POPUP() {}
  70. /**
  71. * Display a text.
  72. * @param aText is the text to be displayed.
  73. */
  74. void SetText( const wxString& aText );
  75. /**
  76. * Change text color.
  77. * @param aColor is the new text color.
  78. */
  79. void SetTextColor( const wxColour& aColor );
  80. protected:
  81. wxStaticText* m_statusLine;
  82. };
  83. #endif /* __STATUS_POPUP_H_*/