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 private:
80 
84  void drawPreviewShape( KIGFX::GAL& aGal ) const override;
85 
87 };
88 
89 } // PREVIEW
90 } // KIGFX
91 
92 #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:56
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...
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
general purpose overlay
void drawPreviewShape(KIGFX::GAL &aGal) const override
Draw the selection rectangle onto the GAL.
wxString GetClass() const override
Get class name.
Class SELECTION_AREA.
Class GAL is the abstract interface for drawing on a 2D-surface.