Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TCOLORSTYLES_H
Toshihiro Shimizu 890ddd
#define TCOLORSTYLES_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qstring></qstring>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TVRENDER_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//    Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TStroke;
Toshihiro Shimizu 890ddd
class TRegion;
Toshihiro Shimizu 890ddd
class TStrokeProp;
Toshihiro Shimizu 890ddd
class TRegionProp;
Toshihiro Shimizu 890ddd
class TVectorRenderData;
Toshihiro Shimizu 890ddd
class TFlash;
Toshihiro Shimizu 890ddd
class TInputStreamInterface;
Toshihiro Shimizu 890ddd
class TOutputStreamInterface;
Toshihiro Shimizu 890ddd
class TRasterStyleFx;
Toshihiro Shimizu 890ddd
class QStringList;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
//    TRasterStyleFx  definition
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TRasterStyleFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	struct Params {
Toshihiro Shimizu 890ddd
		TRasterP m_r;
Toshihiro Shimizu 890ddd
		TPoint m_p;
Toshihiro Shimizu 890ddd
		TRasterP m_rOrig;
Toshihiro Shimizu 890ddd
		int m_colorIndex;
Toshihiro Shimizu 890ddd
		int m_frame;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	public:
Toshihiro Shimizu 890ddd
		Params(const TRasterP &r, const TPoint &p,
Toshihiro Shimizu 890ddd
			   const TRasterP &rOrig, int index, int frame)
Toshihiro Shimizu 890ddd
			: m_r(r), m_p(p), m_rOrig(rOrig), m_colorIndex(index), m_frame(frame)
Toshihiro Shimizu 890ddd
		{
Toshihiro Shimizu 890ddd
			assert(m_r);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	virtual ~TRasterStyleFx() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool isInkStyle() const = 0;
Toshihiro Shimizu 890ddd
	virtual bool isPaintStyle() const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool inkFxNeedRGBMRaster() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return false;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool compute(const Params ¶ms) const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void getEnlargement(int &borderIn, int &borderOut) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		borderIn = borderOut = 0;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
//    TColorStyle  definition
Toshihiro Shimizu 890ddd
//************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief Abstract class representing a color style in a Toonz palette.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TColorStyle : public TSmartObject
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	//! Helper class to declare color styles
Toshihiro Shimizu 890ddd
	class Declaration
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	public:
Toshihiro Shimizu 890ddd
		Declaration(TColorStyle *style)
Toshihiro Shimizu 890ddd
		{
Toshihiro Shimizu 890ddd
			declare(style);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	enum ParamType {
Toshihiro Shimizu 890ddd
		BOOL,	//!< Boolean parameter type.
Toshihiro Shimizu 890ddd
		INT,	 //!< Integer parameter type.
Toshihiro Shimizu 890ddd
		ENUM,	//!< Enum parameter type (maps to integer values).
Toshihiro Shimizu 890ddd
		DOUBLE,  //!< Double parameter type (getParamType() default).
Toshihiro Shimizu 890ddd
		FILEPATH //!< TFilePath parameter type.
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	struct double_tag {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
	struct bool_tag {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
	struct int_tag {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
	struct TFilePath_tag {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	std::wstring m_name;		 //!< User-define style name.
Toshihiro Shimizu 890ddd
	std::wstring m_globalName;   //!< User-define style \a global name.
Toshihiro Shimizu 890ddd
	std::wstring m_originalName; //!< If the style is copied from studio palette, its original name is stored
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int m_versionNumber; //!< Style's version number.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	unsigned int m_flags; //!< Style attributes.
Toshihiro Shimizu 890ddd
	bool m_enabled;		  //!< Style's \a enabled status.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool m_isEditedFromOriginal; //
Toshihiro Shimizu 890ddd
								 //!  style is edited from the original one.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TRaster32P m_icon; //!< Icon shown on TPalette viewers.
Toshihiro Shimizu 890ddd
	bool m_validIcon;  //!< Icon's validity status.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	static int m_currentFrame; //!< Time instant in the palette's timeline.
Toshihiro Shimizu 890ddd
							   //!  \deprecated  Should be done better
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TColorStyle();
Toshihiro Shimizu 890ddd
	TColorStyle(const TColorStyle &other); //!< Copies another style \a except its icon
Toshihiro Shimizu 890ddd
	virtual ~TColorStyle();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TColorStyle *clone() const = 0;				//!< Polymorphic clone of the style.
Toshihiro Shimizu 890ddd
	virtual TColorStyle ©(const TColorStyle &other) //!< Polymorphic copy of the style.
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assignBlend(other, other, 0.0);
Toshihiro Shimizu 890ddd
		return *this;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool operator==(const TColorStyle &cs) const;
Toshihiro Shimizu 890ddd
	bool operator!=(const TColorStyle &cs) { return !operator==(cs); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Renderizer-related  objects
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TStrokeProp *makeStrokeProp(const TStroke *stroke) = 0; //!< Allocates a \a new derived TStrokeProp instance
Toshihiro Shimizu 890ddd
																	//!  used to draw the style on the specified stroke object.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TRegionProp *makeRegionProp(const TRegion *region) = 0; //!< Allocates a \a new derived TRegionProp instance
Toshihiro Shimizu 890ddd
																	//!  used to draw the style on the specified region object.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool isRasterStyle() const { return false; }	 //!< Returns whether the style is of the raster kind.
Toshihiro Shimizu 890ddd
	virtual TRasterStyleFx *getRasterStyleFx() { return 0; } //!< If the style contains raster effects it must return it,
Toshihiro Shimizu 890ddd
															 //!  else returns 0.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool isRegionStyle() const = 0; //!< Returns whether the style applies on regions.
Toshihiro Shimizu 890ddd
	virtual bool isStrokeStyle() const = 0; //!< Returns whether the style applies on strokes.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// General functions
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void setName(std::wstring name) { m_name = name; } //!< Sets the style's user-defined name.
Shinya Kitaoka 3bfa54
	std::wstring getName() const { return m_name; }	//!< Returns the style's user-defined name.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    The \a global name contains information about palette id.
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 3bfa54
	void setGlobalName(std::wstring name) { m_globalName = name; } //!< Sets the global name of the style.
Shinya Kitaoka 3bfa54
	std::wstring getGlobalName() const { return m_globalName; }	//!< Returns the global name of the style.
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
	void setOriginalName(std::wstring name) { m_originalName = name; } //!< If the style is originally copied from studio palette, set this.
Shinya Kitaoka 3bfa54
	std::wstring getOriginalName() const { return m_originalName; }	//!< Returns the original name of the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setIsEditedFlag(bool edited) { m_isEditedFromOriginal = edited; } //
Toshihiro Shimizu 890ddd
																		   //!  style is edited from the original one.
Toshihiro Shimizu 890ddd
	bool getIsEditedFlag() const { return m_isEditedFromOriginal; }		   //!< Returns whether the style is edited from the original from studio palette
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void assignNames(const TColorStyle *src); //!< Copies the style names from src.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! \sa tcolorflags.h
Toshihiro Shimizu 890ddd
	unsigned int getFlags() const { return m_flags; }	  //!< Sets color attributes.
Toshihiro Shimizu 890ddd
	void setFlags(unsigned int flags) { m_flags = flags; } //!< Returns color attributes.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Color-related functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    Raster or vector pattern image styles, for example, return false.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual bool hasMainColor() const { return false; }				  //!< Returns whether the style has a reference \a main color.
Toshihiro Shimizu 890ddd
	virtual TPixel32 getMainColor() const { return TPixel32::Black; } //!< Returns the style's main color, or black if none.
Toshihiro Shimizu 890ddd
	virtual void setMainColor(const TPixel32 &color) {}				  //!< Sets the main color, if it has one.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    For example a bubble styles has two colors.
Toshihiro Shimizu 890ddd
    By default it returns \p 1 if the style has only a main color else 
Toshihiro Shimizu 890ddd
    returns \p 0 if the style has no color.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual int getColorParamCount() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return hasMainColor() ? 1 : 0;
Toshihiro Shimizu 890ddd
	} //!< Returns the number of colors (if any) of the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    Returns the main color by default.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual TPixel32 getColorParamValue(int index) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return getMainColor();
Toshihiro Shimizu 890ddd
	} //!< Returns the value of the color of index \e index.
Toshihiro Shimizu 890ddd
	virtual void setColorParamValue(int index, const TPixel32 &color)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		setMainColor(color);
Toshihiro Shimizu 890ddd
	} //!< Sets the \a index-th color value.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TPixel32 getAverageColor() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return getMainColor();
Toshihiro Shimizu 890ddd
	} //!< Returns a color representing the average of all the style's colors
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Parameters-related functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
	 For example: a the general cleanup style has two parameters, brightness and contrast and 
Toshihiro Shimizu 890ddd
	 a black cleanup style has in addition a black and white threshold, therefore 4 parameters.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual int getParamCount() const { return 0; } //!< Returns the number of parameters necessary
Toshihiro Shimizu 890ddd
													//!  to describe the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual ParamType getParamType(int paramIdx) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(0 <= paramIdx && paramIdx < getParamCount());
Toshihiro Shimizu 890ddd
		return DOUBLE;
Toshihiro Shimizu 890ddd
	} //!< Returns the type of the specified parameter.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void setParamValue(int index, bool value)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Assigns a value to the specified \p bool parameter.
Toshihiro Shimizu 890ddd
	virtual bool getParamValue(bool_tag, int index) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
		return bool();
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p bool parameter value.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void setParamValue(int index, int value)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Assigns a value to the specified \p int parameter.
Toshihiro Shimizu 890ddd
	virtual int getParamValue(int_tag, int index) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
		return int();
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p int parameter value.
Toshihiro Shimizu 890ddd
	virtual void getParamRange(int index, int &min, int &max) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p int parameter range.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void getParamRange(int pIndex, QStringList &stringItems) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Returns a description of each supported enum or file
Toshihiro Shimizu 890ddd
	  //!  extension value in text form.
Toshihiro Shimizu 890ddd
	virtual void setParamValue(int index, double value)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Assigns a value to the specified \p double parameter.
Toshihiro Shimizu 890ddd
	virtual double getParamValue(double_tag, int index) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
		return double();
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p double parameter value.
Toshihiro Shimizu 890ddd
	virtual void getParamRange(int index, double &min, double &max) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p double parameter range.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void setParamValue(int index, const TFilePath &fp)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
	} //!< Assigns a value to the specified \p TFilePath parameter.
Toshihiro Shimizu 890ddd
	virtual TFilePath getParamValue(TFilePath_tag, int index) const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		assert(false);
Toshihiro Shimizu 890ddd
		return TFilePath();
Toshihiro Shimizu 890ddd
	} //!< Retrieves the specified \p TFilePath parameter value.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    This function is provided to animate a palette style. Given two keyframe
Toshihiro Shimizu 890ddd
    styles \p a and \p b, it calculates their linear interpolation at parameter
Toshihiro Shimizu 890ddd
    \p t and assigns the result to this style instance.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
    \param a    Style value at parameter <tt>t = 0</tt>.
Toshihiro Shimizu 890ddd
    \param b    Style value at parameter <tt>t = 1</tt>.
Toshihiro Shimizu 890ddd
    \param t    Interpolation parameter.
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	void assignBlend(const TColorStyle &a, const TColorStyle &b, double t); //!< Assigns the linear interpolation between the
Toshihiro Shimizu 890ddd
																			//!  supplied styles.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Description-related functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    For example for a stroke style we have "Constant", "Chain", "Rope", "Tulle", etc...
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	virtual QString getDescription() const = 0;		//!< Return a brief description of the style.
Toshihiro Shimizu 890ddd
	virtual QString getParamNames(int index) const; //!< Return the string that identifies the \a index-th parameter.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Drawing-related  functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void drawStroke(TFlash &flash, const TStroke *stroke) const; //!< Draws the supplied stroke in flash.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// I/O-related  functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual int getTagId() const = 0;						//!< Returns an unique number representing the style.
Shinya Kitaoka 3bfa54
	virtual void getObsoleteTagIds(std::vector<int> &) const {}; //!< \deprecated</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void save(TOutputStreamInterface &) const;		   //!< Calls the local implementation of saveData() passing it also the name and the tagId of the style.
Toshihiro Shimizu 890ddd
	static TColorStyle *load(TInputStreamInterface &); //!< Loads the style from disk. Calls the local implementation of loadData().
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TColorStyle *create(int tagId); //!< Creates a new style with identifier equal to \a tagId.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static void declare(TColorStyle *style); //!< Puts the style in the table of actual styles.
Shinya Kitaoka 3bfa54
	static void getAllTags(std::vector<int> &tags);</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Misc functions
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \detail
Toshihiro Shimizu 890ddd
    It is used when updates must be done after changes or creation of new styles. 
Toshihiro Shimizu 890ddd
  */
Toshihiro Shimizu 890ddd
	void invalidateIcon() { m_validIcon = false; }			//!< Sets a flag that defines the style's icon validity.
Toshihiro Shimizu 890ddd
	virtual const TRaster32P &getIcon(const TDimension &d); //!< Returns an image representing the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool isEnabled() const { return m_enabled; } //!< Returns whether the style can be used.
Toshihiro Shimizu 890ddd
	void enable(bool on) { m_enabled = on; }	 //!< Sets the style's \a enabled status
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getVersionNumber() const { return m_versionNumber; } //!< Returns the version number of the style.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	virtual void makeIcon(const TDimension &d);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void loadData(TInputStreamInterface &) = 0;
Toshihiro Shimizu 890ddd
	virtual void saveData(TOutputStreamInterface &) const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void loadData(int, TInputStreamInterface &) {} //!< \deprecated  Backward compatibility
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void updateVersionNumber();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TColorStyle &operator=(const TColorStyle &other); //!< Copies another style \a except its icon
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//--------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#ifdef _WIN32
Toshihiro Shimizu 890ddd
template class DVAPI TSmartPointerT<tcolorstyle>;</tcolorstyle>
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
typedef TSmartPointerT<tcolorstyle> TColorStyleP;</tcolorstyle>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // TCOLORSTYLES_H