MultiLineCaption.h
上传用户:zhoushen
上传日期:2022-06-15
资源大小:84k
文件大小: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);
-
- virtual LRESULT OnNcCalcSize (BOOL bCalcValidRects, LPNCCALCSIZE_PARAMS lpncsp);
- virtual void OnGetMinMaxInfo (MINMAXINFO FAR* lpMMI);
- virtual void OnWindowPosChanged( WINDOWPOS* lpwndpos );
- virtual void OnMDIActivate ();
- virtual void OnExitSizeMove ();
- virtual void OnSize ( UINT nType, int cx, int cy );
- virtual void OnNcPaint (HRGN hRgn);
- virtual void OnSetText (LPCTSTR lpText);
- virtual BOOL OnNcActivate (BOOL bActive);
-
- private:
- CRect CalcTextRect (int textFormat);
- int GetCaptionHeight();
- LONG GetLineHeight (CDC* pDC);
- int GetChildOffset ();
- void Repaint();
- void AdjustHeight();
- int m_MaxLines; // Maximum lines to wrap caption to
- bool m_InitialShow; // Track first display of caption
- COLORREF m_ActiveSysColor; // Track colours to check for system changes
- COLORREF m_InactiveSysColor; // as MDI windows don't get explicit notification
- };
- #endif