![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * D o c u m e n t O b j e c t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 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.9 2002/01/18 22:42:52 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXDOCUMENT_H 00025 #define FXDOCUMENT_H 00026 00027 #ifndef FXOBJECT_H 00028 #include "FXObject.h" 00029 #endif 00030 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 FXString getTitle() const { return title; } 00069 00070 /// Set document filename 00071 void setFilename(const FXString& path); 00072 00073 /// Get document filename 00074 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 #endif 00087