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.

100 lines
2.4 KiB

9 years ago
9 years ago
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013 CERN
  5. * @author Maciej Suminski <maciej.suminski@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 __BRIGHT_BOX_H
  25. #define __BRIGHT_BOX_H
  26. #include <math/box2.h>
  27. #include <view/view.h>
  28. #include <base_struct.h>
  29. #include <layers_id_colors_and_visibility.h>
  30. #include <gal/color4d.h>
  31. /**
  32. * BRIGHT_BOX
  33. *
  34. * Draws a decoration to indicate a brightened item.
  35. */
  36. class BRIGHT_BOX : public EDA_ITEM
  37. {
  38. public:
  39. BRIGHT_BOX();
  40. ~BRIGHT_BOX() {}
  41. virtual const BOX2I ViewBBox() const override
  42. {
  43. if( !m_item )
  44. {
  45. BOX2I bb;
  46. bb.SetMaximum();
  47. return bb;
  48. }
  49. return m_item->ViewBBox();
  50. }
  51. void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
  52. void ViewGetLayers( int aLayers[], int& aCount ) const override
  53. {
  54. aLayers[0] = LAYER_GP_OVERLAY ;
  55. aCount = 1;
  56. }
  57. #if defined(DEBUG)
  58. void Show( int x, std::ostream& st ) const override
  59. {
  60. }
  61. #endif
  62. /** Get class name
  63. * @return string "BRIGHT_BOX"
  64. */
  65. virtual wxString GetClass() const override
  66. {
  67. return wxT( "BRIGHT_BOX" );
  68. }
  69. void SetItem( EDA_ITEM* aItem );
  70. void SetLineWidth( double aWidth )
  71. {
  72. m_lineWidth = aWidth;
  73. }
  74. void SetColor( KIGFX::COLOR4D aColor )
  75. {
  76. m_color = aColor;
  77. }
  78. protected:
  79. static const KIGFX::COLOR4D BOX_COLOR;
  80. static const double LINE_WIDTH;
  81. EDA_ITEM* m_item;
  82. double m_lineWidth;
  83. KIGFX::COLOR4D m_color;
  84. };
  85. #endif