KiCad PCB EDA Suite
selection_area.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) 2013 CERN
5  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef PREVIEW_ITEMS_SELECTION_AREA_H
28 #define PREVIEW_ITEMS_SELECTION_AREA_H
29 
31 
32 
33 namespace KIGFX
34 {
35 class GAL;
36 
37 namespace PREVIEW
38 {
39 
47 {
48 public:
49  static const int SelectionLayer = LAYER_GP_OVERLAY;
50 
52 
53  const BOX2I ViewBBox() const override;
54 
56  void SetOrigin( VECTOR2I aOrigin )
57  {
58  m_origin = aOrigin;
59  }
60 
65  void SetEnd( VECTOR2I aEnd )
66  {
67  m_end = aEnd;
68  }
69 
74  wxString GetClass() const override
75  {
76  return wxT( "SELECTION_AREA" );
77  }
78 
79  VECTOR2I GetOrigin() const { return m_origin; }
80 
81  VECTOR2I GetEnd() const { return m_end; }
82 
83  void SetAdditive( bool aAdditive ) { m_additive = aAdditive; }
84  void SetSubtractive( bool aSubtractive ) { m_subtractive = aSubtractive; }
85  void SetExclusiveOr( bool aExclusiveOr ) { m_exclusiveOr = aExclusiveOr; }
86 
87  void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
88 
89 private:
90 
91  bool m_additive;
94 
96 };
97 
98 } // PREVIEW
99 } // KIGFX
100 
101 #endif // PREVIEW_ITEMS_SELECTION_AREA_H
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
void SetOrigin(VECTOR2I aOrigin)
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
void SetExclusiveOr(bool aExclusiveOr)
void SetAdditive(bool aAdditive)
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
void SetSubtractive(bool aSubtractive)
wxString GetClass() const override
Get class name.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67