home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / imsgbox.hp_ / IMSGBOX.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  4.9 KB  |  127 lines

  1. #ifndef _IMSGBOX_
  2. #define _IMSGBOX_
  3. /*******************************************************************************
  4. * FILE NAME: imsgbox.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IMessageBox - the message box class                                      *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *$Log:   R:/IBMCLASS/IBASEAPP/VCS/IMSGBOX.HPV  $                                                                         *
  18. // 
  19. //    Rev 1.5   25 Oct 1992 19:30:58   nunn
  20. // Kevin's changes for external beta
  21. //
  22. //    Rev 1.4   25 Oct 1992 18:00:42   nunn
  23. // Brad Broyles changes for external beta
  24.  
  25.       Rev 1.1   01 Apr 1992 12:00:00   KKL
  26.    Initial Design and Code
  27.       Rev 1.2   05 Sep 1992 12:00:00   KKL
  28.    Update for IBMCPP & new IException
  29.       Rev 1.3   22 Oct 1992 12:00:00   WBB
  30.    Amend to match skeleton.hpp
  31. *******************************************************************************/
  32. #ifndef _IBASE_
  33.   #include <ibase.hpp>
  34. #endif
  35.  
  36. // Forward declarations for other classes:
  37. class IWindow;
  38. class IResourceId;
  39. class IException;
  40. #if !defined( _ISTRING_ ) && !defined( I_NO_RELATED_HPP )
  41.   #include <istring.hpp>
  42. #endif
  43. #if !defined( _IBITFLAG_ ) && !defined( I_NO_RELATED_HPP )
  44.   #include <ibitflag.hpp>
  45. #endif
  46.  
  47. class IMessageBox : public IBase {
  48. /*******************************************************************************
  49. * The IMessageBox class deals with WinMessageBox and has functions to show     *
  50. * different types of CUA message boxes and to accept an IException object.     *
  51. *******************************************************************************/
  52. typedef IBase Inherited;
  53. public:
  54. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  55. | There is one way to construct instances of this class:                       |
  56. |   1. using an instance of IWindow                                            |
  57. |     the instance of IWindow becomes the owner of the new message box         |
  58. ------------------------------------------------------------------------------*/
  59.   IMessageBox(const IWindow* owner);
  60.  
  61. /*-------------------------------- ACCESSORS -----------------------------------
  62. | These function provide means of getting and setting the accessible           |
  63. | attributes of instances of this class:                                       |
  64. |   setTitle - sets the message box's title                                    |
  65. |   show - given a message text string, show the message box                   |
  66. ------------------------------------------------------------------------------*/
  67. INESTEDBITFLAGCLASSDEF0(Style, IMessageBox);
  68. static const Style
  69.   okButton,            // button
  70.   okCancelButton,
  71.   cancelButton,
  72.   enterButton,
  73.   enterCancelButton,
  74.   retryCancelButton,
  75.   abortRetryIgnoreButton,
  76.   yesNoButton,
  77.   yesNoCancelButton,
  78.  
  79.   defButton1,          // default button action
  80.   defButton2,
  81.   defButton3,
  82.  
  83.   noIcon,              // icon shown
  84.   handIcon,
  85.   questionIcon,
  86.   exclamationIcon,
  87.   asteriskIcon,
  88.   informationIcon,
  89.   queryIcon,
  90.   warningIcon,
  91.   errorIcon,
  92.   criticalIcon,
  93.   notificationIcon,
  94.  
  95.   applicationModal,    // modality
  96.   systemModal,
  97.  
  98.   moveable;            // mobility
  99.  
  100. void
  101.   setTitle(const IString& title),
  102.   setTitle(const IResourceId& title);
  103.  
  104.   enum Severity {information, warning, action, critical, catastrophic };
  105.   enum Response {enter, ok, cancel, abort, retry, ignore, yes, no };
  106.  
  107. IMessageBox::Response
  108.   show(const char* msgText, Severity s, unsigned long helpId = 0),
  109.   show(const IResourceId& resId, Severity s, unsigned long helpId = 0),
  110.   show(const char* msgText, Style s, unsigned long helpId = 0),
  111.   show(const IResourceId& resId, Style s, unsigned long helpId = 0),
  112.   show(const IException& exceptionObj, unsigned long helpId = 0);
  113.  
  114. private:
  115. /*--------------------------------- PRIVATE ----------------------------------*/
  116. static unsigned long
  117.   convertSeverity(Severity s);
  118. static IMessageBox::Response
  119.   convertResponse(unsigned long ulId);
  120. IString
  121.   strClTitle;
  122. const IWindow*
  123.   pwndClOwner;
  124. }; // IMessageBox
  125.  
  126. #endif  /* _IMSGBOX_  */
  127.