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, see <https://www.gnu.org/licenses/>.
21 *
22 */
23
24#pragma once
25
26#include <gal/gal.h>
27#include <view/view_item.h>
28#include <deque>
29
30namespace KIGFX
31{
39{
40public:
41 VIEW_GROUP( VIEW* aView = nullptr );
42 virtual ~VIEW_GROUP();
43
44 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
45 // will only land us in trouble.
46 VIEW_GROUP( const VIEW_GROUP& ) = delete;
47 VIEW_GROUP& operator=( const VIEW_GROUP& ) = delete;
48
49 wxString GetClass() const override;
50
54 virtual unsigned int GetSize() const;
55
59 virtual void Add( VIEW_ITEM* aItem );
60
64 virtual void Remove( VIEW_ITEM* aItem );
65
69 virtual void Clear();
70
71 virtual VIEW_ITEM* GetItem( unsigned int aIdx ) const;
72
76 virtual const BOX2I ViewBBox() const override;
77
84 virtual void ViewDraw( int aLayer, VIEW* aView ) const override;
85
87 std::vector<int> ViewGetLayers() const override;
88
92 inline virtual void SetLayer( int aLayer )
93 {
94 m_layer = aLayer;
95 }
96
100 void FreeItems();
101
102protected:
103 virtual const std::vector<VIEW_ITEM*> updateDrawList() const;
104
105protected:
107 std::vector<VIEW_ITEM*> m_groupItems; // No ownership.
108};
109
110} // namespace KIGFX
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
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:107
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:92
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:84
friend class VIEW
Definition view_item.h:201
#define GAL_API
Definition gal.h:27
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29