SRGraphTitle Class
class SRGraphTitle: public SRGraphComponent
Title manager derived from SRGraphComponentDefined 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
virtual void DrawForeground()
Draws the text
virtual BOOL UpdateFont()
Keeps font data current
virtual void GetParentContent()
Retrieves pertinent data from the parent
public member functions
virtual int GetLineCount(LPCTSTR lpszText)
Get the number of lines of the text string separated by '\\n'
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
virtual void DrawText(LPCTSTR lpText, LPRECT lpRect)
Draw multiple lines of text vertically centered at the rectangle area
virtual void DrawText(const CString& str, const CRect& rc)
Draw multiple lines of text vertically centered at the rectangle area
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
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
virtual int CalcFontAutoSize()
Calculates the font size based on 90% of the title panel height
virtual void SetMakeFont(BOOL make=TRUE)
Sets or resets the MakeFont semaphore
virtual CSize GetTextDimension(LPCTSTR text)
Returns logical size of text
virtual CSize GetTextDimension(LPCTSTR text, BOOL bWrapText, int nWrapWidth=0)
Returns logical size of text with optional wordwrap
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)
int GetFontSize()
Fetches the font size data
inline int GetFontStyle()
Fetches the font style data
inline int GetJustification()
Fetches the font justification
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
virtual void SetFaceName(CString& FaceName)
Sets the typeface name (ie. "Times New Roman")
virtual CString& GetFaceName()
Fetches the type face name currently in use
virtual int ReadTemplateLine(LPCTSTR line)
Reads and parses a chart template line
virtual void WriteName(CStdioFile* file)
Writes the name "title" to the template file
virtual void WriteFontParameters(CStdioFile* file)
Outputs the current font details to the template file
virtual void Serialize(CArchive &ar)
Stores or retrieves information about the title via a CArchive
virtual ~SRGraphTitle()
Destructor -- ensures that no GDI objects remain
virtual BOOL SetFont(int nSize,int nStyle,CString FaceName)
Sets font size, style, and typeface
virtual void SetText(LPCTSTR text,int justification=0)
Modifies the contents of the text
virtual void SetTextColor(COLORREF color)
Sets the color of text displayed to an RGB value