home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mlelib.zip / mlelib / editor.h < prev    next >
C/C++ Source or Header  |  1993-10-08  |  4KB  |  112 lines

  1. /*************************************************************************
  2. *
  3. * filename        : editor.h
  4. *
  5. * description    : header file for class EDITOR
  6. *
  7. * exp. types    : struct MLE_LIST    - chain MLEs together
  8. *                  class  EDITOR        - handle many MLEs
  9. *
  10. * used classes    : class  MLE
  11. *
  12. * copyright (C) 1993 Jörg Caumanns (caumanns@cs.tu-berlin.de)
  13. *
  14. *************************************************************************/
  15. #ifndef _EDITOR_INCLUDED
  16. #define _EDITOR_INCLUDED
  17.  
  18. #include <os2def.h>
  19. #include "mle.h"
  20.  
  21. /**
  22. * struct MLE_LIST: class EDITOR handles a linked list of MLEs (Multi-Line
  23. *                   entry-fields). MLE_LIST is used to link the MLEs.
  24. **/
  25. struct MLE_LIST    {
  26.     MLE            *pmle;
  27.     MLE_LIST    *next;
  28.     };
  29.  
  30.  
  31. /*************************************************************************
  32. *
  33. * class    : EDITOR
  34. *
  35. * descr.: manage a list of Multi-Line Entryfields (e.g for "file"-menus)
  36. *
  37. * method: NewFile        Create an empty MLE. This method could e.g. be
  38. *                        called after menu "file / new" was selected.
  39. *          OpenFile        Create an MLE and load a file to it. If no
  40. *                        filename is specified, the user is asked to enter
  41. *                        a name ("open"-dialogbox). The method could be
  42. *                        called with no parameter as a responce to
  43. *                        menu "file / open...".
  44. *          SaveFile        If a filename is given as an argument the
  45. *                        contents of the MLE to which this file was loaded
  46. *                        is saved. If no argument is given, the contents
  47. *                        of the active MLE is saved. If no file is associated
  48. *                        with this MLE (e.g. it was created by "NewFile"),
  49. *                        the user is asked to enter a filename
  50. *                        ("save as"-dialogbox). This method could be used
  51. *                        for menu "file / save".
  52. *          SaveFileAs    If a filename is given as an argument the
  53. *                        contents of the MLE to which this file was loaded
  54. *                        is saved. If no argument is given, the contents
  55. *                        of the active MLE is saved. Before saving the user
  56. *                        the user is asked to enter a new name for the
  57. *                        file ("save as"-dialogbox). This method could
  58. *                        be used for menu "file / save as...".*          SaveAllFiles  The contents of all MLEs are saved. If an MLE
  59. *                        is not associated with a file, the user is asked
  60. *                        to enter a filename ("save as"-dialogbox). This
  61. *                        method could be used for menu "file / save all".
  62. *          CloseFile     If a filename is given as an argument the MLE
  63. *                        to which this file aws loaded is closed. If no
  64. *                        argument is given, the active MLE is closed.
  65. *                        If the contents of the MLE to be closed has
  66. *                        changed, "SaveFile" is called by this method
  67. *                        before closing the MLE.
  68. *          CloseAllFiles "CloseFile" is called for all MLEs. This method
  69. *                        should be called before terminating an
  70. *                        application that used class EDITOR.
  71. *          Cut            Remove the selected text of the active MLE and put
  72. *                        it in the clipboard. (menu "edit / cut")
  73. *          Copy          Copy the selected text of the active MLE to the
  74. *                        clipboard. (menu "edit / copy")
  75. *          Paste            Insert text from the clipboard at the cursor-
  76. *                        position of the active MLE (menu "edit / paste").
  77. *          Clear            Delete the selected text of the active MLE
  78. *                        (menu "edit / clear").
  79. *
  80. * uses    : class MLE
  81. *
  82. *************************************************************************/
  83. class EDITOR    {
  84.         MLE_LIST *pmlelist;
  85.         MLE  *WindowFromFile(CHAR *);
  86.         MLE  *ActiveWindow(VOID);
  87.     public:
  88.         EDITOR();
  89.         BOOL NewFile(VOID);
  90.         BOOL OpenFile(CHAR *pszFile = (CHAR *)0);
  91.         BOOL SaveFile(CHAR *pszFile = (CHAR *)0);
  92.         BOOL SaveFileAs(CHAR *pszFile = (CHAR *)0);
  93.         BOOL SaveAllFiles(VOID);
  94.         BOOL CloseFile(CHAR *pszFile = (CHAR *)0);
  95.         BOOL CloseAllFiles(VOID);
  96.         VOID Cut(VOID);
  97.         VOID Copy(VOID);
  98.         VOID Paste(VOID);
  99.         VOID Clear(VOID);
  100.         VOID SetColor(LONG clrForeground, LONG clrBackground);
  101.         ~EDITOR();
  102.         };
  103.  
  104. /*
  105. * inline methods of class EDITOR
  106. */
  107. inline EDITOR::EDITOR()    {            // constructor
  108.     pmlelist = (MLE_LIST *)0;
  109.     }
  110.  
  111. #endif     /* !_EDITOR_INCLUDED    */
  112.