home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IHELP.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
19KB
|
346 lines
#ifndef _IHELP_
#define _IHELP_
/*******************************************************************************
* FILE NAME: ihelp.hpp. *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IHelpWindow - The application's help window *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IWINDOW_
#include <iwindow.hpp>
#endif
#ifndef _IHANDLE_
#include <ihandle.hpp>
#endif
#ifndef _ISTRING_
#include <istring.hpp>
#endif
#ifndef _IRESLIB_
#include <ireslib.hpp>
#endif
#ifndef _IFRAME_
#include <iframe.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
/*----------------------------------------------------------------------------*/
/* Turn off warning for compiler generated copy/assignment */
/*----------------------------------------------------------------------------*/
#pragma info(nocpy)
// Forward declarations for other classes:
class ISize;
class IString;
class IPoint;
class IRectangle;
class IResourceId;
class IFrameWindow;
class IHelpWindow : public IWindow {
typedef IWindow
Inherited;
/*******************************************************************************
| The IHelpWindow class is used to provide help for application windows using |
| the OS/2 Information Presentation Facility (IPF). Typically, an |
| IHelpWindow is created and associated with one of the application's main |
| windows. Multiple help windows can exist within an application. When an |
| application window is associated with a help window, help events will be |
| dispatched to the help handler attached to the window. |
| |
| MyFrameWindow :: MyFrameWindow() { |
| IHelpWindow* phelp = new IHelpWindow(CPP_HELP_TABLE, this); |
| phelp->setTitle("C++ Help"); |
| IHelpHandler* phelpHandler = new IHelpHandler() |
| phelpHandler->startHandling(this); |
| handleEventsFor(this); |
| } |
| |
*******************************************************************************/
public :
class Settings : public IBase {
/*******************************************************************************
| The IHelpWindow::Settings class provides initial information for the |
| constructor of the IHelpWindow class. Typically, a Settings instance is |
| created and some or all of the data is set before passing it on to the |
| IHelpWindow constructor that takes a Settings instance. |
*******************************************************************************/
typedef IBase
Inherited;
/*------------------------- Constructor/Destructor -----------------------------
| Instances of this nested class can be constructed using the default |
| constructor only. |
------------------------------------------------------------------------------*/
public :
Settings();
/*------------------------------ Accessors ------------------------------------
| The following functions provide a means of getting and setting the |
| accessible attributes of instances of this class. These functions are used |
| before the help window is created. |
| |
| setTitle - Indicates the text to use in the title of the help |
| window. The text can be specified as either a text |
| string or as a resource ID to be loaded. |
| setLibraries - Adds a library or list of libraries to those |
| referenced when looking for help windows by their |
| ID. If multiple library names are specified, they |
| should be separated by a blank space. This member |
| function deals with the binary help files that have |
| an .HLP extension. |
| setTutorial - Sets the name of the application's tutorial. If |
| this name is specified, IPF will provide a Tutorial |
| choice in the Help menu. |
| setHelpTable - Specifies a new help table to use to identify help |
| windows. |
| setUsingHelp - Specifies the application help panel to be used |
| instead of the default IPF Using Help window. |
| setMenuBar - Specifies a menu bar template to use instead of the |
| IPF default menu bar |
| setHelpResLibrary - Sets the dynamic resource library that contains the |
| help table script. The default setting is the |
| executable file. |
| setAccelResLibrary - Sets the dynamic resource link library that contains |
| the help window menu accelerator table. The .DLL |
| extension should be part of the given string. The |
| default setting is the executable file. |
| setAccelerator - If a modified menu bar is being used, this function |
| specifies an accelerator table to use with it. |
------------------------------------------------------------------------------*/
Settings
&setTitle ( const char* titleText),
&setTitle ( const IResourceId& titleId),
&setLibraries ( const char* helpLibraryNames),
&setTutorial ( const char* tutorial),
&setHelpTable ( unsigned long helpTable),
&setUsingHelp ( unsigned long helpId),
&setMenuBar ( unsigned long menuBar),
&setHelpResLibrary ( const char* helpTableResLibrary),
&setAccelResLibrary ( const char* menuAccelResLibrary),
&setAccelerator ( unsigned long accelerator);
private:
IString
title,
tutorial,
helpLibraries,
HTResLib,
MAResLib;
unsigned long
usingHelpId,
helpTableId,
menuBarId,
acceleratorId;
friend class IHelpWindow;
}; //end Class Settings
/*------------------------ Constructors/Destructor ----------------------------
| You can construct an instance of this class in the following ways: |
| |
| - By providing an optional application window which: |
| - The help window references to position itself. |
| - Receives help notification events. |
| |
| - By providing a resource ID to identify the help table in addition to |
| an optional application window which: |
| - The help window references to position itself. |
| - Receives help notification events. |
| |
| - By providing a Settings class instance to associate the help with |
| initial information such as a modified menu bar, accelerator |
| table, title, tutorial, and library names. The application can also |
| pass in the helpEventReceiver frame window so that the help instance |
| can be associated when the constructor is run. Otherwise, the |
| application can call associateWindow after construction. |
| |
| - From an existing help instance by providing the window handle. |
------------------------------------------------------------------------------*/
IHelpWindow ( IFrameWindow* helpEventReceiver = 0);
IHelpWindow ( const IResourceId& helpTable,
IFrameWindow* helpEventReceiver );
IHelpWindow ( IHelpWindow::Settings initialSettings,
IFrameWindow* helpEventReceiver = 0);
IHelpWindow ( const IWindowHandle& helpWindowHandle);
virtual
~IHelpWindow ( );
/*------------------------------ Event Processing ------------------------------
| The following functions are used to facilitate the processing of help window |
| events: |
| associateWindow - Sets the application window chain to receive help |
| events. Setting frameWindow to 0 will dissassociate |
| any previously set window. |
| setActiveWindow - Sets the application window to receive window help |
| events. This is the window that a help handler should |
| be associated with to process help events. Optionally, |
| the window next to which the help window should be |
| positioned can be specified. |
------------------------------------------------------------------------------*/
IHelpWindow
&associateWindow ( IFrameWindow* frameWindow),
&setActiveWindow ( IFrameWindow* handlerWindow,
IFrameWindow* relativeWindow = 0);
/*------------------------------ Help Attribute -------------------------------
| These functions provide means of getting and setting the help specific |
| attributes of instances of this class. These functions are used after the |
| help window has been created. |
| |
| setTitle - Indicates the text to use in the title of the help window. |
| The text can be specified as either a text string or as a |
| resource ID to be loaded. |
| setHelpTable - Specifies a new help table to use to identify help windows. |
| addLibraries - Adds a library or list of libraries to those referenced |
| when looking for help windows by their ID. If multiple |
| library names are specified, they should be separated by a |
| blank space. This member function deals with the binary |
| help files that have an .HLP extension. |
| setUsingHelp - Specifies the application help panel to be used instead of |
| the default IPF Using Help window. |
------------------------------------------------------------------------------*/
IHelpWindow
&setTitle ( const char* titleText),
&setTitle ( const IResourceId& titleId),
&setHelpTable ( const IResourceId& helpTable),
&addLibraries ( const char* helpLibraryNames),
&setUsingHelp ( unsigned long helpId);
/*------------------------------ Window Accessing ------------------------------
| The following functions provide information about accessing the window: |
| indexWindow - Returns the handle of the Index window. |
| contentsWindow - Returns the handle of the Table of Contents window. |
| searchListWindow - Returns the handle of the Search hit-list window. |
| viewedPagesWindow - Returns the handle of the Viewed Pages window. |
| communicationWindow - Returns the handle of the active communication |
| window. |
| coverPageWindow - Returns the handle of the IPF multiple document |
| interface parent window. |
| helpForWindow - Returns the current active window. If there is not |
| an active window, 0 is returned. |
| helpWindow - Returns a pointer to an IHelpWindow given an |
| application window. The parent window chain is |
| searched until an application window that contains |
| a help window is found. If a help window cannot be |
| found, 0 is returned. |
------------------------------------------------------------------------------*/
IWindowHandle
indexWindow ( ) const,
contentsWindow ( ) const,
searchListWindow ( ) const,
viewedPagesWindow ( ) const,
communicationWindow ( ) const,
coverPageWindow ( ) const;
IFrameWindow
*helpForWindow ( ) const;
static IHelpWindow
*helpWindow ( const IWindow* window);
/*------------------------------ Related Types ---------------------------------
| The following types are defined within the IHelpWindow: |
| HelpType - Identifies the type of the help window to be displayed on |
| a call to IHelpWindow::show. It can be set to one of the |
| following values: |
| |
| index - The Help Index window. |
| general - The General Help window. |
| contents - The Help Contents window. |
| keys - The Keys Help window. |
| using - The Using Help window. |
------------------------------------------------------------------------------*/
enum HelpType {index, general, contents, keys, using};
/*-------------------------------- Display -------------------------------------
| The following functions are used to display and remove help windows: |
| show - Displays a help window. The help window can be specified |
| by either its ID, which is used to load the help window |
| from the current help table, or by passing one of the |
| HelpType flags. If a window ID of 0 is specified, the |
| Using Help window is displayed.
| hide - Dismisses the help window. |
| showPanelIds - Adds the panel ID of help windows to the help window title. |
| hidePanelIds - Removes the panel ID of help windows from the help window |
| title. |
------------------------------------------------------------------------------*/
IHelpWindow
&show ( HelpType helpType),
&show ( const IResourceId& panelId),
&show ( const char* panelName),
&hide ( ),
&showPanelIds ( Boolean visibleId = true),
&hidePanelIds ( );
/*-------------------------------- Overrides -----------------------------------
| The following inherited functions are overridden: |
| handle - Returns the help instance window handle. |
| sizeTo - Changes the size of the help cover page window (the window |
| within which all other IPF windows are displayed). |
| moveTo - Changes the position of the help cover page window. |
| moveSizeTo - Changes the size and position of the help cover page window. |
------------------------------------------------------------------------------*/
IWindowHandle
handle ( ) const;
IHelpWindow
&sizeTo ( const ISize& aSize),
&moveTo ( const IPoint& aPoint),
&moveSizeTo ( const IRectangle& aRectangle);
/*--------------------------------- Private ----------------------------------*/
private :
IWindowHandle
helpHandle;
IResourceLibrary
*pHTResLib,
*pMAResLib;
IString //xxxxxxx
helpLibraries;
IHelpWindow
&show ( Boolean show=true);
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing and warning messages. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#pragma info(restore)
#endif