/* 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_WGBUTTONS_HPP_
#define _NMM_WGBUTTONS_HPP_ _NMM_WGBUTTONS_HPP_

#include "nmm/nmm_prefix.hpp"

#include "ImageView.hpp"

#include "interfaces/IButtonsImpl.hpp"

namespace NMM {
  
  /**
   * Buttons widget.
   */
  class Buttons : virtual public ImageView,
                  virtual public IButtonsImpl {
    
    typedef enum { INACTIVE=0, ACTIVE, SELECTED } buttonstate_t;
    typedef struct {
      string        label;     // additional description of the button
      string        id[3];	 // Bitmap identifiers fo INACTIVE, ACTIVE and SELECTED state
      int           x;	 // x position of upper left corner
      int           y;	 // y position of upper left corner
      buttonstate_t state;	 // actual state (INACTIVE or ACTIVE)
    } button_t;

    typedef map<int, button_t> buttonlist_t;

  protected:
    buttonlist_t           buttonlist;	         // stores all Buttons
    int                    selected_button;	 // id of selected button
    unsigned int	   step;		 // number of buttons to get into next line

  public:
    Buttons();
    virtual ~Buttons();
    
    /** IButtons interface. */
    virtual void selectRight();
    virtual void selectLeft();
    virtual void selectUp();
    virtual void selectDown();
    virtual void selectPush();
    virtual void addButton(const nmm_int32& buttonid, const string& label, const nmm_int32& x, const nmm_int32& y,
                           const string& inactive_id, const string& active_id, const string& select_id);
    virtual string getButtonLabel(const nmm_int32& button_id);
    virtual string getSelectedButtonLabel();
    virtual nmm_bool getButtonState(const nmm_int32& button_id);
    virtual void deleteButton(const nmm_int32& button_id);
    virtual void deleteAllButtons();
    virtual nmm_int32 selectButton(const nmm_int32& buttonid);
    virtual void setStep(const nmm_uint32& value);
    virtual void deselectButton();
    virtual void activateButton(const nmm_int32& button_id);
    virtual void deactivateButton(const nmm_int32& button_id);
    virtual void deactivateAllButtons();
    
    void draw( workspace_t* ws );
  }; // Buttons
}

#include "nmm/nmm_suffix.hpp"

#endif //_NMM_WGBUTTONS_HPP_
