Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXDocument.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * D o c u m e n t O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXDocument.h,v 1.16 2006/01/22 17:58:01 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXDOCUMENT_H
25 #define FXDOCUMENT_H
26 
27 #ifndef FXOBJECT_H
28 #include "FXObject.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 // Forward
35 class FXWindow;
36 
37 
38 /// Abstract base class for documents
39 class FXAPI FXDocument : public FXObject {
41 private:
42  FXString title; // Title to appear above windows
43  FXString filename; // File name to save to
44  FXbool modified; // Document has been modified
45 public:
46  long onUpdTitle(FXObject*,FXSelector,void*);
47  long onUpdFilename(FXObject*,FXSelector,void*);
48 public:
49  enum {
50  ID_TITLE=10000, // Don't interfere with viewer's message id's
51  ID_FILENAME,
52  ID_LAST
53  };
54 public:
55 
56  /// Constructor
57  FXDocument();
58 
59  /// Return true if document is modified
60  FXbool isModified() const { return modified; }
61 
62  /// Set its modified state
63  void setModified(FXbool mdfy=TRUE){ modified=mdfy; }
64 
65  /// Set document title
66  void setTitle(const FXString& name);
67 
68  /// Get document title
69  const FXString& getTitle() const { return title; }
70 
71  /// Set document filename
72  void setFilename(const FXString& path);
73 
74  /// Get document filename
75  const FXString& getFilename() const { return filename; }
76 
77  /// Save document to a stream
78  virtual void save(FXStream& store) const;
79 
80  /// Load document from a stream
81  virtual void load(FXStream& store);
82 
83  /// Destructor
84  virtual ~FXDocument();
85  };
86 
87 }
88 
89 #endif
Abstract base class for documents.
Definition: FXDocument.h:39
#define TRUE
Definition: fxdefs.h:32
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
FXString title(const FXString &file)
Return file title, i.e. document name only.
FXString name(const FXString &file)
Return name and extension part of the path name.
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Definition: FX4Splitter.h:31
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp