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
00107 virtual void restore(const QStringList& ){};
00108 virtual void save(const QString&, const QString &, bool = false){};
00109 virtual void exportPDF(const QString&){};
00110
00111
00113 virtual QString sizeToString();
00114
00116 virtual void setHidden();
00117
00118
00120
00124 void closeEvent( QCloseEvent *);
00125 void resizeEvent( QResizeEvent* );
00126
00128 void askOnCloseEvent(bool ask){d_confirm_close = ask;};
00130 bool eventFilter(QObject *object, QEvent *e);
00132 Folder* folder(){return d_folder;};
00133
00135 void setFolder(Folder* f){d_folder = f;};
00136
00137 void setNormal();
00138 void setMinimized();
00139 void setMaximized();
00140
00142 QSize minRestoreSize(){return d_min_restore_size;};
00143
00145
00146
00147
00148
00149
00150 static QString parseAsciiFile(const QString& fname, const QString &commentString, int endLine,
00151 int ignoreFirstLines, int maxRows, int& rows);
00152
00153 public slots:
00154 virtual void print(){};
00156 void notifyChanges(){emit modifiedWindow(this);};
00157
00158 signals:
00160 void closedWindow(MdiSubWindow *);
00162 void hiddenWindow(MdiSubWindow *);
00163 void modifiedWindow(MdiSubWindow *);
00164 void resizedWindow(MdiSubWindow *);
00166 void statusChanged(MdiSubWindow *);
00168 void showContextMenu();
00169
00170 protected:
00172 virtual void changeEvent(QEvent *event);
00173
00174 private:
00176 static QString parseMacAsciiFile(const QString& fname, const QString &commentString,
00177 int ignoreFirstLines, int maxRows, int& rows);
00179 void updateCaption();
00181 ApplicationWindow *d_app;
00183 Folder *d_folder;
00185
00188 QString d_label;
00190 Status d_status;
00192
00195 CaptionPolicy d_caption_policy;
00197 bool d_confirm_close;
00199 QString d_birthdate;
00201 QSize d_min_restore_size;
00202 };
00203
00204 #endif