]> Shamusworld >> Repos - architektonas/blob - src/base/rs_selection.h
Initial import
[architektonas] / src / base / rs_selection.h
1 /****************************************************************************
2 ** $Id: rs_selection.h 1868 2004-04-05 23:12:06Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the qcadlib Library project.
7 **
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
12 **
13 ** Licensees holding valid qcadlib Professional Edition licenses may use 
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
16 **
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef RS_SELECTION_H
28 #define RS_SELECTION_H
29
30 #include "rs_entitycontainer.h"
31 #include "rs_graphicview.h"
32
33
34
35 /**
36  * API Class for selecting entities. 
37  * There's no interaction handled in this class.
38  * This class is connected to an entity container and
39  * can be connected to a graphic view.
40  *
41  * @author Andrew Mustun
42  */
43 class RS_Selection {
44 public:
45     RS_Selection(RS_EntityContainer& entityContainer,
46                  RS_GraphicView* graphicView=NULL);
47
48     void selectSingle(RS_Entity* e);
49     void selectAll(bool select=true);
50     void deselectAll() {
51         selectAll(false);
52     }
53     void invertSelection();
54     void selectWindow(const Vector& v1, const Vector& v2,
55                       bool select=true, bool cross=false);
56     void deselectWindow(const Vector& v1, const Vector& v2) {
57         selectWindow(v1, v2, false);
58     }
59     void selectIntersected(const Vector& v1, const Vector& v2,
60                       bool select=true);
61     void deselectIntersected(const Vector& v1, const Vector& v2) {
62                 selectIntersected(v1, v2, false);
63         }
64     void selectContour(RS_Entity* e);
65         
66     void selectLayer(RS_Entity* e);
67     void selectLayer(const QString& layerName, bool select=true);
68     void deselectLayer(QString& layerName) {
69                 selectLayer(layerName, false);
70         }
71
72 protected:
73     RS_EntityContainer* container;
74     RS_Graphic* graphic;
75     RS_GraphicView* graphicView;
76 };
77
78 #endif