2025-11-27 16:46:48 +09:00

39 lines
3.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\froman Times New Roman;}{\f3\froman\fprq2 Times New Roman;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\deflang1033\horzdoc{\*\fchars }{\*\lchars }\pard\qc\plain\f3\fs28\cf1\b COXHookWnd & COXHookWndMap
\par \pard\plain\f3\fs20
\par Generic class to hook messages on behalf of a CWnd.
\par Once hooked, all messages go to COXHookWnd::WindowProc before going to the window. Specific subclasses can trap messages and do something. To use:
\par
\par \pard\li360\fi-360\tx360{\*\pn\pnlvlblt\pnf1\pnindent360{\pntxtb\'b7}}\plain\f3\fs20 {\pntext\f1\'b7\tab}Derive a class from COXHookWnd.
\par {\pntext\f1\'b7\tab}Override COXHookWnd::WindowProc to handle messages. Make sure you call COXHookWnd::WindowProc if you don't handle the message, or your window will never get messages. If you write separate message handlers, you can call Default() to pass the message to the window.
\par {\pntext\f1\'b7\tab}Instantiate your derived class somewhere and call HookWindow(pWnd) to hook your window, AFTER it has been created. To unhook, call UnhookWindow().
\par \pard\plain\f3\fs20
\par The message hook map (class COXHookWndMap) is derived from CMapPtrToPtr, which associates a pointer with another pointer. It maps an HWND to a COXHookWnd, like the way MFC's internal maps map HWND's to CWnd's. The first hook attached to a window is stored in the map; all other hooks for that window are then chained via COXHookWnd::m_pNext.
\par
\par
\par \pard\qc\plain\f3\fs28\cf1\b COXCaptionInfo & COXCaptionPainter
\par \plain\f3\fs20
\par \pard\plain\f3\fs20 Class COXCaptionInfo defines caption attributes. Among them are:
\par \pard\li360\fi-360\tx360{\*\pn\pnlvlblt\pnf1\pnindent360{\pntxtb\'b7}}\plain\f3\fs20 {\pntext\f1\'b7\tab}background color
\par {\pntext\f1\'b7\tab}gradient or plain filling
\par {\pntext\f1\'b7\tab}gradient alignment (can be right, left and center)
\par {\pntext\f1\'b7\tab}gradient algorithm (can be linear or squared)
\par {\pntext\f1\'b7\tab}number of color shades used for gradient filling
\par {\pntext\f1\'b7\tab}font used to draw window's text
\par {\pntext\f1\'b7\tab}window's text color
\par {\pntext\f1\'b7\tab}text output format
\par \pard\plain\f3\fs20
\par COXCaptionPainter class heavily uses this class. The main feature of this class is that it is serializable. That means that you can save caption info in a file or registry.
\par
\par COXCaptionPainter is a generic caption painter. Derived from COXHookWnd - generic class that is used to subclass any CWnd and provides capability to handle any message routed to the hooked window before it. Handles WM_NCPAINT, WM_NCACTIVATE, and whole bunch of other messages to handle drawing custom captions. To use it:
\par \pard\tx1440\plain\f3\fs20
\par \pard\li360\fi-360\tx1440{\*\pn\pnlvlblt\pnf1\pnindent360{\pntxtb\'b7}}\plain\f3\fs20 {\pntext\f1\'b7\tab}call Attach from your window's OnCreate function.
\par {\pntext\f1\'b7\tab}to set caption properties create COXCaptionInfo object or get associated one using GetCaptionInfo() function. COXCaptionPainter uses different COXCaptionInfo object for active and inactive state.
\par {\pntext\f1\'b7\tab}change any COXCaptionInfo properties you want to.
\par {\pntext\f1\'b7\tab}set updated COXCaptionInfo object to COXCaptionPainter object using SetCaptionInfo() function.
\par {\pntext\f1\'b7\tab}invalidate window's caption using SendMessage(WM_NCPAINT) in order to redraw it
\par \pard\plain\f3\fs20
\par \pard\plain\f2\fs20
\par }