]> Shamusworld >> Repos - architektonas/blob - src/base/rs_layerlist.h
0e2b8fdfa62d91372ea973277011bb13750cb203
[architektonas] / src / base / rs_layerlist.h
1 /****************************************************************************
2 ** $Id: rs_layerlist.h 1869 2004-04-09 19:56:42Z 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_LAYERLIST_H
28 #define RS_LAYERLIST_H
29
30 #include <iostream>
31 #include <QtCore>
32
33 class RS_Layer;
34 class RS_LayerListListener;
35
36 /**
37  * A list of layers.
38  *
39  * @author Andrew Mustun
40  */
41 class RS_LayerList
42 {
43         public:
44                 RS_LayerList();
45                 virtual ~RS_LayerList();
46
47                 void clear();
48                 uint count() const;
49                 RS_Layer * at(uint i);
50                 void activate(const QString & name, bool notify = false);
51                 void activate(RS_Layer * layer, bool notify = false);
52                 RS_Layer * getActive();
53                 virtual void add(RS_Layer * layer);
54                 virtual void remove(RS_Layer * layer);
55                 virtual void edit(RS_Layer * layer, const RS_Layer & source);
56                 RS_Layer * find(const QString & name);
57                 int getIndex(const QString & name);
58                 int getIndex(RS_Layer * layer);
59                 void toggle(const QString & name);
60                 void toggle(RS_Layer * layer);
61                 void toggleLock(RS_Layer * layer);
62                 void freezeAll(bool freeze);
63                 void addListener(RS_LayerListListener * listener);
64                 void removeListener(RS_LayerListListener * listener);
65                 void setModified(bool m);
66                 virtual bool isModified() const;
67
68                 friend std::ostream & operator<<(std::ostream & os, RS_LayerList & l);
69
70         private:
71                 //! layers in the graphic
72 //              Q3PtrList<RS_Layer> layers;
73                 QList<RS_Layer *> layers;
74                 //! List of registered LayerListListeners
75 //              Q3PtrList<RS_LayerListListener> layerListListeners;
76                 QList<RS_LayerListListener *> layerListListeners;
77                 //! Currently active layer
78                 RS_Layer * activeLayer;
79                 /** Flag set if the layer list was modified and not yet saved. */
80                 bool modified;
81 };
82
83 #endif