// ======================================================================== // THIS CLASS AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright 1997-1998 Giuseppe "Jo" Parrello. All Rights Reserved. // // Site : http://space.tin.it/computer/giparrel // E-Mail : joparrel@tin.it, giusparr@tin.it, giparre@tin.it // ======================================================================== // // Class: JPTooltipSupport (Release 2.0 - July 31, 1998) // // Files: jptooltp.cpp jptooltp.h // // Purpose: Provides a tooltip for some JPClasses. // // Platforms: This class has been tested on Windows 95 and on Windows 3.1 // and it should run on Windows NT too. // I've used Borland C++ 5.02 to build this class, but I think // that it should run with 5.01 release too. // // Comments: JPTooltipSupport is a base class. // Its only purpose is to provide you a tooltip // to be used with some classes as JPPropertySheet and JPDialog. // The code is very easy to understand. // If you need more info, please e-mail me. // // Declaration: JPTooltipSupport class has only a parameter. // This param is a TWindow object and represents // the parent window for the tooltip. This window MUST exist. // // Methods: Constructor: // In the constructor we create a new tooltip object, // we force the creation of it and activate it. // Finally we enable the hook procedure that is useful // as it catches all messages directed to the windows // like dialogs and sends them to the tooltip control. // We must do it as this kind of windows doesn't // manage the mouse's messages correctly. // // Destructor: // In the destructor we disable the hook procedure as // we don't need it anymore. // Besides we delete all the tools associated to the // tooltip control and we destroy it. // // Method EnableHookProc(bool Enable); // According to the parameter "Enable" we enable or disable // the hook procedure. The code is different for Win16 and // Win32 target applications, as Win16 apps require // the "MakeProcInstance" function to run without problems. // // Method AssociateTooltips(HWND hwnd, // bool IsAssociate, // bool FullTooltipSupport, // bool AlwaysForceRectAssociate, // bool ForceRectAssociateIfDisabled); // This is the core of this class. With this function we // can associate each control (or child windows) of the // window (or dialog) to the tooltip control. // The first parameter "hwnd" is the handle of the window // which we'll be scanned. // The second param "IsAssociate" must be true if you want // to associate the tools to the tooltip control or false // if you want to dissociate them. // The third param must be true if you have a static control // in your window and you want to add a tooltip to it. // The fourth param must be true if you want to force // the association to all controls in the window. // The fifth param must be true if you want to force // the association if you have a disabled control. // These last three params associate the control to the // tooltip using their rectangle, not their handle. // Be careful if you intend to move, to disable or to enable // your controls after the association. // // Method RetrieveTooltipString(_TCHAR* szBuf, uint ItemId); // This method retrieves the string for the tooltip. // You must provide a buffer string and the control Id. // In this release you don't need to specify a decorated frame // window as the parent window of the tooltip control. // This release scans the string loaded from the resources // to find a "\n" character. If it is found, then this method // returns the string at the right of that character // (the left side is currently not used). // // USAGE: Each control must have a string resource in .rc file. // You can create a tooltip using the following line: // // STRINGTABLE // { // CONTROLID, "Message\nTooltip" // } // // Put a "\n" between your message to be displayed on // status bar and tooltip string for this gadget. // If there isn't a "\n" char in your string resource, // the function can retrieve only the tooltip's part. // // HISTORY: Release 2.0 (July 31, 1998) // It supports Unicode char format. // The code is optimized (I hope!!), and has // many parameters to make it customizable. // Now it doesn't need a decorated frame to retrieve // the string for each tooltip. // // Release 1.0 (February 2, 1998) // This release is the first release. // It doesn't support Unicode. // The code has not been optimized and has some bugs. //--------------------------------------------------------------------------- //===========================================================================