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  INITIAL_ADD = 0x10,
60  ALL = 0xef
61 };
62 
68  VISIBLE = 0x01,
69  HIDDEN = 0x02
70 };
71 
83 class VIEW_ITEM
84 {
85 public:
86  VIEW_ITEM() : m_viewPrivData( nullptr )
87  {
88  }
89 
90  virtual ~VIEW_ITEM();
91 
92  VIEW_ITEM( const VIEW_ITEM& aOther ) = delete;
93  VIEW_ITEM& operator=( const VIEW_ITEM& aOther ) = delete;
94 
100  virtual const BOX2I ViewBBox() const = 0;
101 
115  virtual void ViewDraw( int aLayer, VIEW* aView ) const
116  {}
117 
127  virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0;
128 
134  virtual unsigned int ViewGetLOD( int aLayer, VIEW* aView ) const
135  {
136  // By default always show the item
137  return 0;
138  }
139 
140 public:
141 
143  {
144  return m_viewPrivData;
145  }
146 
147 private:
148  friend class VIEW;
149 
151 };
152 
153 } // namespace KIGFX
154 
155 #endif
Layers have changed.
Definition: view_item.h:59
Item is visible (in general)
Definition: view_item.h:69
VIEW_VISIBILITY_FLAGS
Enum VIEW_VISIBILITY_FLAGS.
Definition: view_item.h:67
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:150
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
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:83
Visibility flag has changed.
Definition: view_item.h:56
Item is being added to the view.
Definition: view_item.h:60
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:142
virtual void ViewDraw(int aLayer, VIEW *aView) const
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
Definition: view_item.h:115
virtual unsigned int ViewGetLOD(int aLayer, VIEW *aView) const
Function ViewGetLOD() Returns the level of detail of the item.
Definition: view_item.h:134
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