home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / EDITFILE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.2 KB  |  79 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1992, 1993 by Borland International
  3. //   include\owl\editfile.h
  4. //   Definition of class TEditFile, a text edit which can find/replace
  5. //   and read/write from/to a file.
  6. //----------------------------------------------------------------------------
  7. #if !defined(__OWL_EDITFILE_H)
  8. #define __OWL_EDITFILE_H
  9.  
  10. #if !defined(__OWL_EDITSEAR_H)
  11.   #include <owl\editsear.h>
  12. #endif
  13. #if !defined(__OWL_OPENSAVE_H)
  14.   #include <owl\opensave.h>
  15. #endif
  16. #include <owl\editfile.rh>
  17.  
  18. //
  19. //  class TEditFile
  20. //  ----- -----------
  21. //
  22. class _OWLCLASS TEditFile : public TEditSearch {
  23.   public:
  24.     TOpenSaveDialog::TData FileData;
  25.     char far* FileName;
  26.  
  27.     TEditFile(TWindow*        parent = 0,
  28.               int             id = 0,
  29.               const char far* text = 0,
  30.               int x = 0, int y = 0, int w = 0, int h = 0,
  31.               const char far* fileName = 0,
  32.               TModule*        module = 0);
  33.  
  34.    ~TEditFile();
  35.  
  36.     virtual BOOL  CanClear();
  37.     virtual BOOL  CanClose();
  38.  
  39.     void          NewFile();
  40.     void          Open();
  41.     BOOL          Read(const char far* fileName=0);
  42.     void          ReplaceWith(const char far* fileName);
  43.     BOOL          Save();
  44.     BOOL          SaveAs();
  45.     void          SetFileName(const char far* fileName);
  46.     BOOL          Write(const char far* fileName=0);
  47.  
  48.     //
  49.     // command response functions
  50.     //
  51.     void          CmFileNew() {NewFile();}    // CM_FILENEW
  52.     void          CmFileOpen() {Open();}      // CM_FILEOPEN
  53.     void          CmFileSave() {Save();}      // CM_FILESAVE
  54.     void          CmFileSaveAs() {SaveAs();}  // CM_FILESAVEAS
  55.  
  56.     //
  57.     // command enabler functions
  58.     //
  59.     void          CmSaveEnable(TCommandEnabler& commandHandler);    
  60.  
  61.   protected:
  62.     //
  63.     // override virtual functions defined by TWindow
  64.     //
  65.     void          SetupWindow();
  66.  
  67.   private:
  68.     //
  69.     // hidden to prevent accidental copying or assignment
  70.     //
  71.     TEditFile(const TEditFile&);
  72.     TEditFile& operator =(const TEditFile&);
  73.  
  74.   DECLARE_RESPONSE_TABLE(TEditFile);
  75.   DECLARE_STREAMABLE(_OWLCLASS, TEditFile, 1);
  76. };
  77.  
  78. #endif  // __OWL_EDITFILE_H
  79.