home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / MSGBOX / MSGBOX.HPP < prev    next >
C/C++ Source or Header  |  1995-04-07  |  5KB  |  111 lines

  1. #ifndef _MSGBOX_
  2. #define _MSGBOX_
  3. /*****************************************************************************
  4. * FILE NAME: msgbox.hpp         (Message Box Sample Program)                 *
  5. *                                                                            *
  6. * COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
  7. *                                                                            *
  8. * DISCLAIMER OF WARRANTIES:                                                  *
  9. *   The following [enclosed] code is sample code created by IBM              *
  10. *   Corporation.  This sample code is not part of any standard IBM product   *
  11. *   and is provided to you solely for the purpose of assisting you in the    *
  12. *   development of your applications.  The code is provided "AS IS",         *
  13. *   without warranty of any kind.  IBM shall not be liable for any damages   *
  14. *   arising out of your use of the sample code, even if they have been       *
  15. *   advised of the possibility of such damages.                              *
  16. *****************************************************************************/
  17. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  18. /**************************************************************************
  19. * IBM User Interface Class Library - Message Box Sample                   *
  20. *   The purpose of this sample application is to show various types of    *
  21. *   message boxes.  A frame window with an IMultiLineEdit client window   *
  22. *   is used to display information about the progress of the sample.      *
  23. *   Information is also traced to the trace destination.  Tracing         *
  24. *   information is turned on by setting the ICLUI_TRACE environment       *
  25. *   variable to ON and the destination is set using the ICLUI_TRACETO     *
  26. *   environment variable.                                                 *
  27. **************************************************************************/
  28. //Include User Interface Class Library class headers:
  29. #ifndef _IMSGBOX_
  30.   #include <imsgbox.hpp>                //Include IMessageBox class header
  31. #endif
  32. #ifndef _IWINDOW_
  33.   #include <iwindow.hpp>                //Include IWindow class header
  34. #endif
  35. #ifndef _IFRAME_
  36.   #include <iframe.hpp>                 //Include IFrameWindow class header
  37. #endif
  38. #ifndef _IEXCEPT_
  39.   #include <iexcept.hpp>                //Include IException class header
  40. #endif
  41. #ifndef _IRESLIB_
  42.   #include <ireslib.hpp>                //Include IResourceId class header
  43. #endif
  44. #ifndef _ITRACE_
  45.   #include <itrace.hpp>                 //Include ITrace class header
  46. #endif
  47. #ifndef _ISTRING_
  48.   #include <istring.hpp>                //Include IString class header
  49. #endif
  50. #ifndef _IHELP_
  51.   #include <ihelp.hpp>                  //Include IHelpWindow class header
  52. #endif
  53. #ifndef _IMLE_
  54.   #include <imle.hpp>                   //Include IMultiLineEdit class header
  55. #endif
  56. #ifndef _ICCONST_
  57.   #include <icconst.h>                  //Include IC_* constants
  58. #endif
  59.  
  60. #include "msgbox.h"                     //Include symbolic definitions
  61.  
  62. /**************************************************************************
  63. * Class:   AMsgBoxDemo                                                    *
  64. *                                                                         *
  65. * Purpose: New class that displays a series of message boxes with status  *
  66. *          being written to this frame's client, an IMultiLineEdit object.*
  67. *          This class inherits from IFrameWindow.                         *
  68. *                                                                         *
  69. **************************************************************************/
  70. class AMsgBoxDemo : public IFrameWindow
  71. {
  72. public:
  73.    AMsgBoxDemo(unsigned long windowId); //Constructor
  74. virtual ~AMsgBoxDemo() { };             //Default destructor
  75.  
  76. /*--------------------- Run Message Box Demonstration --------------------|
  77. | The runDemo function loops through a series of IMessageBox::show        |
  78. |   function calls, with the final show prompting the user for another    |
  79. |   time through the loop.  This function traces its progress to the      |
  80. |   ITrace destination and to the IMultiLineEdit window in the frame.     |
  81. |------------------------------------------------------------------------*/
  82. AMsgBoxDemo
  83.    &runDemo();
  84.  
  85. protected:
  86. /*--------------------- Run Message Box Demonstration --------------------|
  87. | The following protected functions are used by runDemo to produce the    |
  88. |   demonstration:                                                        |
  89. |     traceReply - Formats the message box reply to an IString, traces    |
  90. |                  traces the IString to the ITrace destination,          |
  91. |                  returns the IString to the caller.                     |
  92. |     throwException - Generates an IAccessError to demonstrate use of    |
  93. |                  a message box to display an exception.                 |
  94. |------------------------------------------------------------------------*/
  95. AMsgBoxDemo
  96.    &traceReply(IMessageBox::Response);
  97. void
  98.    throwException();
  99.  
  100. private:
  101.    IMultiLineEdit       mbResponses;
  102.    IMessageBox          mb;
  103.    IHelpWindow          mbHelp;
  104.  
  105.    AMsgBoxDemo(const AMsgBoxDemo&);     //Default copy constructor
  106. AMsgBoxDemo
  107.    &operator=(const AMsgBoxDemo&);      //Default assignment operator
  108. };
  109.  
  110. #endif
  111.