//	Zinc Application Framework - BZ_ZCHT.HPP
//	COPYRIGHT (C) 1990-1997.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#ifndef BZ_ZCHT_HPP
#define BZ_ZCHT_HPP

#include <z_chart.hpp>
#include <cf_api/c4_cview.hpp>


//
//	IDs for IndexMethod and ChartType -- the actual values are chosen
//	to correspond with ZafChartStub values
//

#define CF_ID_YVALS_ON_NAT_NS	2001
#define CF_ID_YVALS_ON_INT_IS	2002

#define CF_ID_PIE_2D			2110
#define CF_ID_BAR_2D			3110
#define CF_ID_COL_2D			3210
#define CF_ID_STACK_2D			3310
#define CF_ID_POINTS_2D			3410
#define CF_ID_LINE_2D			3510
#define CF_ID_AREA_2D			3610



class CF_EXPORT ZafChart : public ZafChartStub
{
public:
	// --- General members ---
	ZafChart(int left, int top, int width, int height,
		int iChartTypeID = ZAF_POINTS_2D,
		int iIndexMethodID = ZAF_RANGE_NATURAL);
	ZafChart(const ZafChart &copy);
	virtual ~ZafChart(void);

	// --- Persistence ---
	virtual ZafWindowObject *Duplicate(void);
	ZafChart(const ZafIChar *name, ZafObjectPersistence &persist);
	static ZafElement *Read(const ZafIChar *name, ZafObjectPersistence &persist);
	virtual void Write(ZafObjectPersistence &persist);

	// --- Zinc to ChartFolio Data Method Mappings ---	

	cf_ChartModel*			ActiveModel(void);
	ZafError 				AddDataGroup(int groupIndex);
	ZafError 				AddDataPoint(int groupIndex, double dDataValue);

	ZafLogicalColor 		AxisColor(ZafLogicalColor *mono = ZAF_NULLP(ZafLogicalColor));
	ZafLogicalColor 		SetAxisColor(ZafLogicalColor color, ZafLogicalColor mono = ZAF_MONO_NULL);

	int 					ChartType() const;
	int 					SetChartType(int chartTypeID);

	ZafError 				ClearDataAll(void);
	ZafError 				ClearDataGroup(int groupIndex);

	cf_DataGroup*			DataGroup(int groupIndex);

	ZafLogicalColor 		DataGroupBackgroundColor(int groupIndex, ZafLogicalColor *mono = ZAF_NULLP(ZafLogicalColor));
	ZafLogicalColor 		SetDataGroupBackgroundColor(int groupIndex, ZafLogicalColor color, ZafLogicalColor mono = ZAF_MONO_NULL);

	ZafLogicalFillPattern 	DataGroupFillPattern(int groupIndex);
	ZafLogicalFillPattern	SetDataGroupFillPattern(int groupIndex, ZafLogicalFillPattern fillPattern);

	ZafLogicalFont 			DataGroupFont(int groupIndex);
	ZafLogicalFont 			SetDataGroupFont(int groupIndex, ZafLogicalFont font);

	ZafLogicalColor 		DataGroupForegroundColor(int groupIndex, ZafLogicalColor *mono = ZAF_NULLP(ZafLogicalColor));
	ZafLogicalColor 		SetDataGroupForegroundColor(int groupIndex, ZafLogicalColor color, ZafLogicalColor mono = ZAF_MONO_NULL);

	ZafLogicalLineStyle 	DataGroupLineStyle(int groupIndex);
	ZafLogicalLineStyle 	SetDataGroupLineStyle(int groupIndex, ZafLogicalLineStyle lineStyle);

	cf_XYZ*					DataPoint(int groupIndex, int dataIndex);

	int						IndexMethod () const;
	int 					SetIndexMethod(int indexMethodID);


	bool 					MarksXAxis(void) const;
	bool 					SetMarksXAxis(bool xAxisMarks);
	bool 					MarksYAxis(void) const;
	bool 					SetMarksYAxis(bool yAxisMarks);

	const ZafIChar*			TextTitle(void);
	const ZafIChar*			SetTextTitle(const ZafIChar *text);
	const ZafIChar*			TextXAxis(void);
	const ZafIChar*			SetTextXAxis(const ZafIChar *text);
	const ZafIChar*			TextYAxis(void);
	const ZafIChar*			SetTextYAxis(const ZafIChar *text);

	// --- Window object members ---
	ZafEventType Draw(const ZafEventStruct&, ZafEventType);
	ZafEventType Event(const ZafEventStruct&);

	// --- Class identification ---
	static ZafClassID classID;
	static ZafClassNameChar ZAF_FARDATA className[];
	virtual ZafClassID ClassID(void) const { return (classID); }
	virtual ZafClassName ClassName(void) const { return (className); }
	virtual bool IsA(ZafClassID compareID) const { return ((compareID == classID) ? true : ZafChartStub::IsA(compareID)); }
	virtual bool IsA(ZafClassName compareName) const { return ((compareName == className) ? true : ZafChartStub::IsA(compareName)); }

protected:

	cf_ChartView *chartView;

	// --- Persistence ---
	virtual ZafObjectConstructor ReadFunction(void) { return (ZafChart::Read); }



private:

	cf_ChartType	ConvertChartType (int);
	cf_IndexMode	ConvertIndexMode (int);

	void			Redraw ();

};

#endif // BZ_ZCHT_HPP

