kicad/include/preview_items/bright_box.h

101 lines
2.4 KiB
C
Raw Normal View History

2013-09-18 17:51:57 +00:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __BRIGHT_BOX_H
#define __BRIGHT_BOX_H
#include <math/box2.h>
#include <view/view.h>
#include <base_struct.h>
2013-09-18 17:51:57 +00:00
#include <layers_id_colors_and_visibility.h>
#include <gal/color4d.h>
/**
* BRIGHT_BOX
2013-09-18 17:51:57 +00:00
*
* Draws a decoration to indicate a brightened item.
*/
class BRIGHT_BOX : public EDA_ITEM
{
public:
2016-12-05 22:54:41 +00:00
BRIGHT_BOX();
2016-12-09 11:04:32 +00:00
~BRIGHT_BOX() {}
2013-09-18 17:51:57 +00:00
2016-09-25 17:06:49 +00:00
virtual const BOX2I ViewBBox() const override
2014-02-25 17:08:33 +00:00
{
2016-12-09 11:04:32 +00:00
if( !m_item )
{
BOX2I bb;
bb.SetMaximum();
return bb;
}
2014-02-25 17:08:33 +00:00
return m_item->ViewBBox();
}
2013-09-18 17:51:57 +00:00
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
2014-02-25 17:08:33 +00:00
2016-09-25 17:06:49 +00:00
void ViewGetLayers( int aLayers[], int& aCount ) const override
2014-02-25 17:08:33 +00:00
{
aLayers[0] = LAYER_GP_OVERLAY ;
2014-02-25 17:08:33 +00:00
aCount = 1;
}
2013-09-18 17:51:57 +00:00
#if defined(DEBUG)
2016-09-25 17:06:49 +00:00
void Show( int x, std::ostream& st ) const override
2013-09-18 17:51:57 +00:00
{
}
#endif
/** Get class name
* @return string "BRIGHT_BOX"
*/
2016-09-25 17:06:49 +00:00
virtual wxString GetClass() const override
{
return wxT( "BRIGHT_BOX" );
}
2013-09-18 17:51:57 +00:00
void SetItem( EDA_ITEM* aItem );
void SetLineWidth( double aWidth )
{
m_lineWidth = aWidth;
}
void SetColor( KIGFX::COLOR4D aColor )
{
m_color = aColor;
}
protected:
2014-02-25 17:08:33 +00:00
static const KIGFX::COLOR4D BOX_COLOR;
2014-04-02 13:38:59 +00:00
static const double LINE_WIDTH;
2013-09-18 17:51:57 +00:00
EDA_ITEM* m_item;
double m_lineWidth;
KIGFX::COLOR4D m_color;
2013-09-18 17:51:57 +00:00
};
#endif