SRGraphLegend Class

class SRGraphLegend: public SRGraphTitle

Handles painting of the legend panel and inherits font management from the SRGraphTitle class

Defined in: SRGraphLegend.h

Class Members

Protected data members

int m_nKeyHeight

Stores the height of the key items between passes.

SRGDisplayBase * m_pDisplay

Pointer to the SRGDisplayBase to which this legend has locked itself (do not alter)

CRect m_LegendRect

Basic rectangle of the legend panel

BOOL m_bKeepTop

Semaphore to prevent moving the horizontal origin of the rectangle during auto resizing

BOOL m_bKeepLeft

Semaphore to prevent moving the vertical origin of the rectangle during auto resizing

BOOL m_bAutoSizeX

Semaphore to prevent changing the height of the rectangle during auto resizing

BOOL m_bAutoSizeY

TRUE if the legend is to automatically extend its bottom boundary to contain the list

BOOL m_bResize

Semaphore to resize the component rectangle to fit the legend data

SRGraphRect m_FinalRect

The final, resized component rectangle in device independent coordinates

BOOL m_bSizeForeground

Semaphore signifying a demand to recalculate the component size -- see DrawForeground

double m_dKeySize

Width of key data

int m_nKeyCount

Count of the number of keys currently in this legend.

int m_nMaxChar

Count of max number of character that will display in the annotation text

int m_nMaxLine

Count of the maximum number of lines the legend will display

Protected member functions

CHART_API virtual void DrawForeground()

Draws text or recalculates the size of the component

CHART_API virtual void DrawKey(CPoint topleft,CPoint bottomright, int index, int group, int CurrentKey)

Draws legend keys onto the component

CHART_API virtual int CalcKeySize()

Calculates size of graphic keys

CHART_API virtual void DrawCustomKey(CPoint topleft,CPoint bottomright,int group,int index,SRGraphStyle *ptrStyle)

Customization system for legend keys

CHART_API virtual void SetCustomLegendSteps()

Sets the group and index stepping interval for legends

CHART_API DWORD GetLegendStyle()

Retrieves the legend style replacing CX_LEGEND_AUTOMATIC with an appropriate style

CHART_API virtual CSize CalcCharSize(CFont* pFont)

Return the size of a typical character in font pFont

public member functions

inline void SetKeyAnnotationCharCount(int nChar)

Sets the number of char that will displayed in the key annotation

inline int GetKeyAnnotationCharCount()

Get the number of char that will displayed in the key annotation

inline void SetKeyAnnotationLineCount(int nLineCount)

Sets the maximum number of lines in the legend keys.

inline int GetKeyAnnotationLineCount()

Returns the maximum number of lines in the legend keys.

CHART_API virtual void SetSizeDefaults()

Sets default key size according to measurement mode

CHART_API virtual int CalcFontAutoSize()

Calculates font size for the legend class

CHART_API virtual CScale SetComponentFileVersion()

NEW 6.01 SP1 The legend has a new file setting.

CHART_API virtual void WriteSpecificParameters(CStdioFile *f)

Writes special legend parameters to a template file

CHART_API virtual int ReadTemplateLine(LPCTSTR line)

Reads a legend line from a template file

CHART_API virtual void WriteName(CStdioFile *file)

Writes the object's name to a template file

CHART_API virtual ~SRGraphLegend()

Destructor

CHART_API void SetKeySize(double keysize)

Initializes the size of graphic keys

inline double GetKeySize()

Retrieves the size of the graphic keys

enum AutoSize_Flags

Bit flags used by SetAutoSize()

CHART_API virtual void SetAutoSize(int sizebits)

Initializes the auto-sizing flags

inline virtual void SetResize(BOOL b=TRUE)

Set TRUE if the legend component rectangle is to be resized to fit the legend data

inline virtual BOOL GetResize()

Returns TRUE if the legend component rectangle is resizable

CHART_API virtual SRGraphRect CalcFinalRect(CDC *pDC,CWnd *pCWnd)

Returns actual, resized component rectangle -- can be called outside of draw cycle

inline SRGraphRect GetFinalRect()

Returns actual, resized component rectangle determined by previous call to Draw() or CalcFinalRect()

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

Overrides SRGraphComponent::Draw to enable automatic resizing

CHART_API virtual void GetParentContent()

Retrieves pertinent data from the parent SRGraph

CHART_API SRGraphLegend()

Constructor

CHART_API virtual void Serialize(CArchive& ar)

To store or retrieve information via a CArchive