/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM 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 GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef NMM_IWidgetFactory_HPP
#define NMM_IWidgetFactory_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/Interface.hpp"
#include "nmm/comm/messaging/Event.hpp"
#include "nmm/comm/messaging/IllegalStateException.hpp"
#include <memory>

#include "IWidget.hpp"
#include "IWidgetComposite.hpp"
#include "IProgressBar.hpp"
#include "ITextView.hpp"
#include "ITimeView.hpp"
#include "IImageView.hpp"
#include "IRadioButtons.hpp"
#include "IButtons.hpp"
#include "IBorderDecorator.hpp"
#include "IHeaderDecorator.hpp"
#include "IPlaneDecorator.hpp"
#include "IScrollDecorator.hpp"

#include "visibility.hpp"

namespace NMM
{
  /**
   * Widget factory.
   * This interface, which is implemented by the OSD manager, is used
   * for creating widget objects. I wrote a seperate interface for this for the
   * following reasons:
   * - It has a lot of methods only for creating widgets that would inflate IOSDManager
   * - It depends on all the widget interfaces. I don't want IOSDManager to include them all
   */

  class DLLEXPORT IWidgetFactory : virtual public NMM::Interface { 
  public:
    IWidgetFactory() : NMM::Interface(IWidgetFactory::IWidgetFactory_type, "NMM") { };

    IWidgetFactory(NMM::NMMObject& parent) : NMM::Interface (parent, IWidgetFactory::IWidgetFactory_type, "NMM") { };

    virtual ~IWidgetFactory() {};

    static const char* IWidgetFactory_type;

    virtual  string getInterfaceType() const { return IWidgetFactory_type; }

    NMM::Interface* copy() const { return new IWidgetFactory(*this); }
    static void used(); 
    static const char* createWidgetComposite_event;
    static const char* createProgressBar_event;
    static const char* createTextView_event;
    static const char* createTimeView_event;
    static const char* createImageView_event;
    static const char* createRadioButtons_event;
    static const char* createButtons_event;
    static const char* createBorderDecorator_event;
    static const char* createHeaderDecorator_event;
    static const char* createPlaneDecorator_event;
    static const char* createScrollDecorator_event;
    /**
     * Create a widget composite.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual IWidgetComposite* createWidgetComposite()
      throw(const NMM::SerializedException&);
    /**
     * Create a progress bar.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual IProgressBar* createProgressBar()
      throw(const NMM::SerializedException&);
    /**
     * Create a text view.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual ITextView* createTextView()
      throw(const NMM::SerializedException&);
    /**
     * Create a time view.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual ITimeView* createTimeView()
      throw(const NMM::SerializedException&);
    /**
     * Create an image view.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual IImageView* createImageView()
      throw(const NMM::SerializedException&);
    /**
     * Create radio buttons.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual IRadioButtons* createRadioButtons()
      throw(const NMM::SerializedException&);
    /**
     * Create buttons.
     * Creates a new widget and returns an interface for it.
     * @return an interface for this widget
     */

    virtual IButtons* createButtons()
      throw(const NMM::SerializedException&);
    /**
     * Create border decorator.
     * Creates a new widget and returns an interface for it.
     * @param internal the internal widget of the decorator
     * @return an interface for this widget
     */

    virtual IBorderDecorator* createBorderDecorator(const IWidget& internal)
      throw(const NMM::SerializedException&);
    /**
     * Create border decorator.
     * Creates a new widget and returns an interface for it.
     * @param internal the internal widget of the decorator
     * @return an interface for this widget
     */

    virtual IHeaderDecorator* createHeaderDecorator(const IWidget& internal)
      throw(const NMM::SerializedException&);
    /**
     * Create plane decorator.
     * Creates a new widget and returns an interface for it.
     * @param internal the internal widget of the decorator
     * @return an interface for this widget
     */

    virtual IPlaneDecorator* createPlaneDecorator(const IWidget& internal)
      throw(const NMM::SerializedException&);
    /**
     * Create scroll decorator.
     * Creates a new widget and returns an interface for it.
     * @param internal the internal widget of the decorator
     * @return an interface for this widget
     */

    virtual IScrollDecorator* createScrollDecorator(const IWidget& internal)
      throw(const NMM::SerializedException&);


  };

  typedef auto_ptr<IWidgetFactory> IWidgetFactory_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
