MultiLineCaption.h
上传用户:kssdz899
上传日期:2007-01-08
资源大小:79k
文件大小:2k
- #ifndef _MULTILINE_CAPTION_H
- #define _MULTILINE_CAPTION_H
- ////////////////////////////////////////////////////////////////
- //
- // class CMultiLineCaption
- //
- // Multi-line auto-wrap caption painter.
- //
- // To use:
- // - call Install from your frame's OnCreate function.
- // - Set a custom CaptionBackground if desired
- // - Set custom TextAttributes if required
- //
- // If you are drawing custom caption buttons, you must handle WM_NCLBUTTONDOWN & co.
- // yourself. CMultiLineCaption does not handle the mouse for custom caption buttons.
- //
- // Author: Dave Lorde (dlorde@cix.compulink.co.uk)
- //
- // Copyright January 2000
- //
- //
- ////////////////////////////////////////////////////////////////
- //
- #include "Caption.h"
- class AFX_EXT_CLASS CMultiLineCaption : public CCaption
- {
- public:
- CMultiLineCaption(int maxLines = 5);
- void SetMaxLines(int maxLines);
- int GetMaxLines() const;
- virtual void Refresh();
- protected:
- DECLARE_DYNAMIC(CMultiLineCaption);
- void PaintText (CDC* pDC);
- CRect GetCaptionRect ();
- virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
-
- void OnNcCalcSize (BOOL bCalcValidRects, LPNCCALCSIZE_PARAMS lpncsp);
- void OnShowWindow (BOOL bShow, UINT nStatus);
- void OnGetMinMaxInfo (MINMAXINFO FAR* lpMMI);
- void OnSetText (LPCTSTR lpText);
- void OnWindowPosChanged( WINDOWPOS* lpwndpos );
- void OnMDIActivate ();
- private:
- CRect CalcTextRect (int textFormat);
- int GetCaptionHeight();
- LONG GetLineHeight (CDC* pDC);
- int GetChildOffset ();
- int m_MaxLines; // Maximum lines to wrap caption to
- bool m_InitialShow; // Track first display of caption
- };
- #endif