| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
/* |
| 12 |
Core structures of mdi windowing code is either inspired or directly copied from |
| 13 |
Nokia Corporation's QT Toolkit examples. These examples are published under the |
| 14 |
terms of the BSD |
| 15 |
*/ |
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include "ui_settings.h" |
| 20 |
#include <QMainWindow> |
| 21 |
#include <QTextStream> |
| 22 |
#include <vector> |
| 23 |
|
| 24 |
extern QTextStream errout; |
| 25 |
|
| 26 |
class MdiChild; |
| 27 |
class CFrmSettings; |
| 28 |
QT_BEGIN_NAMESPACE |
| 29 |
class QAction; |
| 30 |
class QMenu; |
| 31 |
class QMdiArea; |
| 32 |
class QMdiSubWindow; |
| 33 |
QT_END_NAMESPACE |
| 34 |
|
| 35 |
class CMainWindow : public QMainWindow { |
| 36 |
Q_OBJECT |
| 37 |
|
| 38 |
public: |
| 39 |
CMainWindow(const QStringList &files); |
| 40 |
QMdiArea *mdiArea; |
| 41 |
void addFile(const QString &fileName); |
| 42 |
private slots: |
| 43 |
void slotSettings(); |
| 44 |
void slotRun(MdiChild *m = nullptr); |
| 45 |
void slotNew(); |
| 46 |
void slotOpen(); |
| 47 |
void slotSave(); |
| 48 |
void slotSaveAs(); |
| 49 |
void slotCut(); |
| 50 |
void slotCopy(); |
| 51 |
void slotPaste(); |
| 52 |
void slotAbout(); |
| 53 |
void slotRefreshMenus(); |
| 54 |
void slotNewLog(); |
| 55 |
void slotSaveLog(); |
| 56 |
MdiChild *createMdiChild(); |
| 57 |
void activateChild(QWidget *window); |
| 58 |
|
| 59 |
protected: |
| 60 |
void closeEvent(QCloseEvent *event); |
| 61 |
|
| 62 |
private: |
| 63 |
void setChild(); |
| 64 |
void createConsole(); |
| 65 |
void actions(); |
| 66 |
void menus(); |
| 67 |
void updateMenus(); |
| 68 |
void updateWindowMenu(); |
| 69 |
void updateFileMenu(); |
| 70 |
void toolBars(); |
| 71 |
void readSettings(); |
| 72 |
void writeSettings(); |
| 73 |
MdiChild *activeMdiChild(); |
| 74 |
MdiChild *prevChild; |
| 75 |
QMdiSubWindow *findMdiChild(const QString &fileName); |
| 76 |
int dfltRenderIdx, dfltLayoutIdx; |
| 77 |
|
| 78 |
QToolBar *tbFile; |
| 79 |
QToolBar *tbEdit; |
| 80 |
QToolBar *tbGraph; |
| 81 |
|
| 82 |
QAction *newAct; |
| 83 |
QAction *openAct; |
| 84 |
QAction *saveAct; |
| 85 |
QAction *saveAsAct; |
| 86 |
QAction *exitAct; |
| 87 |
QAction *cutAct; |
| 88 |
QAction *copyAct; |
| 89 |
QAction *pasteAct; |
| 90 |
QAction *closeAct; |
| 91 |
QAction *closeAllAct; |
| 92 |
QAction *tileAct; |
| 93 |
QAction *cascadeAct; |
| 94 |
QAction *nextAct; |
| 95 |
QAction *previousAct; |
| 96 |
QAction *separatorAct; |
| 97 |
QAction *aboutAct; |
| 98 |
|
| 99 |
QAction *settingsAct; |
| 100 |
QAction *layoutAct; |
| 101 |
|
| 102 |
CFrmSettings *frmSettings; |
| 103 |
// menus |
| 104 |
QMenu *mFile; |
| 105 |
QMenu *mEdit; |
| 106 |
QMenu *mGraph; |
| 107 |
QMenu *mWindow; |
| 108 |
QMenu *mHelp; |
| 109 |
}; |