SRGraphView Class

class SRGraphView: public CView

Specialized view class for the display and management of SRGraph objects
This CView-based class simply adds graph feedback, data dragging, and data zooming to your graph and chart applications.

Defined in: GraphVw.h

Developer Notes

The classes for PageSetup, PageSetup2, and CSelectQuery are also in the files of this class.

Class Members

BOOL m_bUseMaxArea

Set TRUE if the page should be limited in size during printing

int m_nValign

Vertical alignment code for print pagination

int m_nHalign

Horizontal alignment code for print pagination

int m_nPageSizeCode

Code for selected page sizes

int m_nPrintUnit

Unit for dimensions in PageSetup2 dialog: 0-cm, 1-inch

double m_dXOffset

Horizontal margin for printing

double m_dYOffset

Vertical margin for printing

double m_dXSize

Horizontal chart size for printing

double m_dYSize

Vertical chart size for printing

int m_nPageCountX

Number of pages required to print chart in horizontal direction - internal

int m_nPageCountY

Number of pages required to print chart in vertical direction - internal

SEC_UINT m_TimerIdent

Mouse timer identifier

SRGraphTip m_GraphTip

The single graph tip object

int m_nUnzoomMinIndex

Original minimum index (used for unzooming data)

int m_nUnzoomMaxIndex

Original maximum index (used for unzooming data)

int m_nUnzoomMinGroup

Original minimum group (used for unzooming data)

int m_nUnzoomMaxGroup

Original maximum group (used for unzooming data)

SRGraphComponent * m_pZoomedDisplay

Pointer to the display which has been zoomed (used in restoration of the original state)

BOOL m_bZoomed

TRUE if the graph has been zoomed (used to activate the unzoom menu command via the command update interface)

BOOL m_bShowingTip

TRUE if a graph tip is currently on display

CPoint m_SelectionPointA

First point in a selection area

CPoint m_SelectionPointB

Last point in a selection area

BOOL m_bSelecting

TRUE if the graph is in selection box mode

BOOL m_bInFeedback

TRUE if the mouse point was clicked inside a feedback area (data dragging will commence)

int m_nDragIndex

Index of the data item being dragged

int m_nDragGroup

Group of the data item being dragged

BOOL m_bDragging

TRUE if dragging is in progress

CPoint m_MousePoint

Stored mouse position (used to ascertain if the mouse has rested still for the requisite 1.5 seconds)

BOOL m_bMouseTimerIsRunning

TRUE if the mouse is considered to be "still" and the timeout is waiting to fire

BOOL m_bZoomable

Flag to define the charts ability to be zoomed -- TRUE enables zooming

BOOL m_bDragable

Flag which specifies whether data may be dragged

BOOL m_bHasDocument

Flag to signify whether this view has a document

SRGDisplayBase * m_pDragDisplay

Pointer to store the graph component

CHART_DECLARE_DYNCREATE(SRGraphView)

Constructor

CHART_API virtual void SetDragTips(BOOL v)

Set or resets the m_bDragTips flag

CHART_API virtual BOOL GetDragTips()

Return the m_bDragTips flag

CHART_API virtual void SetDragable(BOOL v)

Sets or resets the m_bDragable flag

CHART_API virtual BOOL GetDragable()

Returns the m_bDragable flag

CHART_API virtual void SetZoomable(BOOL v)

Sets or resets the flag signifying whether this chart is able to zoom

CHART_API virtual BOOL GetZoomable()

Returns the zoom enable flag

CHART_API virtual void DrawSelection(CPoint point)

Draws a selecting box

CHART_API virtual void DrawCustomSelection(CPoint point)

Override this function to draw your own selection styles

CHART_API virtual void MouseDrag(int nFlags,CPoint point)

Handles data dragging and selection box display

CHART_API CGraphDoc* GetDocument()

Returns the document for this view

CHART_API virtual void SetHasDocument(BOOL v)

Sets or resets the m_bHasDocument flag

CHART_API virtual BOOL GetHasDocument()

Returns the m_bHasDocument flag

inline void SetUseMaxArea(BOOL b)

Enables or disables the use of the maximum size rectangle

CHART_API virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL)

Draws the graph

CHART_API virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL)

Sets window to viewport mapping

CHART_API virtual BOOL OnPreparePrinting(CPrintInfo* pInfo)

Prepares the print job

CHART_API virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)

Performs print pagination and outputs the graph to the printer

CHART_API virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)

Completes printing and terminates print mode

CHART_API virtual void DrawToBitmap(CDC* pDC, CBitmap& bmp)

Render the chart into the passed bitmap

CHART_API virtual SRGraphPosition * GetPosition(SRGraph *pGraph,CPoint point)

Returns a SRGraphPosition object in response to a mouse event -- override

CHART_API virtual ~SRGraphView()

Destructor

CHART_API virtual void AssertValid() const

Standard debug code

CHART_API virtual void Dump(CDumpContext& dc) const

Standard debug code

CHART_API virtual SRGraph * GetGraph()

Returns a pointer to the graph object which this view displays and interfaces to

CHART_API virtual void ShowFeedback(SRGraphFeedback *pFeedback)

Displays a feedback chart tip -- override

CHART_API virtual void SaveToFileAsDib(LPCTSTR lpszFileName)

Saves current view as a DIB file.

CHART_API virtual void SaveToFileAsJpeg(LPCTSTR lpszFileName)

Saves the current view's image as a JPEG

CHART_API virtual void GraphZoomout(BOOL bAlltheWay)

Helper function that implements the ZoomOut and ZoomOutAll features

BOOL m_bDragTips

Semaphore for the draging tips

CObStack m_ZoomStack

First-in last-out stack of zoomed states

CPalette m_Palette

Color palette

DWORD m_dwOldAlignment

Retains the old alignment codes during printing

CRect m_OldAreaRect

Retains the old alignment rectangle during printing

BOOL m_bPreserveArea

Set TRUE if the area should be restored after printing

CHART_API afx_msg BOOL OnEraseBkgnd(CDC* pDC)

Does nothing

CHART_API afx_msg void OnMouseMove(UINT nFlags, CPoint point)

Handles mouse movement and chart tip triggering

CHART_API afx_msg void OnLButtonDown(UINT nFlags, CPoint point)

Handles mouse button press

CHART_API afx_msg void OnLButtonUp(UINT nFlags, CPoint point)

Handles mouse button release

CHART_API afx_msg void OnTimer(SEC_UINT nIDEvent)

Checks to see if a chart tip is needed

CHART_API afx_msg void OnEditCopy()

Copies the image to the clipboard

CHART_API afx_msg void OnGraphZoomout()

Returns zoomed graph to previous size

CHART_API afx_msg void OnUpdateGraphZoomout(CCmdUI* pCmdUI)

Activates or deactivates the zoom out button and menu items

CHART_API afx_msg void OnGraphZoomoutAll()

Returns zoomed graph to normal, unzoomed state

CHART_API afx_msg void OnUpdateGraphZoomoutAll(CCmdUI* pCmdUI)

Activates or deactivates the Zoom Out All button and menu items

CHART_API afx_msg void OnGraphPagesetup()

Runs a simple pagination dialog

CHART_API afx_msg void OnGraphEdit()

Edits a graph using the Graph Explorer

CHART_API afx_msg void OnSaveAsDib()

Message handler for the Save As DIB menu item

CHART_API afx_msg void OnSaveAsJpeg()

Message handler for the Save As JPEG menu item

CHART_API afx_msg void OnGraphWizard()

Invokes the chart wizard

CHART_API afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct )

Creation initialization

CHART_API afx_msg BOOL OnQueryNewPalette()

Palette management

CHART_API afx_msg void OnPaletteChanged(CWnd* pFocusWnd)

Palette management