KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
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
33namespace KIGFX
34{
35class GAL;
36
37namespace PREVIEW
38{
39
47{
48public:
49 static const int SelectionLayer = LAYER_GP_OVERLAY;
50
52
53 const BOX2I ViewBBox() const override;
54
56 void SetOrigin( const VECTOR2I& aOrigin )
57 {
58 m_origin = aOrigin;
59 }
60
64 void SetEnd( const VECTOR2I& aEnd )
65 {
66 m_end = aEnd;
67 }
68
72 wxString GetClass() const override
73 {
74 return wxT( "SELECTION_AREA" );
75 }
76
77 VECTOR2I GetOrigin() const { return m_origin; }
78
79 VECTOR2I GetEnd() const { return m_end; }
80
81 void SetAdditive( bool aAdditive ) { m_additive = aAdditive; }
82 void SetSubtractive( bool aSubtractive ) { m_subtractive = aSubtractive; }
83 void SetExclusiveOr( bool aExclusiveOr ) { m_exclusiveOr = aExclusiveOr; }
84
85 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
86
87private:
88
92
94};
95
96} // PREVIEW
97} // KIGFX
98
99#endif // PREVIEW_ITEMS_SELECTION_AREA_H
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
void SetSubtractive(bool aSubtractive)
void SetAdditive(bool aAdditive)
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
void SetOrigin(const VECTOR2I &aOrigin)
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
void SetExclusiveOr(bool aExclusiveOr)
wxString GetClass() const override
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
@ LAYER_GP_OVERLAY
general purpose overlay
Definition: layer_ids.h:222
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247