unit Wordcap;
{**********************************************************************}
{** WordCap  - provides a gradient filled caption bar, with Italic   **}
{**            text, in the style of MSOffice for Win95.             **}
{** ---------------------------------------------------------------- **}
{** Author   - Warren F. Young.                                      **}
{**            Portions of code were taken from Brad D. Stowers.     **}
{**            Brad acknowledged assistance from Michiel Ouwehand of **}
{**            Epic MegaGames.                                       **}
{** e-mail   - wfy@ee.ed.ac.uk,                                      **}
{** WWW      - http://www.ee.ed.ac.uk/~wfy/components.html           **}
{**            If the above email does not work then (and only then) **}
{**            try this e-mail address:  WMYoung@compuserve.com      **}
{** ---------------------------------------------------------------- **}
{** Suggested Usage                                                  **}
{**          - For a 32-bit installation you need the files          **}
{**            wordcap.pas and wordcap.dcr.                          **}
{**          - For a 16-bit installation you need the files          **}
{**            wordcap.pas and wrdcap16.dcr (renamed to Wordcap.dcr).**}
{**          - Install the component "WordCap.pas" into Delphi.      **}
{**          - Place the component on your form. (MSOfficeCaption)   **}  
{**          - Set the parameters in the object inspector            **}
{**          - You have a shaded caption bar - LIVE AT DESIGN TIME!! **}
{** ---------------------------------------------------------------- **}
{** History  - Version 1.00  (23/July/1996). Initial release (WWW).  **}
{**          - Version 1.01  (06/August/1996). Fixed a system        **}
{**              resources bug caused by (bmp.left > bmp.right).     **}
{**          - Version 1.02  (09/August/1996).                       **}
{**          - Version 1.03  (15/August/1996).                       **}
{**              with 32bit calls from 16bit apps (if available).    **}
{**          - Version 1.04  (15/August/1996).                       **}
{**              with fixed up AutoHeight routine.                   **}
{**          - Version 1.05  (20/August/1996).                       **}
{**              with AppNameText property.                          **}
{**          - Version 1.06  (30/August/1996).                       **}
{**              with improved AUTO option for Position property.    **}
{**          - Version 1.10  (1/October/1996).                       **}
{**              re-Released on WWW.  First official release.        **}
{**              Sent to Delphi SuperPage and Torry's Delphi Pages.  **}
{**          - Version 1.11  (6/November/1996).                      **}
{**              Fixed problem with large borders on windows.        **}
{**          - Version 1.2   (17/December/1996).                     **}
{**              Fixed problem flickering (in 32bit version only).   **}
{**          - Version 1.21  (19/December/1996).                     **}
{**              Fixed drawing problems (in 32bit version only)      **}
{**              when using geWhenActive, and changing the caption.  **}
{**          - Version 1.22  (22/December/1996).                     **}
{**              Fixed drawing problems in WinNT 4.x.  Fixed some    **}
{**              but not all MDI child drawing problems.             **}
{**          - Version 1.23  (24/December/1996)                      **}
{**              Fixed more MDI drawing problems, and offered a      **}
{**              band-aid for another.                               **}
{**          - Version 1.24  (26/December/1996)                      **}
{**              Corrected another MDI drawing problem, and tidied   **}
{**              up the code a bit.                                  **}
{**          - Version 1.25  (28/December/1996)                      **}
{**              Removed flicker on NCActivate Message.  Removed     **}
{**              autoupdating (after property changes) at run-time.  **}
{**          - Version 1.26  (02/January/1997)                       **}
{**              Improved the icon painting routine for the 32 bit   **}
{**              version.  16 bit version left the same.             **}
{**          - Version 1.27  (03/January/1997)                       **}
{**              Moved 16 bit type declarations & global variables   **}
{**              to the implementation section.                      **}
{**          - Version 1.28  (11/January/1997)                       **}
{**              Tidied up a bit.  Added GetWindowRgn_NoCaption.     **}
{**          - Version 1.29  (13/January/1997)                       **}
{**              Added a caption refresh when destroying.            **}
{**          - Version 1.30  (24/January/1997)                       **}
{**              Removed MyOwner.Refresh (very minor).               **}
{**              Reduced spacing between successive caption parts.   **}
{**              Sent to Delphi SuperPage and Torry's Delphi Pages.  **}
{**          - Version 1.31  (28/January/1997)                       **}
{**              Fixed 32-bit problem of drawing active after being  **}
{**              deactivated - (e.g. when focus went to the desktop).**}
{**              Added 16-bit access to 32-bit drawing routines for  **}
{**              icon drawing but not for regions/flicker control.   **}
{**          - Version 1.32  (20/February/1997)                      **}
{**              Fixed 32-bit problem of caption flicker when the    **}
{**              CaptionText.Caption property was changed at         **}
{**              run-time.                                           **}
{**          - Version 1.33  (28/February/1997)                      **}
{**              Added Freeze/UnFreeze routines to simplify updating **}
{**              the caption without flickering - useful for MDI     **}
{**              apps which must handle this themselves.             **}
{**          - Version 1.34  (3rd/April/1997)                        **}
{**              Fixed up a resource leak when painting icons.       **}
{**          - Version 1.35  (6th/April/1997)                        **}
{**              Fixed up MemSleuths reported resource leak when     **}
{**              changing the caption, and processing WM_NCACTIVATE. **}
{**              New Recomendations for handling MDI problems.       **}
{** ---------------------------------------------------------------- **}
{** Copyright- copyright 1996, 1997 by Warren F. Young.             **}
{**            Free to use and redistribute, but my name must        **}
{**            appear somewhere in the source code.  No warranty     **}
{**            is given by the author, expressed or implied.         **}
{** ---------------------------------------------------------------- **}
{** Note about MDI Applications                                      **}
{**            MDI Applications will have a drawing problem with     **}
{**            this caption component which occurs when a new child  **}
{**            is created, and that child is maximized.  To work     **}
{**            around this problem, see the file MDI_Apps.txt for    **}
{**            some code to add to the Child window creation routine.**}
{**            (Yes I know it's a nuisance - if you know a better    **}
{**            solution then please e-mail me).                      **}
{** ---------------------------------------------------------------- **}
{** Known Limitations                                                **}
{**          - In D2 (Win95), when a form is maximized and restored, **}
{**            it zooms, and the caption draws non-shaded.           **}
{**          - The 16-bit version flickers on redraw.  In Win3.x     **}
{**            this is unavoidable.  In Win95 (D1) it may be         **}
{**            possible to fix it by calling some 32-bit functions.  **}
{**          - If you change the min/max/system buttons on a form,   **}
{**            then the caption goes back to its original format.    **}
{** ---------------------------------------------------------------- **}
{** Possible Changes/Improvements                                    **}
{**          - In D1 (Win95), try accessing 32bit routines in order  **}
{**            to reduce or remove flickering when redrawing.        **}
{**            (I have tried this and failed on GetWindowRgn and     **}
{**            SetWindowRgn - it compiled but they had no effect).   **}
{**            I may try again with LockWindowUpdate.                **}
{**          - Add a property called Spacing (or similar), to        **}
{**            determine the amount of space between Company and     **}
{**            AppName text, and AppName and Caption text.           **}
{** ---------------------------------------------------------------- **}
{** Disclaimer                                                       **}
{**          - I take no responsibility for any losses suffered      **}
{**            resulting from use or misuse of this code.  It is     **}
{**            freeware, with source code, and so you use (and       **}
{**            maintain) it at your own risk.                        **}
{**********************************************************************}
Good luck and happy programming.