1 ///@file
2 /// Canvas forward declarations
3 //
4 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Library General Public
8 // License as published by the Free Software Foundation; either
9 // version 2 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Library General Public License for more details.
15 //
16 // You should have received a copy of the GNU Library General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
19 
20 #ifndef SG_CANVAS_FWD_HXX_
21 #define SG_CANVAS_FWD_HXX_
22 
23 #include <simgear/props/propsfwd.hxx>
24 #include <simgear/structure/SGWeakPtr.hxx>
25 
26 #include <osg/ref_ptr>
27 #include <osgText/Font>
28 
29 #include <functional>
30 #include <map>
31 #include <memory>
32 #include <vector>
33 
34 namespace simgear
35 {
36 namespace canvas
37 {
38 
39 #define SG_FWD_DECL(name)\
40   class name;\
41   typedef SGSharedPtr<name> name##Ptr;\
42   typedef SGWeakPtr<name> name##WeakPtr;
43 
44   SG_FWD_DECL(Canvas)
45   SG_FWD_DECL(Element)
46   SG_FWD_DECL(Group)
47   SG_FWD_DECL(Image)
48   SG_FWD_DECL(Map)
49   SG_FWD_DECL(Path)
50   SG_FWD_DECL(Text)
51   SG_FWD_DECL(Window)
52 
53   SG_FWD_DECL(Event)
54   SG_FWD_DECL(CustomEvent)
55   SG_FWD_DECL(DeviceEvent)
56   SG_FWD_DECL(KeyboardEvent)
57   SG_FWD_DECL(MouseEvent)
58 
59 #undef SG_FWD_DECL
60 
61 #define SG_FWD_DECL(name)\
62   class name;\
63   typedef std::shared_ptr<name> name##Ptr;\
64   typedef std::weak_ptr<name> name##WeakPtr;
65 
66   SG_FWD_DECL(Placement)
67   SG_FWD_DECL(SystemAdapter)
68 
69 #undef SG_FWD_DECL
70 
71   class EventManager;
72   class EventVisitor;
73 
74   struct EventTarget;
75   typedef std::deque<EventTarget> EventPropagationPath;
76 
77   typedef std::map<std::string, const SGPropertyNode*> Style;
78   typedef ElementPtr (*ElementFactory)( const CanvasWeakPtr&,
79                                         const SGPropertyNode_ptr&,
80                                         const Style&,
81                                         Element* );
82 
83   typedef osg::ref_ptr<osgText::Font> FontPtr;
84 
85   typedef std::vector<PlacementPtr> Placements;
86   typedef std::function<Placements( SGPropertyNode*,
87                                     CanvasPtr )> PlacementFactory;
88 
89   typedef std::function<void(const EventPtr&)> EventListener;
90 
91 } // namespace canvas
92 } // namespace simgear
93 
94 
95 #endif /* SG_CANVAS_FWD_HXX_ */
96