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  * @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 PREVIEW_ITEMS_SELECTION_AREA_H
26 #define PREVIEW_ITEMS_SELECTION_AREA_H
27 
29 
30 
31 namespace KIGFX
32 {
33 class GAL;
34 
35 namespace PREVIEW
36 {
37 
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  bool IsAdditive() const { return m_additive; }
84  bool IsSubtractive() const { return m_subtractive; }
85 
86  void SetAdditive( bool aAdditive );
87  void SetSubtractive( bool aSubtractive );
88 
89  void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
90 
91 private:
92 
93  bool m_additive;
95 
97 };
98 
99 } // PREVIEW
100 } // KIGFX
101 
102 #endif // PREVIEW_ITEMS_SELECTION_AREA_H
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
void SetOrigin(VECTOR2I aOrigin)
Set the origin of the rectange (the fixed corner)
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const overridefinal
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
general purpose overlay
wxString GetClass() const override
Get class name.
void SetSubtractive(bool aSubtractive)
Class SELECTION_AREA.
Class VIEW.
Definition: view.h:58
void SetAdditive(bool aAdditive)