KiCad PCB EDA Suite
Loading...
Searching...
No Matches
view_group.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 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 *
26 */
27
28#pragma once
29
30#include <gal/gal.h>
31#include <view/view_item.h>
32#include <deque>
33
34namespace KIGFX
35{
43{
44public:
45 VIEW_GROUP( VIEW* aView = nullptr );
46 virtual ~VIEW_GROUP();
47
48 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
49 // will only land us in trouble.
50 VIEW_GROUP( const VIEW_GROUP& ) = delete;
51 VIEW_GROUP& operator=( const VIEW_GROUP& ) = delete;
52
53 wxString GetClass() const override;
54
58 virtual unsigned int GetSize() const;
59
63 virtual void Add( VIEW_ITEM* aItem );
64
68 virtual void Remove( VIEW_ITEM* aItem );
69
73 virtual void Clear();
74
75 virtual VIEW_ITEM* GetItem( unsigned int aIdx ) const;
76
80 virtual const BOX2I ViewBBox() const override;
81
88 virtual void ViewDraw( int aLayer, VIEW* aView ) const override;
89
91 std::vector<int> ViewGetLayers() const override;
92
96 inline virtual void SetLayer( int aLayer )
97 {
98 m_layer = aLayer;
99 }
100
104 void FreeItems();
105
106protected:
107 virtual const std::vector<VIEW_ITEM*> updateDrawList() const;
108
109protected:
111 std::vector<VIEW_ITEM*> m_groupItems; // No ownership.
112};
113
114} // namespace KIGFX
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
virtual void Clear()
Remove all the stored items from the group.
virtual unsigned int GetSize() const
Return the number of stored items.
virtual void ViewDraw(int aLayer, VIEW *aView) const override
Draw all the stored items in the group on the given layer.
virtual VIEW_ITEM * GetItem(unsigned int aIdx) const
VIEW_GROUP & operator=(const VIEW_GROUP &)=delete
VIEW_GROUP(const VIEW_GROUP &)=delete
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
std::vector< VIEW_ITEM * > m_groupItems
Definition view_group.h:111
wxString GetClass() const override
Return the class name.
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
VIEW_GROUP(VIEW *aView=nullptr)
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
Definition view_group.h:96
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
virtual const BOX2I ViewBBox() const override
Return the bounding box for all stored items covering all its layers.
VIEW_ITEM(bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition view_item.h:88
friend class VIEW
Definition view_item.h:205
#define GAL_API
Definition gal.h:28
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:33