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

FXDocument.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         D o c u m e n t   O b j e c t                         *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXDocument.h,v 1.22 2009/01/06 13:07:23 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXDOCUMENT_H
00024 #define FXDOCUMENT_H
00025 
00026 #ifndef FXOBJECT_H
00027 #include "FXObject.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 // Forward
00034 class FXWindow;
00035 
00036 
00037 /// Abstract base class for documents
00038 class FXAPI FXDocument : public FXObject {
00039   FXDECLARE(FXDocument)
00040 private:
00041   FXString     title;             // Title to appear above windows
00042   FXString     filename;          // File name to save to
00043   FXbool       modified;          // Document has been modified
00044 public:
00045   long onUpdTitle(FXObject*,FXSelector,void*);
00046   long onUpdFilename(FXObject*,FXSelector,void*);
00047 public:
00048   enum {
00049     ID_TITLE=10000,                 // Don't interfere with viewer's message id's
00050     ID_FILENAME,
00051     ID_LAST
00052     };
00053 public:
00054 
00055   /// Constructor
00056   FXDocument();
00057 
00058   /// Return true if document is modified
00059   FXbool isModified() const { return modified; }
00060 
00061   /// Set its modified state
00062   void setModified(FXbool mdfy=true){ modified=mdfy; }
00063 
00064   /// Set document title
00065   void setTitle(const FXString& name);
00066 
00067   /// Get document title
00068   const FXString& getTitle() const { return title; }
00069 
00070   /// Set document filename
00071   void setFilename(const FXString& path);
00072 
00073   /// Get document filename
00074   const FXString& getFilename() const { return filename; }
00075 
00076   /// Save document to a stream
00077   virtual void save(FXStream& store) const;
00078 
00079   /// Load document from a stream
00080   virtual void load(FXStream& store);
00081 
00082   /// Destructor
00083   virtual ~FXDocument();
00084   };
00085 
00086 }
00087 
00088 #endif

Copyright © 1997-2009 Jeroen van der Zijp