KiCad PCB EDA Suite
view_item.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-2016 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 
30 #ifndef __VIEW_ITEM_H
31 #define __VIEW_ITEM_H
32 
33 #include <vector>
34 #include <bitset>
35 #include <math/box2.h>
36 
37 namespace KIGFX
38 {
39 // Forward declarations
40 class VIEW;
41 class VIEW_ITEM_DATA;
42 
54  NONE = 0x00,
55  APPEARANCE = 0x01,
56  COLOR = 0x02,
57  GEOMETRY = 0x04,
58  LAYERS = 0x08,
59  ALL = 0xff
60 };
61 
67  VISIBLE = 0x01,
68  HIDDEN = 0x02
69 };
70 
82 class VIEW_ITEM
83 {
84 public:
85  VIEW_ITEM() : m_viewPrivData( nullptr )
86  {
87  }
88 
89  virtual ~VIEW_ITEM();
90 
91  VIEW_ITEM( const VIEW_ITEM& aOther ) = delete;
92  VIEW_ITEM& operator=( const VIEW_ITEM& aOther ) = delete;
93 
99  virtual const BOX2I ViewBBox() const = 0;
100 
114  virtual void ViewDraw( int aLayer, VIEW* aView ) const
115  {}
116 
126  virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0;
127 
133  virtual unsigned int ViewGetLOD( int aLayer, VIEW* aView ) const
134  {
135  // By default always show the item
136  return 0;
137  }
138 
139 public:
140 
142  {
143  return m_viewPrivData;
144  }
145 
146 private:
147  friend class VIEW;
148 
150 };
151 
152 } // namespace KIGFX
153 
154 #endif
Item is visible (in general)
Definition: view_item.h:68
VIEW_VISIBILITY_FLAGS
Enum VIEW_VISIBILITY_FLAGS.
Definition: view_item.h:66
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:149
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:56
No updates are required.
Definition: view_item.h:55
Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW...
Definition: view_item.h:82
Visibility flag has changed.
Definition: view_item.h:56
Layers have changed.
Definition: view_item.h:59
virtual ~VIEW_ITEM()
Definition: view_item.cpp:32
virtual void ViewGetLayers(int aLayers[], int &aCount) const =0
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on...
VIEW_ITEM & operator=(const VIEW_ITEM &aOther)=delete
VIEW_UPDATE_FLAGS
Enum VIEW_UPDATE_FLAGS.
Definition: view_item.h:53
VIEW_ITEM_DATA * viewPrivData() const
Definition: view_item.h:141
virtual void ViewDraw(int aLayer, VIEW *aView) const
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
Definition: view_item.h:114
virtual unsigned int ViewGetLOD(int aLayer, VIEW *aView) const
Function ViewGetLOD() Returns the level of detail of the item.
Definition: view_item.h:133
Position or shape has changed.
Definition: view_item.h:58
Class VIEW.
Definition: view.h:58
virtual const BOX2I ViewBBox() const =0
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
Color has changed.
Definition: view_item.h:57