SRGraphTitle Class

class SRGraphTitle: public SRGraphComponent

Title manager derived from SRGraphComponent

Defined in: SRGraphTitle.h

Class Members

protected data members

int m_nJustification

Type of text justification to use

CString m_strTitle

Title text

CFont m_Font

Font in which to display text

COLORREF m_RGBTextColor

Color of the text

BOOL MakeFont

Semaphore which signifies that a font has been set or that an existing font needs updating

int m_nSize

Font size -- negative numbers set sizes in pixels, positive numbers set sizes in points

int m_nStyle

Style of font

CString m_strFaceName

Font typeface

BOOL m_bUseOwnText

Flags display of internal text (SetText) or parent's text (GetParentText)

Protected member functions

LOGFONT * m_pLogFont

A pointer to an optional LOGFONT that will define the font

CHART_API virtual void DrawForeground()

Draws the text

CHART_API virtual BOOL UpdateFont()

Keeps font data current

CHART_API virtual void GetParentContent()

Retrieves pertinent data from the parent

public member functions

CHART_API virtual int GetLineCount(LPCTSTR lpszText)

Get the number of lines of the text string separated by '\\n'

CHART_API virtual int ComputeLineBreaks( LPCTSTR text, int nCount, LPRECT rc, BOOL bWrapText, int* LineBreaks, int* LineLengths, int nMaxBreaks)

Searches the text for new line characters ('\\r' or "\\r\\n") and computes where lines should be broken (word wrap) to fit the text in the specified rectangle

CHART_API virtual void DrawText(LPCTSTR lpText, LPRECT lpRect)

Draw multiple lines of text vertically centered at the rectangle area

CHART_API virtual void DrawText(const CString& str, const CRect& rc)

Draw multiple lines of text vertically centered at the rectangle area

CHART_API virtual void DrawText(const CString &str, const CRect &rc, BOOL bWrapText)

Draw multiple lines of text vertically centered at the rectangle area optionally wrapping text

inline void SetUseOwnText(BOOL b)

Flag to decide if this component use parent's title text or its own

inline BOOL GetUseOwnText()

Get the flag about whether to use its own text or from the parent graph

CHART_API virtual void SetLogFont(LOGFONT * v)

Initializes the font using the supplied LOGFONT

inline LOGFONT * GetLogFont()

Returns a pointer to the LOGFONT stored in this object

CHART_API virtual int CalcFontAutoSize()

Calculates the font size based on 90% of the title panel height

CHART_API virtual void SetMakeFont(BOOL make=TRUE)

Sets or resets the MakeFont semaphore

CHART_API virtual CSize GetTextDimension(LPCTSTR text)

Returns logical size of text

CHART_API virtual CSize GetTextDimension(LPCTSTR text, BOOL bWrapText, int nWrapWidth=0)

Returns logical size of text with optional wordwrap

CHART_API SRGraphTitle()

Constructor

inline void SetFontSize(int Size)

Sets the point or pixel size of the current font

inline void SetFontStyle(int style)

Sets the style of the font (ie. bold, underline, etc.)

inline void SetJustification(int Justification)

Sets the font justification to left (0), right (1) or centered (2)

CHART_API int GetFontSize()

Fetches the font size data

inline int GetFontStyle()

Fetches the font style data

inline int GetJustification()

Fetches the font justification

CHART_API virtual COLORREF GetTextColor()

Fetches the RGB color used to display text

inline CString& GetText()

Returns the title text itself

inline CFont* GetFont()

Fetches a pointer to the m_Font (CFont) object from this component

CHART_API virtual void SetFaceName(CString& FaceName)

Sets the typeface name (ie. "Times New Roman")

CHART_API virtual CString& GetFaceName()

Fetches the type face name currently in use

CHART_API virtual int ReadTemplateLine(LPCTSTR line)

Reads and parses a chart template line

CHART_API virtual void WriteName(CStdioFile* file)

Writes the name "title" to the template file

CHART_API virtual void WriteFontParameters(CStdioFile* file)

Outputs the current font details to the template file

CHART_API virtual void Serialize(CArchive &ar)

Stores or retrieves information about the title via a CArchive

CHART_API virtual ~SRGraphTitle()

Destructor -- ensures that no GDI objects remain

CHART_API virtual BOOL SetFont(int nSize,int nStyle,CString FaceName)

Sets font size, style, and typeface

CHART_API virtual void SetText(LPCTSTR text,int justification=0)

Modifies the contents of the text

CHART_API virtual void SetTextColor(COLORREF color)

Sets the color of text displayed to an RGB value