]> git.mxchange.org Git - flightgear.git/blob - src/Canvas/elements/group.cxx
Fix Win32 build, hopefully.
[flightgear.git] / src / Canvas / elements / group.cxx
1 // A group of 2D canvas elements
2 //
3 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19 #include "group.hxx"
20 #include "text.hxx"
21
22 namespace canvas
23 {
24
25   //----------------------------------------------------------------------------
26   Group::Group(SGPropertyNode* node):
27     Element(node)
28   {
29
30   }
31
32   //----------------------------------------------------------------------------
33   Group::~Group()
34   {
35
36   }
37
38   //----------------------------------------------------------------------------
39   void Group::update(double dt)
40   {
41     for( size_t i = 0; i < _children.size(); ++i )
42       _children[i]->update(dt);
43
44     Element::update(dt);
45   }
46
47   //----------------------------------------------------------------------------
48   void Group::childAdded(SGPropertyNode* child)
49   {
50     if( child->getNameString() == "text" )
51     {
52       _children.push_back( boost::shared_ptr<Element>(new Text(child)) );
53       _transform->addChild( _children.back()->getMatrixTransform() );
54     }
55     else
56       std::cout << "New unknown child: " << child->getDisplayName() << std::endl;
57   }
58
59   //----------------------------------------------------------------------------
60   void Group::childRemoved(SGPropertyNode* child)
61   {
62
63   }
64
65 } // namespace canvas