// $Revision: 1.11 $ //------------------------------------------------------------------------------ // // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. // // Project: StockBrowser // File: StockGraphConstructor.h // Build/Version: 1.0.0 // // Description: TStockGraphConstructor is an abstract base class for // objects which can initialize a TStandardGraph instance // with appropriate drawer objects. // //------------------------------------------------------------------------------ #ifndef TaligentSamples_STOCKGRAPHCONSTRUCTOR #define TaligentSamples_STOCKGRAPHCONSTRUCTOR class TStockGraphConstructor; #ifndef TaligentSamples_GRAPHRANGE #include #endif #ifndef Taligent_STANDARDTEXT #include #endif #ifndef Taligent_GRAFTYPES #include #endif class TStandardGraph; class TStockData; class TStockDay; //========================================================================= // TStockGraphConstructor class TStockGraphConstructor { public: TaligentTypeExtensionDeclarationsMacro_Abstract(TStockGraphConstructor) public: virtual ~TStockGraphConstructor(); TStockGraphConstructor& operator=(const TStockGraphConstructor& source); virtual TStream& operator>>=(TStream& toStream) const; virtual TStream& operator<<=(TStream& fromStream); const TStandardText& GetDescription() const; virtual void SetDescription(const TStandardText& newDescription); virtual void GetXAxisLabel(TStandardText& label) const; virtual void GetYAxisLabel(TStandardText& label) const; virtual void SetXAxisLabel(const TStandardText& newLabel); virtual void SetYAxisLabel(const TStandardText& newLabel); virtual void Do(TStandardGraph& graph, const TStockData& stock); //stuff virtual GraphValue GetLabelDistanceFromAxis() const; virtual GraphValue GetXLabelInterval() const; virtual GraphValue GetLabelPointSize() const; virtual GraphValue GetMarkLength() const; virtual GraphValue GetXMarkInterval() const; virtual GraphValue GetXAxisLocation() const; virtual unsigned short GetNumberOfYMarks() const; virtual GCoordinate GetDrawerWidth() const; virtual void SetLabelDistanceFromAxis(GraphValue distance); virtual void SetXLabelInterval(GraphValue xLabelInterval); virtual void SetLabelPointSize(GraphValue pointSize); virtual void SetMarkLength(GraphValue markLength); virtual void SetXMarkInterval(GraphValue markInterval); virtual void SetXAxisLocation(GraphValue yAxisLocation); virtual void SetNumberOfYMarks(unsigned short numberOfYMarks); virtual void SetDrawerWidth(GCoordinate drawerWidth); protected: static const GraphValue kDefaultLabelDistanceFromAxis; static const GraphValue kDefaultXLabelInterval; static const GraphValue kDefaultLabelPointSize; static const GraphValue kDefaultMarkLength; static const GraphValue kDefaultXMarkInterval; static const GraphValue kDefaultXAxisLocation; static const unsigned short kDefaultNumberOfYMarks; static const GCoordinate kDefaultDrawerWidth; TStockGraphConstructor(); // For streaming only. TStockGraphConstructor( const TStockGraphConstructor& source); TStockGraphConstructor( const TStandardText& description, const TStandardText& xAxisLabel, const TStandardText& yAxisLabel, GraphValue labelDistFromAxis = kDefaultLabelDistanceFromAxis, GraphValue xLabelInterval = kDefaultXLabelInterval, GraphValue labelPointSize = kDefaultLabelPointSize, GraphValue markLength = kDefaultMarkLength, GraphValue xMarkInterval = kDefaultXMarkInterval, GraphValue xAxisLocation = kDefaultXAxisLocation, unsigned short numberOfYMarks = kDefaultNumberOfYMarks, GCoordinate drawerWidth = kDefaultDrawerWidth); virtual void CalcGraphRanges( TGraphRange& xRange, TGraphRange& yRange, const TCollectionOf& data) = 0; virtual void AdjustGraphRanges( TGraphRange& xRange, TGraphRange& yRange); // Use HandleDoBegin to munge the data or cache some information. virtual void HandleDoBegin( TStandardGraph& theGraph, TCollectionOf& data); virtual void HandleDoEnd( TStandardGraph& theGraph, const TCollectionOf& data, const TGraphRange& xRange, const TGraphRange& yRange); virtual void HandleAddStandardDrawers( TStandardGraph& theGraph, const TCollectionOf& data, const TGraphRange& xRange, const TGraphRange& yRange); // Subclasses will usually override HandleAddExtendedDrawers. virtual void HandleAddExtendedDrawers( TStandardGraph& theGraph, const TCollectionOf& data, const TGraphRange& xRange, const TGraphRange& yRange); private: void AdjustRange(TGraphRange& theRange, GraphValue numberOfDivisions) const; enum {kOriginalVersion}; TStandardText fDescription; TStandardText fXAxisLabel; TStandardText fYAxisLabel; GraphValue fLabelDistanceFromAxis; GraphValue fXLabelInterval; GraphValue fLabelPointSize; GraphValue fMarkLength; GraphValue fXMarkInterval; GraphValue fXAxisLocation; unsigned short fNumberOfYMarks; GCoordinate fDrawerWidth; }; #endif