mainwindow.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. Core structures of mdi windowing code is either inspired or directly copied from
  12. Nokia Corporation's QT Toolkit examples. These examples are published under the
  13. terms of the BSD
  14. */
  15. #pragma once
  16. #include "ui_settings.h"
  17. #include <QMainWindow>
  18. #include <QTextStream>
  19. #include <vector>
  20. extern QTextStream errout;
  21. class MdiChild;
  22. class CFrmSettings;
  23. QT_BEGIN_NAMESPACE
  24. class QAction;
  25. class QMenu;
  26. class QMdiArea;
  27. class QMdiSubWindow;
  28. QT_END_NAMESPACE
  29. class CMainWindow : public QMainWindow {
  30. Q_OBJECT
  31. public:
  32. CMainWindow(const QStringList &files);
  33. QMdiArea *mdiArea;
  34. void addFile(const QString &fileName);
  35. private slots:
  36. void slotSettings();
  37. void slotRun(MdiChild *m = nullptr);
  38. void slotNew();
  39. void slotOpen();
  40. void slotSave();
  41. void slotSaveAs();
  42. void slotCut();
  43. void slotCopy();
  44. void slotPaste();
  45. void slotAbout();
  46. void slotRefreshMenus();
  47. void slotNewLog();
  48. void slotSaveLog();
  49. MdiChild *createMdiChild();
  50. void activateChild(QWidget *window);
  51. protected:
  52. void closeEvent(QCloseEvent *event);
  53. private:
  54. void setChild();
  55. void createConsole();
  56. void actions();
  57. void menus();
  58. void updateMenus();
  59. void updateWindowMenu();
  60. void updateFileMenu();
  61. void toolBars();
  62. void readSettings();
  63. void writeSettings();
  64. MdiChild *activeMdiChild();
  65. MdiChild *prevChild;
  66. QMdiSubWindow *findMdiChild(const QString &fileName);
  67. int dfltRenderIdx, dfltLayoutIdx;
  68. QToolBar *tbFile;
  69. QToolBar *tbEdit;
  70. QToolBar *tbGraph;
  71. QAction *newAct;
  72. QAction *openAct;
  73. QAction *saveAct;
  74. QAction *saveAsAct;
  75. QAction *exitAct;
  76. QAction *cutAct;
  77. QAction *copyAct;
  78. QAction *pasteAct;
  79. QAction *closeAct;
  80. QAction *closeAllAct;
  81. QAction *tileAct;
  82. QAction *cascadeAct;
  83. QAction *nextAct;
  84. QAction *previousAct;
  85. QAction *separatorAct;
  86. QAction *aboutAct;
  87. QAction *settingsAct;
  88. QAction *layoutAct;
  89. CFrmSettings *frmSettings;
  90. // menus
  91. QMenu *mFile;
  92. QMenu *mEdit;
  93. QMenu *mGraph;
  94. QMenu *mWindow;
  95. QMenu *mHelp;
  96. };