1 /******************************************************************************** 2 * * 3 * D o c u m e n t O b j e c t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1998,2005 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.15 2005/01/16 16:06:06 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 { 40 FXDECLARE(FXDocument) 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 isModified()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 getTitle()69 const FXString& getTitle() const { return title; } 70 71 /// Set document filename 72 void setFilename(const FXString& path); 73 74 /// Get document filename getFilename()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 90