home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / mle / amle.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  4.7 KB  |  106 lines

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