/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2013 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGPRESENTATION_ACTION
#define OSGPRESENTATION_ACTION 1

#include <osgPresentation/Export>
#include <osg/NodeVisitor>

namespace osgPresentation
{

// forward declare osgPresention nodes
class Group;

class Element;
class Text;
class Volume;
class Model;
class Image;
class Movie;

class Section;
class Layer;
class Slide;
class Presentation;

/** Action base class that is a NodeVistor that addes osgPresentation node support.*/
class OSGPRESENTATION_EXPORT Action : public osg::NodeVisitor
{
    public:
      Action(osg::NodeVisitor::TraversalMode traversalMode=osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN):
        osg::NodeVisitor(traversalMode) {}

      virtual void apply(osgPresentation::Group& group);

      virtual void apply(osgPresentation::Element& element);
      virtual void apply(osgPresentation::Text& text);
      virtual void apply(osgPresentation::Volume& volume);
      virtual void apply(osgPresentation::Model& model);
      virtual void apply(osgPresentation::Image& image);
      virtual void apply(osgPresentation::Movie& movie);

      virtual void apply(osgPresentation::Section& section);
      virtual void apply(osgPresentation::Layer& layer);
      virtual void apply(osgPresentation::Slide& slide);
      virtual void apply(osgPresentation::Presentation& presentation);
};


struct OSGPRESENTATION_EXPORT LoadAction : public Action
{
    void apply(osgPresentation::Element& element);
};

struct OSGPRESENTATION_EXPORT UnloadAction : public Action
{
    void apply(osgPresentation::Element& element);
};

struct OSGPRESENTATION_EXPORT ResetAction : public Action
{
    void apply(osgPresentation::Element& element);
};

struct OSGPRESENTATION_EXPORT PauseAction : public Action
{
    void apply(osgPresentation::Element& element);
};

struct OSGPRESENTATION_EXPORT PlayAction : public Action
{
    void apply(osgPresentation::Element& element);
};

struct OSGPRESENTATION_EXPORT PrintProperties : public osgPresentation::Action
{
    PrintProperties(std::ostream& output) : osgPresentation::Action(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _output(output) {}

    void apply(osgPresentation::Group& group);

    std::ostream& _output;
};

struct OSGPRESENTATION_EXPORT PrintSupportedProperties : public osgPresentation::Action
{
    PrintSupportedProperties(std::ostream& output) : osgPresentation::Action(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _output(output) {}

    void apply(osgPresentation::Group& group);

    std::ostream& _output;
};


}

#endif
