/* 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_IWidget_HPP
#define NMM_IWidget_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 "IScrollable.hpp"

#include "visibility.hpp"

namespace NMM
{
  /**
   * Widget interface.
   * Interface for controlling widgets in an OSDManager.
   * The widgets are identified by integers. To get an interface, use the IOSDManager interface.
   */

  class DLLEXPORT IWidget : virtual public IScrollable { 
  public:
    IWidget() : NMM::Interface(IWidget::IWidget_type, "NMM") { };

    IWidget(NMM::NMMObject& parent) : NMM::Interface (parent, IWidget::IWidget_type, "NMM") { };

    virtual ~IWidget() {};

    static const char* IWidget_type;

    virtual  string getInterfaceType() const { return IWidget_type; }

    NMM::Interface* copy() const { return new IWidget(*this); }
    static void used(); 
    static const char* selectRight_event;
    static const char* selectLeft_event;
    static const char* selectUp_event;
    static const char* selectDown_event;
    static const char* selectPush_event;
    static const char* getWidgetID_event;
    static const char* setPosition_event;
    static const char* setDimension_event;
    static const char* getPosition_event;
    static const char* getDimension_event;
    /** Selects next button (adds 1 to buttonid). */

    virtual void selectRight()
      throw(const NMM::SerializedException&);
    /** Selects privious button (subs 1 to buttonid). */

    virtual void selectLeft()
      throw(const NMM::SerializedException&);
    /** Selects button (in privoius line, subs step to buttonid). */

    virtual void selectUp()
      throw(const NMM::SerializedException&);
    /** Selects button (in next line, adds step to buttonid). */

    virtual void selectDown()
      throw(const NMM::SerializedException&);
    /** Activates the selected button. */

    virtual void selectPush()
      throw(const NMM::SerializedException&);
    /** Get widget ID. */

    virtual nmm_int32 getWidgetID() const
      throw(const NMM::SerializedException&);
    /**
     * Set x and y position of the widget in the window.
     * @param x x position
     * @param y x position
     */

    virtual void setPosition(const nmm_uint32& x, const nmm_uint32& y)
      throw(const NMM::SerializedException&);
    /**
     * Set width and height of the widget.
     * @param w width
     * @param h height
     */

    virtual void setDimension(const nmm_uint32& w, const nmm_uint32& h)
      throw(const NMM::SerializedException&);
    /**
     * Get x and y position of the widget.
     * @param x x position
     * @param y x position
     */

    virtual void getPosition(nmm_uint32& x, nmm_uint32& y) const
      throw(const NMM::SerializedException&);
    /**
     * Get width and height of the widget.
     * @param w width
     * @param h height
     */

    virtual void getDimension(nmm_uint32& w, nmm_uint32& h) const
      throw(const NMM::SerializedException&);


  };

  typedef auto_ptr<IWidget> IWidget_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
