SRGraphComponent Class
class SRGraphComponent: public CObject
Base class for graphical componentsDefined 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
virtual void DrawCustomBorder()
Draws custom borders
virtual void DrawCustomShadow()
Draws custom shadows
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
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
Constructor
virtual ~SRGraphComponent()
Destructor
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
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
virtual void GetParentContent()
Retrieves pertinent data from the parent graph
virtual double GetYMargin()
Interrogates the device independent Y margin value
virtual double GetXMargin()
Interrogates the device independent X margin value
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
virtual void SetIndexStep(int v)
Sets the number of data objects (indices) per data series
virtual int GetIndexStep()
Retrieves the number of data objects (indices) per data series
virtual void SetGroupStep(int v)
Sets the number of groups per data series
virtual int GetGroupStep()
Retrieves the number of groups per data series
inline UINT GetType()
Fetches the type of the component (ie. background, title, etc.)
virtual void SetParent(SRGraph *pParent)
Initializes the pointer to the SRGraph which owns this object
virtual void SetResourceName(LPCTSTR name)
Initializes the name of the bitmap resource used to tile the background
virtual void SetAngle(int angle)
Initializes the m_Angle member
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
virtual void SetRect(const CRect& r)
Initializes the device independant rectangle from a CRect
virtual void SetRect(double l, double t, double r, double b)
Initializes the device independant rectangle with floating point coordinates
virtual void SetRect(const SRGraphRect& r)
Initializes the device independant rectangle with the contents of a second
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
virtual CRect GetLogRect()
Returns device independent rectangle specified by SetRect() -- overidden by resizeable components
virtual CRect GetLogRect()
Returns the logical (device dependent) rectangle for this component -- CRect(0,0,0,0) if not available
virtual void SetMeasurement(int m=PIXELS)
Initializes the measurement mode of the m_Rect data member (0=pixels, 1=millimeters, 2=inches, 3=percentage)
virtual void Draw(CDC *pDC,CWnd *pCWnd)
Called by the CWnd managing the display of graph data to draw the graph
virtual void FillPoly(LPPOINT points,int nCount,SRGraphStyle *style,DWORD StyleOverride)
Fills a polygon held in an array of points according to a style
virtual void FramePoly(LPPOINT points,int nCount,SRGraphStyle *style,DWORD StyleOverride)
Frames a polygon held in an array of points according to a style
virtual void FrameRgn(CRgn *rgn,SRGraphStyle *style,DWORD type,DWORD StyleOverride)
Frames a predefined region according to a style
virtual void FillRgn(CRgn *rgn,SRGraphStyle *style,DWORD type,DWORD StyleOverride=0)
Fills a predefined region according to a style
virtual void ProcessHint(CWnd *pCWnd)
Decides which areas of the display need to be invalidated after a CWnd::OnUpdate with a hint
static int __cdecl qsSorterCompareA(const void *a,const void *b)
Callback routine for the qsort function
static int __cdecl qsSorterCompareD(const void *a,const void *b)
Callback routine for the qsort function.
virtual int ReadTemplateLine(LPCTSTR line)
Reads the parameters for this component from the template line
virtual int ReadBasicParameters(LPCTSTR line)
Reads the basic rectangle and component fill, border, and shadow parameters for all components
virtual void WriteComponent(CStdioFile* file)
Writes the component to a template file
virtual void WriteName(CStdioFile* file)
Writes this component name to a template file
virtual void WriteFontParameters(CStdioFile* file)
Writes font details of this component to a template file
virtual void WriteMainParameters(CStdioFile* file)
Writes the main details for this component to a template file
virtual void WriteSpecificParameters(CStdioFile* file)
Writes specific details of this component to a template file
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
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
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.
virtual void DrawBar(CPoint topleft,CPoint bottomright, int group, int index,SRGraphStyle* ptrStyle,DWORD dwStyleOverride=0,SRGraphData *pData=NULL)
Draws bars for bar graphs
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
virtual void SetCountryCode(int c=1)
Sets the m_nCountryCode member
virtual int GetCountryCode()
Interrogates the m_nCountryCode member
inline SRGraph * GetParent()
Interrogates the m_pParentGraph member
virtual CSize GetPolygonSize(CPoint * points,int nPointCount)
Calculates the width and height of a given polygon from its points
double GetLineLength(CPoint ptStart,CPoint ptEnd)
Calculates the length of the line between the two points
double GetLineAngle(CPoint ptStart,CPoint ptEnd)
Calculates the angle of ptEnd with respect to ptStart
virtual void NotDrawing()
Invalidates the m_bDrawing semaphore
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
virtual BOOL IsDrawing()
Interrogates the m_bDrawing member
virtual void DrawWiget(CPoint point,SRGraphStyle *ptrStyle,SRGraphData *pData = NULL)
Draws a graphical token at a point on screen
virtual CBitmap* LoadCustomImage()
Override this function to load image from external file
virtual void Serialize(CArchive& ar)
Stores or retrieves component information via a CArchive
virtual int GetBorderThickness()
Returns the thickness of the component border depending on the border style
virtual int GetCustomBorderThickness()
Returns the border thickness if a custom border is selected
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
virtual SRGraphLabel* GetNewTag()
Returns a new tag or an object derived from SRGraphLabel.
virtual BOOL GetCustomBitmapImage(CBitmap *pBitmap)
Allows a custom bitmap to be loaded when all other methods fail.
CRect CalcBounds(CPoint *pPoints,int nPointCount)
Calculates the bounding rectangle of a given polygon.
void FillRgnEx(CRgn *pRgn,SRGraphStyle *pStyle, DWORD dwType, DWORD dwStyleOverride, CRect rcBound)
Extended FiilRgn function
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
virtual void DrawLineEnd(CPoint point,SRGraphStyle *ptrStyle, int nEnd, double dAngle)
Draws fancy line ends on lines and vectors
virtual double GetYScreenToPrinterRatio(CDC *pPrinterDC)
Returns the ratio of screen pixels to printer pixels
virtual double GetXScreenToPrinterRatio(CDC *pPrinterDC)
Returns the ratio of screen pixels to printer pixels
virtual void DrawTag(CPoint point,SRGraphData *pData)
Draws a data tag
virtual int GetTagAnnotationCode()
Returns a country code to be used in retrieving strings for data tags from a data object's annotation list
virtual SRGCompiledPolygon* LoadPolygon(LPCTSTR strPolygonName,LPCTSTR strSectionName)
Calls the parent graph's LoadPolygon function.
virtual BOOL IsCompound()
Returns FALSE
virtual BOOL XGInScope(int nIndex, int nGroup)
Checks if specified data item is in scope
virtual void DrawDotObject(CPoint point,SRGraphStyle * ptrStyle, SRGraphData *pData=NULL)
Draws a simple dot object
virtual void DrawCustomPointObject(CPoint point,SRGraphStyle *ptrStyle,SRGraphData *pData = NULL)
Virtual function to draw custom point objects
virtual void GetCustomPenStyle(CPen ** pPen)
Defines custom pen styles for the DrawStyledLine function
virtual SRGScope GetScope()
Returns the scope of this component
virtual void SetScope(SRGScope s)
Initializes the scope with the provided data
virtual void Initialize()
Allows component initialization
virtual void SetScope(int nImin,int nImax,int nGmin,int nGmax)
Sets the scope of the component
virtual void SetSizeDefaults()
Sets default margin sizes, etc
virtual int GetComponentFileVersion(CArchive &ar)
Returns the file version for individual components
virtual CScale SetComponentFileVersion()
Sets the file version for individual components
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
virtual void HighlightLineStyle(SRGraphStyle *pStyle)
Adjusts line style for highlighting
virtual void HighlightWigetStyle(SRGraphStyle *pStyle)
Allows modification of a style for highlighting a wiget
virtual void HighlightBarStyle(int index,int group,SRGraphStyle *pStyle)
Allows modification of a style for highlighting a bar
Used to extend the serialization system
virtual void DrawFill()
Draws the filled background to this component (if any)
virtual void DrawBorder()
Draws the border to this component (if any)
virtual void DrawForeground()
Override this virtual function to draw the forground content of this component (if any)
virtual void DrawShadow()
Draws a shadow around this component (if any)
virtual void AdjustRotation(SRGraphStyle* pStyle, SRGraphLabel* pLabel)
Used to calculate the new position depending upon the rotation and the anchor point