/* 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_doubleLISTUNIT_HPP_
#define _nmm_doubleLISTUNIT_HPP_ _nmm_doubleLISTUNIT_HPP_

#include "nmm/nmm_prefix.hpp"

#include "OSDElement.hpp"

#include "nmm/plugins/video/osd/manager/interfaces/ITextView.hpp"
#include "nmm/plugins/video/osd/manager/interfaces/IPlaneDecorator.hpp"
#include "nmm/plugins/video/osd/manager/interfaces/IBorderDecorator.hpp"
#include "nmm/plugins/video/osd/manager/interfaces/IHeaderDecorator.hpp"
#include "visibility.hpp"
namespace NMM {
  class DLLEXPORT DoubleListUnit : public OSDElement {
  public:
    typedef vector<string> line_t;
    
    DoubleListUnit( IOSDManager* manager, IWidgetFactory* factory, string font );
    ~DoubleListUnit();
    
    void setColors( unsigned int win_active_color, unsigned int win_inactive_color,
                    unsigned int sel_active_color, unsigned int sel_active_color2, unsigned int sel_inactive_color );
    
    void selectWindow( unsigned int mode=0 );
    void deSelectWindow();
    void setHeader( string h );
    
    void setFirstColumnWidth( unsigned int w );
    
    unsigned int addLine( string, line_t, string url="" );
    
    string getLineUrl( unsigned int l );
    string getLineContent( unsigned int l );
    void chooseLineContent( unsigned int a, unsigned int b );
    void chooseLineContent( unsigned int a, string b );
    unsigned int getSelectedLine();
    void changeSelectedLineContent( string b );
    void changeLineContent( unsigned int l, string b );

    void changeSelectedLineSubject(string b);
    void changeLineSubject(unsigned int l, string b);
    string getLineSubject(unsigned int l);

    unsigned int getNumLines();
    void reset();
    void selectLine(const unsigned int& l);
    void selectLine2(const unsigned int& l);
    
    void deleteLine( unsigned int pos );
    void deleteAllLines();
    
    Result selectUp();
    Result selectDown();
    Result selectLeft();
    Result selectRight();
    
    
  protected:
    unsigned int  win_active_color;
    unsigned int  win_inactive_color;
    unsigned int  sel_active_color;
    unsigned int  sel_active_color2;
    unsigned int  sel_inactive_color;
    
    unsigned int  column_width;
    
    void deleteWidgets();
    string font;
    
    ITextView* getSubList( unsigned int line );
    
    ITextView_var	  first;
    IWidgetComposite_var  composite;
    IPlaneDecorator_var   plane;
    IBorderDecorator_var  border;
    IHeaderDecorator_var  header;
  };
  
}

#include "nmm/nmm_suffix.hpp"

#endif //_nmm_doubleLISTUNIT_HPP_
