home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / EDITFILE.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  80 lines

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