![]() |
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,2010 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 #ifndef FXDOCUMENT_H 00022 #define FXDOCUMENT_H 00023 00024 #ifndef FXOBJECT_H 00025 #include "FXObject.h" 00026 #endif 00027 00028 namespace FX { 00029 00030 00031 // Forward 00032 class FXWindow; 00033 00034 00035 /// Abstract base class for documents 00036 class FXAPI FXDocument : public FXObject { 00037 FXDECLARE(FXDocument) 00038 private: 00039 FXString title; // Title to appear above windows 00040 FXString filename; // File name to save to 00041 FXbool modified; // Document has been modified 00042 public: 00043 long onUpdTitle(FXObject*,FXSelector,void*); 00044 long onUpdFilename(FXObject*,FXSelector,void*); 00045 public: 00046 enum { 00047 ID_TITLE=10000, // Don't interfere with viewer's message id's 00048 ID_FILENAME, 00049 ID_LAST 00050 }; 00051 public: 00052 00053 /// Constructor 00054 FXDocument(); 00055 00056 /// Return true if document is modified 00057 FXbool isModified() const { return modified; } 00058 00059 /// Set its modified state 00060 void setModified(FXbool mdfy=true){ modified=mdfy; } 00061 00062 /// Set document title 00063 void setTitle(const FXString& name); 00064 00065 /// Get document title 00066 const FXString& getTitle() const { return title; } 00067 00068 /// Set document filename 00069 void setFilename(const FXString& path); 00070 00071 /// Get document filename 00072 const FXString& getFilename() const { return filename; } 00073 00074 /// Save document to a stream 00075 virtual void save(FXStream& store) const; 00076 00077 /// Load document from a stream 00078 virtual void load(FXStream& store); 00079 00080 /// Destructor 00081 virtual ~FXDocument(); 00082 }; 00083 00084 } 00085 00086 #endif
|
|