home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / SAMPLES / ICLUI / MLE / AMLE.HPP < prev    next >
Text File  |  1993-10-18  |  4KB  |  93 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.     void    openFile(Boolean fUseThread),
  46.             saveFile(),
  47.             saveAsFile(),
  48.             openFont(),
  49.             load(),
  50.             loadOnThread(unsigned long eventId);
  51.  
  52.   protected:
  53.     Boolean command(ICommandEvent& cmdEvent);
  54.     Boolean menuShowing( IMenuEvent& mnEvt
  55.                        , ISubmenu&   smnAboutToShow);
  56.     Boolean userMessage( IEvent& evt );
  57.     Boolean setFileMenuitemsState( Boolean f );
  58.     void    displayLoadFailedMsg();
  59.     Boolean loadMLE();
  60.  
  61.   private:
  62.     IMultiLineEdit mle;
  63.     ITitle         titleBar;
  64.     IMenuBar       menuBar;
  65.     IInfoArea      infoArea;
  66.     IString        filename;
  67. };
  68.  
  69. /******************************************************************************/
  70. /* Class   : AThreadFn                                                        */
  71. /*                                                                            */
  72. /* Purpose : this class can be used to execute the member function            */
  73. /*           AEditorWindow::loadOnThread(unsigned long)                       */
  74. /*           on a separate thread.                                            */
  75. /*           It is a subclass of IThreadFn                                    */
  76. /*                                                                            */
  77. /******************************************************************************/
  78. class AThreadFn : public IThreadFn
  79. {
  80.   public:
  81.     AThreadFn(AEditorWindow &obj, unsigned long evtId)
  82.       : object(obj)
  83.       , eventId(evtId)
  84.         {;}
  85.     void run() { object.loadOnThread(eventId); }
  86.  
  87.   private:
  88.     AEditorWindow   &object;
  89.     unsigned long    eventId;
  90. };
  91.  
  92. #endif
  93.