SingleLineCaption.h
上传用户:zhoushen
上传日期:2022-06-15
资源大小:84k
文件大小:2k
- #ifndef _SINGLELINECAPTION_H
- #define _SINGLELINECAPTION_H
- ////////////////////////////////////////////////////////////////
- //
- // class CSingleLineCaption
- //
- // Generic caption painter. Handles WM_NCPAINT, WM_NCACTIVATE, etc. to
- // handle drawing custom captions. To use it:
- //
- // - call Install from your frame's OnCreate function.
- // - Set a custom CaptionBackground if desired
- // - Set custom TextAttributes if required
- //
- // Derive from this class for custom single line caption layouts.
- //
- // If you are drawing custom caption buttons, you must handle WM_NCLBUTTONDOWN & co.
- // yourself. CSingleLineCaption does not handle the mouse for custom caption buttons.
- //
- // Author: Dave Lorde (dlorde@cix.compulink.co.uk)
- //
- // Copyright January 2000
- //
- // - based on a 1997 Microsoft Systems Journal
- // C++ Q&A article by Paul DiLascia.
- //
- ////////////////////////////////////////////////////////////////
- //
- #include "Caption.h"
- // forward declarations
- class CCaptionBackground;
- class CCaptionTextAttributes;
- class AFX_EXT_CLASS CSingleLineCaption : public CCaption
- {
- public:
- CSingleLineCaption();
- BOOL Install(CWnd* pWnd);
- void SetIcon(HICON hIcon = 0); // For dialogs
- protected:
- HICON m_hIcon;
- DECLARE_DYNAMIC(CSingleLineCaption);
- // Helpers
- //
- int GetIconWidth();
- // Override these in derived classes if necessary
- //
- virtual int PaintIcon(CDC* pDC = 0);
- // Paul DiLascia says:
- // "These are similar to, but NOT the same as the equivalent CWnd fns. Don't
- // override unless you're a guru, and even THEN I wouldn't recommend it."
- virtual LRESULT WindowProc (UINT msg, WPARAM wp, LPARAM lp);
- virtual BOOL OnNcActivate (BOOL bActive);
- };
- #endif