MdiSubWindow.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MdiSubWindow_H
00030 #define MdiSubWindow_H
00031
00032 #include <QMdiSubWindow>
00033
00034 class QEvent;
00035 class QCloseEvent;
00036 class QString;
00037 class Folder;
00038 class ApplicationWindow;
00039
00051 class MdiSubWindow: public QMdiSubWindow
00052 {
00053 Q_OBJECT
00054
00055 public:
00056
00058
00065 MdiSubWindow(const QString& label = QString(), ApplicationWindow *app = 0, const QString& name = QString(), Qt::WFlags f = 0);
00066
00068 enum CaptionPolicy{
00069 Name = 0,
00070 Label = 1,
00071 Both = 2
00072 };
00073 enum Status{Hidden = -1, Normal = 0, Minimized = 1, Maximized = 2};
00074
00076 ApplicationWindow *applicationWindow(){return d_app;};
00077
00079 QString windowLabel(){return QString(d_label);};
00081 void setWindowLabel(const QString& s) { d_label = s; updateCaption();};
00082
00084 QString name(){return objectName();};
00086 void setName(const QString& s){setObjectName(s); updateCaption();};
00087
00089 CaptionPolicy captionPolicy(){return d_caption_policy;};
00091 void setCaptionPolicy(CaptionPolicy policy) { d_caption_policy = policy; updateCaption(); }
00092
00094 QString birthDate(){return d_birthdate;};
00096 void setBirthDate(const QString& s){d_birthdate = s;};
00097
00099 QString aspect();
00101 Status status(){return d_status;};
00103 void setStatus(Status s);
00104
00105 virtual QString saveAsTemplate(const QString& ){return QString();};
00106
00108 virtual void restore(const QStringList& ){};
00109
00110 virtual void exportPDF(const QString&){};
00111
00112 virtual QString saveToString(const QString &, bool = false){return QString();};
00113
00114
00116 virtual QString sizeToString();
00117
00119 virtual void setHidden();
00120
00121
00123
00127 void closeEvent( QCloseEvent *);
00128 void resizeEvent( QResizeEvent* );
00129
00131 void askOnCloseEvent(bool ask){d_confirm_close = ask;};
00133 bool eventFilter(QObject *object, QEvent *e);
00135 Folder* folder(){return d_folder;};
00136
00138 void setFolder(Folder* f){d_folder = f;};
00139
00141 void notifyChanges(){emit modifiedWindow(this);};
00142
00143 void setNormal();
00144 void setMinimized();
00145 void setMaximized();
00146
00148 QSize minRestoreSize(){return d_min_restore_size;};
00149
00151
00152
00153
00154
00155
00156 static QString parseAsciiFile(const QString& fname, const QString &commentString, int endLine,
00157 int ignoreFirstLines, int maxRows, int& rows);
00158
00159 public slots:
00160 virtual void print(){};
00161
00162 signals:
00164 void closedWindow(MdiSubWindow *);
00166 void hiddenWindow(MdiSubWindow *);
00167 void modifiedWindow(MdiSubWindow *);
00168 void resizedWindow(MdiSubWindow *);
00170 void statusChanged(MdiSubWindow *);
00172 void showContextMenu();
00173
00174 protected:
00176 virtual void changeEvent(QEvent *event);
00177
00178 private:
00180 static QString parseMacAsciiFile(const QString& fname, const QString &commentString,
00181 int ignoreFirstLines, int maxRows, int& rows);
00183 void updateCaption();
00185 ApplicationWindow *d_app;
00187 Folder *d_folder;
00189
00192 QString d_label;
00194 Status d_status;
00196
00199 CaptionPolicy d_caption_policy;
00201 bool d_confirm_close;
00203 QString d_birthdate;
00205 QSize d_min_restore_size;
00206 };
00207
00208 #endif