home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / MLE / AMLE.HPP < prev    next >
Text File  |  1995-04-04  |  4KB  |  98 lines

  1. /******************************************************************************/
  2. /* Multi-Line Entry Field Sample Program                                      */
  3. /*                                                                            */
  4. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
  5. /*                                                                            */
  6. /* DISCLAIMER OF WARRANTIES:                                                  */
  7. /*   The following [enclosed] code is sample code created by IBM              */
  8. /*   Corporation.  This sample code is not part of any standard IBM product   */
  9. /*   and is provided to you solely for the purpose of assisting you in the    */
  10. /*   development of your applications.  The code is provided "AS IS",         */
  11. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  12. /*   arising out of your use of the sample code, even if they have been       */
  13. /*   advised of the possibility of such damages.                              */
  14. /******************************************************************************/
  15. /* NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          */
  16. /******************************************************************************/
  17. #ifndef AEDITORWINDOW_HPP
  18. #define AEDITORWINDOW_HPP
  19.  
  20. #include <iframe.hpp>
  21. #include <icmdhdr.hpp>
  22. #include <imenuhdr.hpp>         // IMenuHandler
  23. #include <imenubar.hpp>
  24. #include <imle.hpp>
  25. #include <ithread.hpp>
  26. #include <iinfoa.hpp>
  27. #include <ititle.hpp>
  28. #include <istring.hpp>
  29. #include "auwmhdr.hpp"
  30.  
  31. /******************************************************************************/
  32. /* Class:   AEditorWindow                                                     */
  33. /*                                                                            */
  34. /* Purpose: Main window for mle sample application                            */
  35. /*          It is derived from the classes IFrameWindow, ICommandHandler      */
  36. /*          IMenuHandler & AUserMessageHandler                                */
  37. /******************************************************************************/
  38. class AEditorWindow : public IFrameWindow
  39.                     , public ICommandHandler
  40.                     , public IMenuHandler
  41.                     , public AUserMessageHandler
  42. {
  43.   public:
  44.     AEditorWindow(unsigned long windowId);
  45.     AEditorWindow
  46.      &openFile(Boolean fUseThread),
  47.      &saveFile(),
  48.      &saveAsFile(),
  49.      &openFont(),
  50. #ifndef IC_MOTIF
  51.      &loadOnThread(unsigned long eventId),
  52. #endif
  53.      &load();
  54.  
  55.   protected:
  56.     Boolean command(ICommandEvent& cmdEvent);
  57.     Boolean menuShowing( IMenuEvent& mnEvt
  58.                        , ISubmenu&   smnAboutToShow);
  59.     Boolean userMessage( IEvent& evt );
  60.     Boolean setFileMenuitemsState( Boolean f );
  61.     AEditorWindow &displayLoadFailedMsg();
  62.     Boolean loadMLE();
  63.  
  64.   private:
  65.     IMultiLineEdit mle;
  66.     ITitle         titleBar;
  67.     IMenuBar       menuBar;
  68.     IInfoArea      infoArea;
  69.     IString        filename;
  70. };
  71.  
  72. #ifndef IC_MOTIF
  73. /******************************************************************************/
  74. /* Class   : AThreadFn                                                        */
  75. /*                                                                            */
  76. /* Purpose : this class can be used to execute the member function            */
  77. /*           AEditorWindow::loadOnThread(unsigned long)                       */
  78. /*           on a separate thread.                                            */
  79. /*           It is a subclass of IThreadFn                                    */
  80. /*                                                                            */
  81. /******************************************************************************/
  82. class AThreadFn : public IThreadFn
  83. {
  84.   public:
  85.     AThreadFn(AEditorWindow &obj, unsigned long evtId)
  86.       : object(obj)
  87.       , eventId(evtId)
  88.         {;}
  89.     void run() { object.loadOnThread(eventId); }
  90.  
  91.   private:
  92.     AEditorWindow   &object;
  93.     unsigned long    eventId;
  94. };
  95. #endif
  96.  
  97. #endif
  98.