home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IMSGBOX.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
13KB
|
240 lines
#ifndef _IMSGBOX_
#define _IMSGBOX_
/*******************************************************************************
* FILE NAME: imsgbox.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* IMessageBox - the message box class *
* *
* 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 _IBASE_
#include <ibase.hpp>
#endif
// Forward declarations for other classes:
class IWindow;
class IResourceId;
class IException;
class IErrorInfo;
#if !defined( _ISTRING_ ) && !defined( I_NO_RELATED_HPP )
#include <istring.hpp>
#endif
#if !defined( _IBITFLAG_ ) && !defined( I_NO_RELATED_HPP )
#include <ibitflag.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IMessageBox : public IBase {
/*******************************************************************************
* The IMessageBox class has functions to show different types of Common User *
* Access (CUA) message boxes. It shows a message box given a message text, *
* resource ID, IException, or IErrorInfo object with the specified style, or *
* using a style defined by the severity of the message. *
*******************************************************************************/
typedef IBase
Inherited;
public:
/*------------------------ Constructor -----------------------------------------
| The only way to construct instances of this class is by using an instance |
| of IWindow. The instance of IWindow becomes the owner of the new message |
| box. The message box title defaults to the owner's title. |
------------------------------------------------------------------------------*/
IMessageBox ( const IWindow* aOwner );
~IMessageBox ( );
/*------------------- Styles ---------------------------------------------------
| The IMessageBox::Style class is a nested class that provides static |
| members that define the set of valid message box styles. |
| |
| The following styles specify which push buttons are provided: |
| okButton - Causes the message box to contain an OK push |
| button. |
| okCancelButton - Causes the message box to contain both OK and |
| Cancel push buttons. |
| cancelButton - Causes the message box to contain a Cancel |
| push button. |
| enterButton - Causes the message box to contain an Enter |
| push button. |
| enterCancelButton - Causes the message box to contain both Enter |
| and Cancel push buttons. |
| retryCancelButton - Causes the message box to contain both Retry |
| and Cancel push buttons. |
| abortRetryIgnoreButton - Causes the message box to contain Abort, |
| Retry, and Ignore push buttons. |
| yesNoButton - Causes the message box to contain both Yes and |
| No push buttons. |
| yesNoCancelButton - Causes the message box to contain Yes, No, and |
| Cancel push buttons. |
| |
| The following styles specify default push button actions: |
| defButton1 - Causes the first button to be the default |
| selection. This is the default action. |
| defButton2 - Causes the second button to be the default |
| selection. |
| defButton3 - Causes the third button to be the default |
| selection. |
| |
| The following styles specify which icons are shown: |
| noIcon - Causes the message box to contain no icon. |
| informationIcon - Causes the message box to contain a lower case |
| "i" in a circle. |
| queryIcon - Causes the message box to contain a question |
| mark (?) in a circle. |
| warningIcon - Causes the message box to contain an |
| exclamation point (!) in a triangle. |
| errorIcon - Causes the message box to contain a circle with |
| a diagonal line through it. |
| The following styles specify modality: |
| applicationModal - Causes the message box to be application |
| modal. This is the default case. Its owner |
| is disabled; therefore, do not specify the |
| owner as the parent if this option is used. |
| systemModal - Causes the message box to be system modal. |
| |
| The following style specifies mobility: |
| moveable - Causes the message box to be moveable. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF0(Style, IMessageBox);
static const Style
okButton, // button
okCancelButton,
cancelButton,
enterButton,
enterCancelButton,
retryCancelButton,
abortRetryIgnoreButton,
yesNoButton,
yesNoCancelButton,
defButton1, // default button action
defButton2,
defButton3,
noIcon, // icon shown
informationIcon,
queryIcon,
warningIcon,
errorIcon,
applicationModal, // modality
systemModal,
moveable; // mobility
/*------------------------------ Severity---------------------------------------
| Severity - Enumerates the different severity levels of a message box. The |
| valid values are: |
| |
| information - Displays an information icon with an OK push |
| button. |
| warning - Displays a warning icon with Enter and Cancel |
| push buttons. |
| action - Displays a query icon with Retry and Cancel |
| push buttons. |
| critical - Displays an error icon with Retry and Cancel |
| push buttons. |
| catastrophic - Displays an error icon with an OK push button. |
------------------------------------------------------------------------------*/
enum Severity {
information,
warning,
action,
critical,
catastrophic
};
/*------------------------------ Response---------------------------------------
| Response - Enumerates the replies possible from a message box. The valid |
| values are: |
| |
| enter - Causes the Enter push button to be selected. |
| ok - Causes the OK push button to be selected. |
| cancel - Causes the Cancel push button to be selected. |
| abort - Causes the Abort push button to be selected. |
| retry - Causes the Retry push button to be selected. |
| ignore - Causes the Ignore push button to be selected. |
| yes - Causes the Yes push button to be selected. |
| no - Causes the No push button to be selected. |
| unknown - Causes an unknown push button ID to be selected. |
------------------------------------------------------------------------------*/
enum Response {
enter,
ok,
cancel,
abort,
retry,
ignore,
yes,
no,
unknown
};
/*--------------------------- Set/Show Functions -------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| setTitle - Sets the message box's title. |
| show - Shows a message box given one of the following: |
| - Message text and severity |
| - Resource ID and severity |
| - Resource ID and style |
| - Message text and style |
| - IException object |
| - IErrorInfo object |
| A Help push button is displayed if the aHelpId argument is |
| specified. |
------------------------------------------------------------------------------*/
IMessageBox
&setTitle(const char* aTitle),
&setTitle(const IResourceId& aTitle);
IMessageBox::Response
show ( const char* aMessage,
Severity aSeverity,
unsigned long aHelpId = 0 ),
show ( const IResourceId& aResId,
Severity aSeverity,
unsigned long aHelpId = 0 ),
show ( const IResourceId& resId,
Style aStyle,
unsigned long aHelpId = 0),
show ( const char* aMessage,
Style aStyle,
unsigned long aHelpId = 0),
show ( const IException& aException,
unsigned long aHelpId = 0),
show ( const IErrorInfo& aError,
unsigned long aHelpId = 0);
private:
/*--------------------------------- PRIVATE ----------------------------------*/
static unsigned long
convertSeverity(Severity s);
static IMessageBox::Response
convertResponse(unsigned long ulId);
IString
strClTitle;
const IWindow*
pwndClOwner;
}; // IMessageBox
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IMSGBOX_ */