/* 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.
 *
 */

#include "IWidget.idl"

module NMM {
  
  /**
   * Text view widget.
   * Interface for a text view widget.
   */
  interface ITextView : IWidget {
    
    /**
     * Set font.
     * Set the font all text on this widget is drawn in.
     * @param value font name
     */
    void setFont(in string value);
    
    /**
     * Selects the given line.
     * @param line line that should be selected (0 if no line should be selected)
     * @return linenumber that was selected
     */
    nmm_uint32 selectLine( in nmm_uint32 line );
    
    /**
     * Selects the given line (second selection).
     * @param line line that should be selected (0 if no line should be selected)
     * @return linenumber that was selected
     */
    nmm_uint32 selectLine2( in nmm_uint32 line );
    
    /**
     * Deselect line ( set selected_line = 0).
     */
    void deSelectLine();
    
    /**
     * Deselect second line ( set selected_line2 = 0).
     */
    void deSelectLine2();
    
    /**
     * Get selected line.
     * @return selected line (0, if no line is selected)
     */
    nmm_uint32 getSelectedLine() const;
    
    /**
     * Get selected line (second selection).
     * @return second selected line (0, if no line is selected)
     */
    nmm_uint32 getSelectedLine2() const;
    
    /**
     * Get line content.
     * @param line line number
     * @returns the text displayed in that line
     */
    string getLineContent( in nmm_uint32 line ) const;
    
    /**
     * changes the content of a line
     * @param text new content of the line
     * @param line to be changed
     */
    void changeLineContent(in nmm_uint32 line, in string text);

    /**
     * Get line url.
     * @param line line number
     * @returns the url in that line, if it contains one.
     */
    string getLineURL( in nmm_uint32 line ) const;
    
    /**
     * Get line widget.
     * @param line line number
     * @returns the widget in that line, if it contains one.
     */
    IWidget* getLineWidget( in nmm_uint32 line ) const;
    
    /**
     * Set autofocus for selectLine.
     * @param value autofocus mode. on=true or off=false.
     */
    void setAutoFocus( in nmm_bool value );
    
    /**
     * Sets selection color.
     * @param color rgba color
     */
    void setSelectionColor( in nmm_uint32 color );

    /**
     * Sets selection color for second highlight.
     * @param color rgba color
     */
    void setSelectionColor2( in nmm_uint32 color );
    
    /**
     * Sets standard selection color, deselects line.
     */
    void reset();
    
    /** Sets maximum number of visible lines. */
    void setMaxLines( in nmm_uint32 value );
    
    /** Gets maximum number of visible lines. */
    nmm_uint32 getMaxLines() const;
    
    /**
     * Sets first visible line.
     * @return first visible line
     */
    nmm_uint32 setStartLine( in nmm_uint32 start );
    
    /** Get first visible line. */
    nmm_uint32 getStartLine() const;
    
    /** Get number of lines. */
    nmm_uint32 getNumLines() const;
    
    /**
     * Focus selection.
     * Adjusts first visible line so that the selected line is visible
     */
    void focusSelection();
    
    /**
     * Insert a line with content.
     * @param pos position where the new line should be inserted.
     * @param text line text
     * @param url url associated with this line
     */
    void insertLine( in nmm_int32 pos, in string text, in string url="" );
    
    /**
     * Adds a line with content.
     * @param pos position where the new line should be inserted.
     * @param text line text
     * @param url url associated with this line
     * @return line number of the new line
     */
    nmm_int32 addLine( in string text, in string url="" );
    
    
    /**
     * Set line widget
     * Add a widget to a line (such as another text view).
     */
    void addLineWidget( in nmm_uint32 line, in IWidget widget );
    
    
    /** Delete the given line. */
    void deleteLine( in nmm_uint32 line );
    
    /** Delete all lines. */
    void deleteAllLines();

    /** mark line (using selection_color_2)
     *@param line line to mark
     */
    void markLine(in nmm_uint32 line);

    /** unmark line
     *@param line line to unmark
     */
    void unmarkLine(in nmm_uint32 line);
    
    /** get marked line-numbers
     *@return list of line-numbers
     */
    list<nmm_uint32> getMarkedLines();

  };
}
