
/////////////////////////////////////////
// START of File: b5_ccont.hpp
/////////////////////////////////////////

//-------------------------------------------------------------------
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994 through 1997 by DPC Technology Corporation.
// All rights reserved.
//
// See files "cf_copyr.h" and "cf_licen.h" for details of
// copyright and license specifications, and contact information.
//-------------------------------------------------------------------

#ifndef B5_CCONT_HPP
#define B5_CCONT_HPP

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





class CF_EXPORT ZafChartControl : public ZafChartStub
{
  public:

	ZafChartControl (int left, int top, int width, int height,
						cf_ChartType		type,
						cf_DispMode			dmode = CF_DISP_2D,
						cf_IndexMode		imode = CF_INDEX_NAT_N);
					//
					//	Construct a ZafChartControl, given initial
					//	dimensions, type, display mode, and indexing
					//	mode
					//

	virtual ~ZafChartControl (void);


	cf_XYZ&			AddData (	int 	group, 
								double 	y_value);
	cf_XYZ&			AddData (	int 	group, 
								double 	x_value, 
								double 	y_value);
	cf_XYZ&			AddData (	int 	group, 
								double 	x_value, 
								double 	y_value,
								double 	z_value);
					//
					//	Add a data item to a specified data group
					//
					//	First method: 	x-value determined by indexing
					//	              	method, y-value as given, 
					//					z-value = 1
					//	Second method:  x/y values as given, 
					//					z-value = 1
					//	Third method:	x/y/z values as given
					//


	cf_DataGroup&	AddLabelLegend (	char*	label,
										double 	x_value, 
										double 	y_value,
										double 	z_value = 0.0);


	void 			SetChartType (cf_ChartType chartTypeID);
	void 			SetDispMode (cf_DispMode dispModeID);
	void 			SetIndexMode (cf_IndexMode indexMethodID);
					//
					//	Dynamically change a chart's type, display
					//	mode, or index mode
					//


	cf_ChartType 	ChartType ();
	cf_DispMode 	DispMode ();
	cf_IndexMode 	IndexMode ();
					//
					//	Retrieve a chart's type, display
					//	mode, or index mode
					//


	cf_DispAttribs*	GetAttribAxisItemDisp (cf_ChartAxis	 which_axis);
	cf_TextAttribs*	GetAttribAxisItemText (cf_ChartAxis	 which_axis);
					//
					//	Retrieve display/text attribute objects 
					//	that control the axis item (tick) labels
					//

	cf_DispAttribs*	GetAttribAxisNameDisp (cf_ChartAxis which_axis);
	cf_TextAttribs*	GetAttribAxisNameText (cf_ChartAxis which_axis);
					//
					//	Retrieve display/text attribute objects 
					//	that control the axis titles
					//

	cf_DispAttribs*	GetAttribChartFaceDisp (cf_ChartFace which_face);
					//
					//	Retrieve a display attribute object 
					//	that controls a chart face
					//

	cf_DispAttribs*	GetAttribDataGroupDisp (int group_num);
	cf_TextAttribs*	GetAttribDataGroupText (int group_num);
					//
					//	Retrieve a data group's display or text
					//	attribute object
					//

	cf_DispAttribs*	GetAttribLegendDisp (int legend_num);
	cf_TextAttribs*	GetAttribLegendText (int legend_num);

	cf_DispAttribs*	GetAttribTitleDisp (cf_ChartTitle which_title);
	cf_TextAttribs*	GetAttribTitleText (cf_ChartTitle which_title);
					//
					//	Retrieve a title display or text attribute
					//	object
					//


	cf_DataGroup&	SetLabelTitle (	const char*   str, 
									cf_ChartTitle which);
	cf_DataGroup&	SetLabelTitle (	const char*   str, 
									cf_ChartTitle which,
									double		  x_pct,
									double		  y_pct,
									double		  z_pct = 0.0);
					//
					//	Set the chart's main or sub-title, either
					//	using default or explicit positioning.
					//


	cf_DataGroup&	SetLabelAxisName (	const char* 	str,
									cf_ChartAxis	which);
	cf_DataGroup&	SetLabelAxisName (	const char*   	str, 
									cf_ChartAxis 	which,
									double		 	x_pct,
									double		  	y_pct,
									double		  	z_pct = 0.0);
					//
					//	Set a chart's axis title, either
					//	using default or explicit positioning.
					//


	cf_XYZ&			AddLabelAxisItem (	const char*		str,
										cf_AxisData		which,
										double			position);
	cf_XYZ&			AddLabelAxisItem (	double			value,
										cf_AxisData		which,
										double			position);


	cf_3DGridTickSeries*	GetAxis (cf_ChartAxis);

	cf_3DGridTickSeries*	SetAxisBehavior (cf_ChartAxis,
								double 	freqTicksToData,
								int 	ratioLabelsToTicks = 1,
								int 	ratioGridsToTicks = 1,
								int 	ratioMajorToMinor = 1,
								double	pctTickSize = 5.0,
								long 	flags = CF_FLAGS_SHOW_TICKS);
							//
							//	Set all attributes for a given
							//	axis
							//

	cf_3DGridTickSeries*	SetAxisDataSource (cf_ChartAxis,
											   cf_AxisData,
											   BOOL = TRUE);

	cf_3DGridTickSeries*	SetAxisTicks (cf_ChartAxis,
								double 	freqTicksToData,
								int 	ratioMajorToMinor = 1,
								double	pctTickSize = 5.0,
								long 	flags = CF_FLAGS_SHOW_TICKS);
							//
							//	Set tick attributes for a given
							//	axis.  'freqTicksToData' is normally
							//	1 for x-axes, and range-dependent
							//	for y-axes
							//

	cf_3DGridTickSeries*	SetAxisGrids (cf_ChartAxis,
								int 	ratioGridsToTicks = 1,
								long 	flags = CF_FLAGS_HIDE_TICKS);
							//
							//	Set grid line attributes for an axis.
							//	Most useful for turning on horizontal
							//	(y-backface) or vertical (x-backface)
							//	grid lines
							//


	cf_3DGridTickSeries*	SetAxisLabels (cf_ChartAxis,
								int 	ratioLabelsToTicks = 1,
								long 	flags = CF_FLAGS_SHOW_TICKS);
							//
							//	Turn on tick labels for a given 
							//	axis
							//

	cf_3DGridTickSeries*	ShowAxis (cf_ChartAxis, BOOL);
							//
							//	Show or hide a given axis altogether
							//


	BOOL					SetAxisRangePreference (double min, 
													double max);
							//
							//	Set the desired range display minimum
							//	and maximum values.  Note that the
							//	actual values may be different if
							//	the data range exceeds these values 
							//	(i.e. the chart display will stretch
							//	either bound in order to display all
							//	data values
							//

	double					GetAxisRangeMin ();
	double					GetAxisRangeMax ();
							//
							//	Get the actual data range values
							//


	BOOL					SetAxisRangeUseOriginAlways (BOOL);
	BOOL					GetAxisRangeUseOriginAlways ();
	double					GetAxisRangeUseOriginIf ();
	BOOL					SetAxisRangeUseOriginIf (double);


	cf_3DGridTickSeries*	GetActiveAxis (cf_ChartAxis which);
							//
							//	Allow access to the internal axis
							//	data structure
							//


	void					ResetAll (BOOL redraw);
	void					ResetData (BOOL redraw);
	void					ResetLabels (BOOL redraw);
	void					ResetLegends (BOOL redraw);
	void					ResetTitles (BOOL redraw);

	BOOL					SetViewAngle (cf_DispMode);
	BOOL					SetViewAngle (double, double);

	cf_ChartEngine*			GetActiveEngine ();
	cf_ChartModel*			GetActiveModel ();
	cf_ChartView*			GetActiveView ();
							//
							//	Allow access to chart internal
							//	structures
							//


	ZafEventType 			Draw (const ZafEventStruct&, 
								  ZafEventType);
	ZafEventType 			Event (const ZafEventStruct&);
							//
							//	ZafWindowObject redefined virtuals
							//


protected:

	cf_ChartView			*cview_;


private:

	int 					SetChartType (int);
							//
							//	Redefined base class virtual -- see
							//	.cpp file for explanation
							//
};

#endif

/////////////////////////////////////////
// END of File: b5_ccont.hpp
/////////////////////////////////////////

