1 #ifndef FG_PANELNODE_HXX
2 #define FG_PANELNODE_HXX
6 #include <osg/Drawable>
9 #include <simgear/structure/SGSharedPtr.hxx>
10 #include <simgear/props/props.hxx>
15 // PanelNode defines an OSG drawable wrapping the 2D panel drawing code
17 class FGPanelNode : public osg::Drawable
20 FGPanelNode(SGPropertyNode* props);
21 virtual ~FGPanelNode();
24 virtual osg::Object* cloneType() const { return 0; }
25 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return 0; }
27 FGPanel* getPanel() { return _panel; }
29 virtual void drawImplementation(osg::RenderInfo& renderInfo) const
30 { drawImplementation(*renderInfo.getState()); }
32 void drawImplementation(osg::State& state) const;
33 virtual osg::BoundingBox computeBound() const;
35 /** Return true, FGPanelNode does support accept(PrimitiveFunctor&). */
36 virtual bool supports(const osg::PrimitiveFunctor&) const { return true; }
38 virtual void accept(osg::PrimitiveFunctor& functor) const;
40 static osg::Node* load(SGPropertyNode *n);
41 static osg::Node* create2DPanelNode();
43 osg::Matrix transformMatrix() const;
45 void setPanelPath(const std::string& panel);
49 * is visible in 2D mode or not?
51 bool isVisible2d() const;
53 FGPanelNode(); // for 2D panels
58 bool panelMouseClickCommand(const SGPropertyNode * arg);
61 SGSharedPtr<FGPanel> _panel;
62 std::string _panelPath;
64 bool _resizeToViewport;
67 // Panel corner coordinates
68 osg::Vec3 _bottomLeft, _topLeft, _bottomRight;
70 int _xmin, _ymin, _xmax, _ymax;
72 // The matrix that results, which transforms 2D x/y panel
73 // coordinates into 3D coordinates of the panel quadrilateral.
76 SGPropertyChangeListener* _listener;
77 std::auto_ptr<SGPropertyChangeListener> _pathListener;
79 /// should the 2D panel auto-hide when the view orientation changes
80 mutable SGPropertyNode_ptr _autoHide2d;
82 /// should the 2D panel be hidden in views other than the default (view 0)
83 mutable SGPropertyNode_ptr _hideNonDefaultViews;
87 #endif // FG_PANELNODE_HXX