/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the Framework Output
 *
 * The iWear Framework 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 as in version 2 of the License.

 * 
 * The iWear Framework 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
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
#ifndef __TEXTDATA_H
#define __TEXTDATA_H

#include <iwear_output/outputdata.h>

#ifndef __IWEAR_UTILITY_H
#include <iwear/utility.h>
#endif

#ifndef __DEBUGSTREAM_H
#include <iwear/debugstream.h>
#endif

#include <string>


namespace iwear {
    namespace output {

/**
 * Enum which represents all types of changes which can happen
 * on a TextData
 */
enum TextDataChange
{
    changed_content,
    changed_font,
    changed_font_size,
    changed_color,
    num_TextDataChanged
};

/**
 * to_string() method for TextData changes 
 */
inline const char* to_string(TextDataChange tdc)
{
    switch(tdc)
	{
	case changed_content : 
	    return "TextDataChange::changed_content";
	case changed_font :
	    return "TextDataChange::changed_font";
	case changed_font_size :
	    return "TextDataChange::changed_font_size";
	case changed_color :
	    return "TextDataChange::changed_color";
	default :
	    return "TextDataChange::<invalid_value>";
	}
}


/**
 * This class holds one Text.
 * @author Christian Ober-Bloebaum, Tobias Warden
 */
class TextData : public OutputData{
	
public:
    /**
     * contains the OutputData type of this object.
     */
    static const string TYPE;

    /**
     * Constructor
     * @param name The name of the output data
     * @param description A description of the output data
     * @param content The content 
     */	
    TextData(const uid& application_id,
	     const string& name, 
	     const string& description, 
	     const string& content);
	    
    /**
     * Destructor
     */
    virtual ~TextData(void);
    
	
    /**
     * @return The content of the text.
     */
    inline const string& get_content(void) 
    {
	return content;
    }

    /** Gets the start tag for emphasised text.
     * @return The start tag for emphasised text.
     */
    inline const string& get_emphasise_start_tag( void ){
	return this->EMPH_START;
    }

    /** Gets the end tag for emphasised text.
     * @return The end tag for emphasised text.
     */
    inline const string& get_emphasise_end_tag( void ){
	return this->EMPH_END;
    }

    /** Gets the content string in ANSI format.
     * @param emphasise_formating A string that contains the ansi
     * formating for emphasised text.
     */
    string get_content_as_ansi(string emphasise_formating = ANSI_BG_DARKGREY);

    /**
     *
     */
//     inline const string& get_content_as_html(){
//     }

    /**
     * Set the content of this object - this will cause a changed-event to be
     * fired.
     *
     * @param content The new content to be set.
     */
    void set_content(const string& content);
	
private:    

    /** The actual content of this textdata.
     * The string can contain start and end tags for emphasised text.
     * @see EMPH_START, EMPH_END 
     */
    string content;

    /** The start tag for emphasised text.
     * This text will be replaced with the specialised formating tag,
     * e.g. a string with ANSI formating.
     */
    string EMPH_START;
 
    /** The end tag for emphasised text.
     * This text will be replaced with the specialised formating tag,
     * e.g. a string with ANSI formating.
     */
    string EMPH_END;

};

} // namespace output
} // namespace iwear

#endif

