]> git.saurik.com Git - wxWidgets.git/blob - include/wx/textfile.h
Made OnInit() and OnRun() logic like MSW when it
[wxWidgets.git] / include / wx / textfile.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/textfile.h
3 // Purpose: class wxTextFile to work with text files of _small_ size
4 // (file is fully loaded in memory) and which understands CR/LF
5 // differences between platforms.
6 // Author: Vadim Zeitlin
7 // Modified by:
8 // Created: 03.04.98
9 // RCS-ID: $Id$
10 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
11 // Licence: wxWindows license
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_TEXTFILE_H
15 #define _WX_TEXTFILE_H
16
17 #ifdef __GNUG__
18 #pragma interface "textfile.h"
19 #endif
20
21 #include "wx/defs.h"
22
23 #include "wx/textbuf.h"
24
25 #if wxUSE_TEXTFILE
26
27 #include "wx/file.h"
28
29 // ----------------------------------------------------------------------------
30 // wxTextFile
31 // ----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxTextFile : public wxTextBuffer
34 {
35 public:
36 // constructors
37 wxTextFile() { }
38 wxTextFile(const wxString& strFileName);
39
40 protected:
41 // implement the base class pure virtuals
42 virtual bool OnExists() const;
43 virtual bool OnOpen(const wxString &strBufferName,
44 wxTextBufferOpenMode OpenMode);
45 virtual bool OnClose();
46 virtual bool OnRead(wxMBConv& conv);
47 virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv = wxConvLibc);
48
49 private:
50 wxFile m_file;
51 };
52
53 #else // !wxUSE_TEXTFILE
54
55 // old code relies on the static methods of wxTextFile being always available
56 // and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so
57 // make it possible to use them in a backwards compatible way
58 typedef wxTextBuffer wxTextFile;
59
60 #endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
61
62 #endif // _WX_TEXTFILE_H
63