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  REPAINT = 0x20,
61  ALL = 0xef
62 };
63 
69  VISIBLE = 0x01,
70  HIDDEN = 0x02
71 };
72 
84 class VIEW_ITEM
85 {
86 public:
87  VIEW_ITEM() : m_viewPrivData( nullptr )
88  {
89  }
90 
91  virtual ~VIEW_ITEM();
92 
93  VIEW_ITEM( const VIEW_ITEM& aOther ) = delete;
94  VIEW_ITEM& operator=( const VIEW_ITEM& aOther ) = delete;
95 
101  virtual const BOX2I ViewBBox() const = 0;
102 
116  virtual void ViewDraw( int aLayer, VIEW* aView ) const
117  {}
118 
128  virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0;
129 
140  virtual unsigned int ViewGetLOD( int aLayer, VIEW* aView ) const
141  {
142  // By default always show the item
143  return 0;
144  }
145 
146 public:
147 
149  {
150  return m_viewPrivData;
151  }
152 
153 private:
154  friend class VIEW;
155 
157 };
158 
159 } // namespace KIGFX
160 
161 #endif
Layers have changed.
Definition: view_item.h:59
Item is visible (in general)
Definition: view_item.h:70
VIEW_VISIBILITY_FLAGS
Enum VIEW_VISIBILITY_FLAGS.
Definition: view_item.h:68
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156
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:84
Visibility flag has changed.
Definition: view_item.h:56
Item needs to be redrawn.
Definition: view_item.h:61
virtual ~VIEW_ITEM()
Definition: view_item.cpp:32
Item is being added to the view.
Definition: view_item.h:60
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:148
virtual void ViewDraw(int aLayer, VIEW *aView) const
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
Definition: view_item.h:116
virtual unsigned int ViewGetLOD(int aLayer, VIEW *aView) const
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
Definition: view_item.h:140
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