1 #ifndef FG_PANELNODE_HXX
2 #define FG_PANELNODE_HXX
6 #include <osg/Drawable>
10 #include <simgear/structure/SGSharedPtr.hxx>
11 #include <simgear/props/props.hxx>
16 // PanelNode defines an OSG drawable wrapping the 2D panel drawing code
18 class FGPanelNode : public osg::Drawable
21 FGPanelNode(SGPropertyNode* props);
22 virtual ~FGPanelNode();
25 virtual osg::Object* cloneType() const { return 0; }
26 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return 0; }
28 FGPanel* getPanel() { return _panel; }
30 virtual void drawImplementation(osg::RenderInfo& renderInfo) const
31 { drawImplementation(*renderInfo.getState()); }
33 void drawImplementation(osg::State& state) const;
35 virtual osg::BoundingBox
36 #if OSG_VERSION_LESS_THAN(3,3,2)
44 /** Return true, FGPanelNode does support accept(PrimitiveFunctor&). */
45 virtual bool supports(const osg::PrimitiveFunctor&) const { return true; }
47 virtual void accept(osg::PrimitiveFunctor& functor) const;
49 static osg::Node* load(SGPropertyNode *n);
50 static osg::Node* create2DPanelNode();
52 osg::Matrix transformMatrix() const;
54 void setPanelPath(const std::string& panel);
58 * is visible in 2D mode or not?
60 bool isVisible2d() const;
62 FGPanelNode(); // for 2D panels
67 bool panelMouseClickCommand(const SGPropertyNode * arg);
70 SGSharedPtr<FGPanel> _panel;
71 std::string _panelPath;
73 bool _resizeToViewport;
76 // Panel corner coordinates
77 osg::Vec3 _bottomLeft, _topLeft, _bottomRight;
79 int _xmin, _ymin, _xmax, _ymax;
81 // The matrix that results, which transforms 2D x/y panel
82 // coordinates into 3D coordinates of the panel quadrilateral.
85 SGPropertyChangeListener* _listener;
86 std::auto_ptr<SGPropertyChangeListener> _pathListener;
88 /// should the 2D panel auto-hide when the view orientation changes
89 mutable SGPropertyNode_ptr _autoHide2d;
91 /// should the 2D panel be hidden in views other than the default (view 0)
92 mutable SGPropertyNode_ptr _hideNonDefaultViews;
96 #endif // FG_PANELNODE_HXX