Source: k2dgrflow/k2dgrflowdoc.h
|
|
|
|
/***************************************************************************
k2dgrflowdoc.h - description
-------------------
begin : Mon Apr 23 11:45:13 CEST 2001
copyright : (C) 2001 by benny
email : bm@cage.rug.ac.be
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef K2DGRFLOWDOC_H
#define K2DGRFLOWDOC_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
// include files for QT
#include <qobject.h>
#include <qstring.h>
#include <qlist.h>
// include files for KDE
#include <kurl.h>
// own include files
#include <gfmfile.h>
// forward declaration of the K2dGrFlow classes
class K2dGrFlowView;
class K2dDomain;
class K2dBorderBase;
/** K2dGrFlowDoc provides a document object for a document-view model.
*
* The K2dGrFlowDoc class provides a document object that can be used in conjunction with the classes K2dGrFlowApp and K2dGrFlowView
* to create a document-view model for standard KDE applications based on KApplication and KMainWindow. Thereby, the document object
* is created by the K2dGrFlowApp instance and contains the document structure with the according methods for manipulation of the document
* data by K2dGrFlowView objects. Also, K2dGrFlowDoc contains the methods for serialization of the document data from and to files.
*
* @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
* @version KDevelop version 1.2 code generation
*/
class K2dGrFlowDoc : public QObject
{
Q_OBJECT
public:
/** Constructor for the fileclass of the application */
K2dGrFlowDoc(QWidget *parent, const char *name=0);
/** Destructor for the fileclass of the application */
~K2dGrFlowDoc();
/** adds a view to the document which represents the document contents. Usually this is your main view. */
void addView(K2dGrFlowView *view);
/** removes a view from the list of currently connected views */
void removeView(K2dGrFlowView *view);
/** sets the modified flag for the document after a modifying action on the view connected to the document.*/
void setModified(bool _m=true){ modified=_m; };
/** returns if the document is modified or not. Use this to determine if your document needs saving by the user on closing.*/
bool isModified(){ return modified; };
/** "save modified" - asks the user for saving if the document is modified */
bool saveModified();
/** deletes the document's contents */
void deleteContents();
/** initializes the document generally */
bool newDocument();
/** closes the acutal document */
void closeDocument();
/** loads the document by filename and format and emits the updateViews() signal */
bool openDocument(const KURL& url, const char *format=0);
/** saves the document under filename and format.*/
bool saveDocument(const KURL& url, const char *format=0);
/** returns the KURL of the document */
const KURL& URL() const;
/** sets the URL of the document */
void setURL(const KURL& url);
/** is the model new, so unsaved, then return true */
bool isNew(){return modelFile.untitled(); };
/** get the d parameter from disk
*/
QString get_d();
/** write d parameter to disk
*/
void put_d(const double);
/** get the domain from disk
*/
K2dDomain *get_domain();
/** write the domain to disk
*/
void put_domain(K2dDomain * );
public slots:
/** calls repaint() on all views connected to the document object and is called by the view by which the document has been changed.
* As this view normally repaints itself, it is excluded from the paintEvent.
*/
void slotUpdateAllViews(K2dGrFlowView *sender);
public:
/** the list of the views currently connected to the document */
static QList<K2dGrFlowView> *pViewList;
private:
/** the modified flag of the current document */
bool modified;
KURL doc_url;
/** the model file is the core of our document class. It contains all necessary data
*/
gfmFile modelFile;
/** grouping of identical coding in one function, for use in get_domain method
*/
void get_domainBase(K2dBorderBase *);
};
#endif // K2DGRFLOWDOC_H
Generated by: benny@okidoki on Thu Jun 21 10:41:51 2001, using kdoc 2.0a53. |