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
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:43
VIEW_GROUP & operator=(const VIEW_GROUP &)=delete
VIEW_GROUP(const VIEW_GROUP &)=delete
std::vector< VIEW_ITEM * > m_groupItems
Definition: view_group.h:111
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
Definition: view_group.h:96
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:86
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
#define GAL_API
Definition: gal.h:28
The Cairo implementation of the graphics abstraction layer.
Definition: eda_group.h:33