~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to librecad/src/lib/modification/rs_selection.h

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** This file is part of the LibreCAD project, a 2D CAD program
 
4
**
 
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
 
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
 
7
**
 
8
**
 
9
** This file may be distributed and/or modified under the terms of the
 
10
** GNU General Public License version 2 as published by the Free Software 
 
11
** Foundation and appearing in the file gpl-2.0.txt included in the
 
12
** packaging of this file.
 
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, write to the Free Software
 
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
22
**
 
23
** This copyright notice MUST APPEAR in all copies of the script!  
 
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 RS_Vector& v1, const RS_Vector& v2,
 
55
                      bool select=true, bool cross=false);
 
56
    void deselectWindow(const RS_Vector& v1, const RS_Vector& v2) {
 
57
        selectWindow(v1, v2, false);
 
58
    }
 
59
    void selectIntersected(const RS_Vector& v1, const RS_Vector& v2,
 
60
                      bool select=true);
 
61
    void deselectIntersected(const RS_Vector& v1, const RS_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