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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXDocument.h,v 1.16 2006/01/22 17:58:01 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXDOCUMENT_H
00025 #define FXDOCUMENT_H
00026 
00027 #ifndef FXOBJECT_H
00028 #include "FXObject.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Forward
00035 class FXWindow;
00036 
00037 
00038 /// Abstract base class for documents
00039 class FXAPI FXDocument : public FXObject {
00040   FXDECLARE(FXDocument)
00041 private:
00042   FXString     title;             // Title to appear above windows
00043   FXString     filename;          // File name to save to
00044   FXbool       modified;          // Document has been modified
00045 public:
00046   long onUpdTitle(FXObject*,FXSelector,void*);
00047   long onUpdFilename(FXObject*,FXSelector,void*);
00048 public:
00049   enum {
00050     ID_TITLE=10000,                 // Don't interfere with viewer's message id's
00051     ID_FILENAME,
00052     ID_LAST
00053     };
00054 public:
00055 
00056   /// Constructor
00057   FXDocument();
00058 
00059   /// Return true if document is modified
00060   FXbool isModified() const { return modified; }
00061 
00062   /// Set its modified state
00063   void setModified(FXbool mdfy=TRUE){ modified=mdfy; }
00064 
00065   /// Set document title
00066   void setTitle(const FXString& name);
00067 
00068   /// Get document title
00069   const FXString& getTitle() const { return title; }
00070 
00071   /// Set document filename
00072   void setFilename(const FXString& path);
00073 
00074   /// Get document filename
00075   const FXString& getFilename() const { return filename; }
00076 
00077   /// Save document to a stream
00078   virtual void save(FXStream& store) const;
00079 
00080   /// Load document from a stream
00081   virtual void load(FXStream& store);
00082 
00083   /// Destructor
00084   virtual ~FXDocument();
00085   };
00086 
00087 }
00088 
00089 #endif

Copyright © 1997-2005 Jeroen van der Zijp