SRGraphComponent Class

class SRGraphComponent: public CObject

Base class for graphical components

Defined in: SRGComp.h

Class Members

protected data members

int m_nBrushKey

Most recently used brush key

int m_nPenKey

Most recently used pen key

int m_nPenWidth

Most recently used pen width

BOOL m_bPass

Current pass -- pre-draw sizing pass or actual drawing pass

SRGraphComponent * m_pMaster

Pointer to the master component -- used during drawing if the component is a

BOOL m_bSignificantChange

Semaphore showing if a significant change has taken place either in this component or in the graph which owns it

int m_nCountryCode

List of SRGCompiledPolygons for this object

int m_nCountryCode

Integer localizing code for multi-lingual annotations

BOOL m_bHiLo

Semaphore showing if the use of hi-lo history data is required

int m_nMaxIndex

Maximum index upon which this component should act (scope)

int m_nMinIndex

Minimum index upon which this component should act (scope)

int m_nMaxGroup

Maximum group upon which this component should act (scope)

int m_nMinGroup

Minimum group upon which this component should act (scope)

int m_nDivCount

Number of indices which this component may span

int m_nMaxDiv

Maximum index which this component may use

int m_nMinDiv

Minimum index which this component may use

int m_nSetCount

Number of groups which this component may span

int m_nMinSet

Minimum group

int m_nMaxSet

Maximum group

int m_nIndexStep

Number of steps the index advances with each key (normally 1)

int m_nGroupStep

Number of steps the group advances with each key (normally 1)

CScale m_ScaleY

Y scale calculated for this components range

CScale m_ScaleX

X scale calculated for this components range

double m_dTickSize

Device independent size for tick marks

double m_dMarginY

Device independent size for the Y margin

double m_dMarginX

Device independent size for the X margin

CPen m_AutoPen

Pen used to frame automatically framed objects

CBrush m_AutoBrush

Brush used to fill automatically filled objects

SRGraphRect m_Rect

Device independent rectangle

int m_nCurrentIndex

Index of the SRGraphData object being drawn -- used for automatic filling and framing

SRGraphStyle m_Style

Drawing style flags

BOOL m_bDrawing

Semaphore set when drawing is taking place

CWnd* m_pCWnd

Pointer to the CWnd object which requested the drawing

CDC* m_pDC

Pointer to the CDC of the window which requested the drawing

SRGraph * m_pParentGraph

Pointer to the graph owning this object

UINT m_nType

Component identifier -- used in reading, writing, and editing of graph templates

CBitmap* m_pImage

Points to the stored image

BOOL m_bImageReady

TRUE when the image is valid

public member functions

inline bool GetCompoundMember()

Returns the m_bCompoundMember setting

inline void SetCompoundMember(bool v)

Initializes the m_bCompoundMember variable

inline void SetPass(BOOL b)

Sets the pass variable used for sizing or drawing

inline BOOL GetPass()

Retrieves the pass semaphore

inline void SetPMaster(SRGraphComponent* p)

Sets the pointer to the master component

inline SRGraphComponent * GetpMaster()

Retrieves a pointer to the master component

inline void SetXMargin(double d)

Initializes the X margin size

inline void SetYMargin(double d)

Initializes the Y margin size

inline void SetTickSize(double d)

Initializes the tick mark size

CHART_API virtual void DrawCustomBorder()

Draws custom borders

CHART_API virtual void DrawCustomShadow()

Draws custom shadows

CHART_API virtual void DrawCustomRgnFill(CRgn *rgn,SRGraphStyle *style,DWORD type,DWORD StyleOverride)

Draws custom fills

inline void SetSignificantChange()

Sets a semaphore signifying a significant change in either the component or the graph which owns it

inline int GetMinDiv()

Returns the minimum index which this component currently accesses

inline int GetMaxDiv()

Returns the maximum index which this component currently accesses

inline int GetMinSet()

Returns the minimum group which this component currently accesses

inline int GetMaxSet()

Returns the maximum group which this component currently accesses

inline CScale & GetScaleY()

Returns the Y scale range

inline CScale & GetScaleX()

Returns the X scale range

inline void SetScaleX(CScale v)

Initializes the X scale range

inline void SetScaleY(CScale v)

Initializes the Y scale range

inline const int GetSetCount()

Returns the number of groups which are spanned by this component

inline const int GetDivCount()

Returns the number of indices which are spanned by this component

CHART_API virtual void DrawPointObject(CPoint firstpoint,CPoint lastpoint,SRGraphStyle *ptrStyle,int nObjectMode, SRGraphData *pData = NULL)

Draws a wiget/line combination from one point to another in the style specified

CHART_API SRGraphComponent()

Constructor

CHART_API virtual ~SRGraphComponent()

Destructor

CHART_API virtual BOOL CreateAutoBrush(int key,int nColorRange=16)

Creates a brush which can be used for filling the interiors of objects according to an index

CHART_API virtual BOOL CreateAutoPen(int key,int nPenWidth=1,int nColorRange=16)

Creates a pen which can be used for framing the boundaries of objects according to an index

CHART_API virtual void GetParentContent()

Retrieves pertinent data from the parent graph

CHART_API virtual double GetYMargin()

Interrogates the device independent Y margin value

CHART_API virtual double GetXMargin()

Interrogates the device independent X margin value

CHART_API virtual double GetTickSize()

Interrogates the device independent axis tick value

inline void SetMaxIndex(int index)

Initializes the maximum index that a component may use

inline void SetMinIndex(int index)

Initializes the maximum index that a component may use

inline void SetMaxGroup(int group)

Initializes the maximum group that a component may use

inline void SetMinGroup(int group)

Initializes the minimum group that a component may use

inline int GetMaxIndex()

Interrogates the maximum index setting

inline int GetMinIndex()

Interrogates the minimum index setting

inline int GetMaxGroup()

Interrogates the maximum group setting

inline int GetMinGroup()

Interrogates the minimum group setting

CHART_API virtual void SetIndexStep(int v)

Sets the number of data objects (indices) per data series

CHART_API virtual int GetIndexStep()

Retrieves the number of data objects (indices) per data series

CHART_API virtual void SetGroupStep(int v)

Sets the number of groups per data series

CHART_API virtual int GetGroupStep()

Retrieves the number of groups per data series

inline UINT GetType()

Fetches the type of the component (ie. background, title, etc.)

CHART_API virtual void SetParent(SRGraph *pParent)

Initializes the pointer to the SRGraph which owns this object

CHART_API virtual void SetResourceName(LPCTSTR name)

Initializes the name of the bitmap resource used to tile the background

CHART_API virtual void SetAngle(int angle)

Initializes the m_Angle member

CHART_API virtual void SetColor(COLORREF a,COLORREF b)

Initializes the RGB color values of the filled background

inline SRGraphStyle * GetStyle()

Retrieves the style of this object

inline void SetStyle(DWORD style)

Initializes the style of this object

CHART_API virtual void SetRect(const CRect& r)

Initializes the device independant rectangle from a CRect

CHART_API virtual void SetRect(double l, double t, double r, double b)

Initializes the device independant rectangle with floating point coordinates

CHART_API virtual void SetRect(const SRGraphRect& r)

Initializes the device independant rectangle with the contents of a second

CHART_API virtual SRGraphRect* GetRect()

Retrieves a pointer to the device independant rectangle which defines the boundary of this object

inline virtual SRGraphRect GetFinalRect()

Returns device independent rectangle specified by SetRect() -- overidden by resizeable components

CHART_API virtual CRect GetLogRect()

Returns device independent rectangle specified by SetRect() -- overidden by resizeable components

CHART_API virtual CRect GetLogRect()

Returns the logical (device dependent) rectangle for this component -- CRect(0,0,0,0) if not available

CHART_API virtual void SetMeasurement(int m=PIXELS)

Initializes the measurement mode of the m_Rect data member (0=pixels, 1=millimeters, 2=inches, 3=percentage)

CHART_API virtual void Draw(CDC *pDC,CWnd *pCWnd)

Called by the CWnd managing the display of graph data to draw the graph

CHART_API virtual void FillPoly(LPPOINT points,int nCount,SRGraphStyle *style,DWORD StyleOverride)

Fills a polygon held in an array of points according to a style

CHART_API virtual void FramePoly(LPPOINT points,int nCount,SRGraphStyle *style,DWORD StyleOverride)

Frames a polygon held in an array of points according to a style

CHART_API virtual void FrameRgn(CRgn *rgn,SRGraphStyle *style,DWORD type,DWORD StyleOverride)

Frames a predefined region according to a style

CHART_API virtual void FillRgn(CRgn *rgn,SRGraphStyle *style,DWORD type,DWORD StyleOverride=0)

Fills a predefined region according to a style

CHART_API virtual void ProcessHint(CWnd *pCWnd)

Decides which areas of the display need to be invalidated after a CWnd::OnUpdate with a hint

CHART_API static int __cdecl qsSorterCompareA(const void *a,const void *b)

Callback routine for the qsort function

CHART_API static int __cdecl qsSorterCompareD(const void *a,const void *b)

Callback routine for the qsort function.

CHART_API virtual int ReadTemplateLine(LPCTSTR line)

Reads the parameters for this component from the template line

CHART_API virtual int ReadBasicParameters(LPCTSTR line)

Reads the basic rectangle and component fill, border, and shadow parameters for all components

CHART_API virtual void WriteComponent(CStdioFile* file)

Writes the component to a template file

CHART_API virtual void WriteName(CStdioFile* file)

Writes this component name to a template file

CHART_API virtual void WriteFontParameters(CStdioFile* file)

Writes font details of this component to a template file

CHART_API virtual void WriteMainParameters(CStdioFile* file)

Writes the main details for this component to a template file

CHART_API virtual void WriteSpecificParameters(CStdioFile* file)

Writes specific details of this component to a template file

CHART_API static int _cdecl qsPointYSorterCompareA(const void *a,const void *b)

Callback routine for the qsort function -- used to order Y components for pie chart wedges into acending order

CHART_API static int _cdecl qsPointYSorterCompareD(const void *a,const void *b)

Callback routine for the qsort function -- used to order Y components for pie chart wedges into decending order

inline BOOL GetHiLo()

Returns the m_bHiLo semaphore

inline void SetHiLo(BOOL hilo=TRUE)

Initializes the m_bHiLo semaphore

inline int GetMeasurement()

Fetches the measurement mode from the m_Rect member

inline void SetpDC(CDC *pDC)

Initializes the m_pDC member

inline CDC * GetpDC()

Interrogates the m_pDC member

inline void SetpCWnd(CWnd *pCWnd)

Initializes the m_pCWnd member

inline CWnd * GetpCWnd()

Interrogates the m_pCWnd member

CHART_API virtual void DrawStyledLine(CPoint ptStart,CPoint ptEnd,SRGraphStyle *ptrStyle=NULL, int nKey=0,DWORD dwStyleOverride=0,SRGraphData *pData = NULL)

Draws a line from ptStart to ptEnd in the desired style.

CHART_API virtual void DrawBar(CPoint topleft,CPoint bottomright, int group, int index,SRGraphStyle* ptrStyle,DWORD dwStyleOverride=0,SRGraphData *pData=NULL)

Draws bars for bar graphs

CHART_API virtual void OffsetPolygon(CPoint * points,int nPointCount, int xOffset,int yOffset)

Moves a polygon stored as an array of CPoints by specified X and Y offsets

CHART_API virtual void SetCountryCode(int c=1)

Sets the m_nCountryCode member

CHART_API virtual int GetCountryCode()

Interrogates the m_nCountryCode member

inline SRGraph * GetParent()

Interrogates the m_pParentGraph member

CHART_API virtual CSize GetPolygonSize(CPoint * points,int nPointCount)

Calculates the width and height of a given polygon from its points

CHART_API double GetLineLength(CPoint ptStart,CPoint ptEnd)

Calculates the length of the line between the two points

CHART_API double GetLineAngle(CPoint ptStart,CPoint ptEnd)

Calculates the angle of ptEnd with respect to ptStart

CHART_API virtual void NotDrawing()

Invalidates the m_bDrawing semaphore

CHART_API virtual void DrawingUsing(CDC *pDC,CWnd *pCWnd)

Informs a component that draw operations are taking place using a specific set of CWnd and CDC pointers

CHART_API virtual BOOL IsDrawing()

Interrogates the m_bDrawing member

CHART_API virtual void DrawWiget(CPoint point,SRGraphStyle *ptrStyle,SRGraphData *pData = NULL)

Draws a graphical token at a point on screen

CHART_API virtual CBitmap* LoadCustomImage()

Override this function to load image from external file

CHART_API virtual void Serialize(CArchive& ar)

Stores or retrieves component information via a CArchive

CHART_API virtual int GetBorderThickness()

Returns the thickness of the component border depending on the border style

CHART_API virtual int GetCustomBorderThickness()

Returns the border thickness if a custom border is selected

CHART_API virtual CRect AdjustRect(CRect r)

Adjusts the rectangle for the current margins and border thicknesses

enum Measurement_type

The measurement standard used in this rectangle

CHART_API virtual SRGraphLabel* GetNewTag()

Returns a new tag or an object derived from SRGraphLabel.

CHART_API virtual BOOL GetCustomBitmapImage(CBitmap *pBitmap)

Allows a custom bitmap to be loaded when all other methods fail.

CHART_API CRect CalcBounds(CPoint *pPoints,int nPointCount)

Calculates the bounding rectangle of a given polygon.

CHART_API void FillRgnEx(CRgn *pRgn,SRGraphStyle *pStyle, DWORD dwType, DWORD dwStyleOverride, CRect rcBound)

Extended FiilRgn function

CHART_API virtual CPen * GetPen(int nPenStyle,int nPenWidth,COLORREF PenColor)

Returns a pointer to a pen that is newly created or that is already in the pen cache

CHART_API virtual void DrawLineEnd(CPoint point,SRGraphStyle *ptrStyle, int nEnd, double dAngle)

Draws fancy line ends on lines and vectors

CHART_API virtual double GetYScreenToPrinterRatio(CDC *pPrinterDC)

Returns the ratio of screen pixels to printer pixels

CHART_API virtual double GetXScreenToPrinterRatio(CDC *pPrinterDC)

Returns the ratio of screen pixels to printer pixels

CHART_API virtual void DrawTag(CPoint point,SRGraphData *pData)

Draws a data tag

CHART_API virtual int GetTagAnnotationCode()

Returns a country code to be used in retrieving strings for data tags from a data object's annotation list

CHART_API virtual SRGCompiledPolygon* LoadPolygon(LPCTSTR strPolygonName,LPCTSTR strSectionName)

Calls the parent graph's LoadPolygon function.

CHART_API virtual BOOL IsCompound()

Returns FALSE

CHART_API virtual BOOL XGInScope(int nIndex, int nGroup)

Checks if specified data item is in scope

CHART_API virtual void DrawDotObject(CPoint point,SRGraphStyle * ptrStyle, SRGraphData *pData=NULL)

Draws a simple dot object

CHART_API virtual void DrawCustomPointObject(CPoint point,SRGraphStyle *ptrStyle,SRGraphData *pData = NULL)

Virtual function to draw custom point objects

CHART_API virtual void GetCustomPenStyle(CPen ** pPen)

Defines custom pen styles for the DrawStyledLine function

CHART_API virtual SRGScope GetScope()

Returns the scope of this component

CHART_API virtual void SetScope(SRGScope s)

Initializes the scope with the provided data

CHART_API virtual void Initialize()

Allows component initialization

CHART_API virtual void SetScope(int nImin,int nImax,int nGmin,int nGmax)

Sets the scope of the component

CHART_API virtual void SetSizeDefaults()

Sets default margin sizes, etc

CHART_API virtual int GetComponentFileVersion(CArchive &ar)

Returns the file version for individual components

CHART_API virtual CScale SetComponentFileVersion()

Sets the file version for individual components

CHART_API virtual CPoint RotatePoint(CPoint p,double dAngle,BOOL bUseRadians=TRUE)

Rotates a point in two dimensions around the origin

protected member functions

bool m_bCompoundMember

Boolean flag that signfies whether a component is a member of a compound list.

CString m_CachedBitmapName

The name of the bitmap fill resource currently cached

CBitmap * m_pBitmapCache

The pointer to the cached bitmap

int m_nLogPixelX

Screen Width in pixel

int m_nLogPixelY

Screen Height in pixel

CPen * m_pAutoPen

The pointer to the auto pen.

SRGraphLabel * m_pLabel

A pointer

CHART_API virtual void HighlightLineStyle(SRGraphStyle *pStyle)

Adjusts line style for highlighting

CHART_API virtual void HighlightWigetStyle(SRGraphStyle *pStyle)

Allows modification of a style for highlighting a wiget

CHART_API virtual void HighlightBarStyle(int index,int group,SRGraphStyle *pStyle)

Allows modification of a style for highlighting a bar

int m_nSerializeVersion

Used to extend the serialization system

CHART_API virtual void DrawFill()

Draws the filled background to this component (if any)

CHART_API virtual void DrawBorder()

Draws the border to this component (if any)

CHART_API virtual void DrawForeground()

Override this virtual function to draw the forground content of this component (if any)

CHART_API virtual void DrawShadow()

Draws a shadow around this component (if any)

CHART_API virtual void AdjustRotation(SRGraphStyle* pStyle, SRGraphLabel* pLabel)

Used to calculate the new position depending upon the rotation and the anchor point