00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GRAPHDOCUMENT_H
00021 #define GRAPHDOCUMENT_H
00022
00023 #include <QList>
00024 #include <QObject>
00025 #include "rocslib_export.h"
00026
00027 class Graph;
00028
00032 class ROCSLIB_EXPORT GraphDocument : public QObject, public QList<Graph*>
00033 {
00034 Q_OBJECT
00035
00036 public:
00037 enum Type {Simple = 0, Oriented};
00041 GraphDocument( const QString name, int width = 800, int heigth = 600 );
00042
00044 GraphDocument( const GraphDocument& gd );
00045
00047 ~GraphDocument();
00048
00050 bool isModified();
00051
00055 void setName( const QString& name );
00056
00058 QString name() const;
00059
00063 void setHeight( qreal height );
00064
00066 qreal height() const;
00067
00071 void setWidth( qreal width );
00072
00074 qreal width() const;
00075
00076
00077 void savedDocumentAt( const QString& fileName );
00078
00079 const QString& documentPath() const ;
00080
00081 bool saveAsInternalFormat( const QString& filename );
00082 void loadFromInternalFormat( const QString& filename );
00083 public slots:
00088 Graph* addGraph( QString name = "untitled" );
00089 Graph* activeGraph()
00090 {
00091 return _activeGraph;
00092 }
00093 void setActiveGraph( Graph* g );
00094
00095 signals:
00098 void graphCreated( Graph* g );
00099
00102 void graphRemoved( int i );
00103
00106 void nameChanged( QString name );
00107
00110 void heightChanged( qreal height );
00111
00114 void widthChanged( qreal width );
00115
00116 void activeGraphChanged( Graph* g );
00117 private:
00118 QString k_buf;
00119 void savePropertiesInternalFormat( QObject* o );
00120 QString _lastSavedDocumentPath;
00121 QString _name;
00122 qreal _width;
00123 qreal _height;
00124 bool _modified;
00125 bool _saved;
00126 Graph* _activeGraph;
00127 };
00128
00129 #endif