diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 51078d4481..847462964a 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "viewmanager.hpp" @@ -13,11 +14,25 @@ void CSVDoc::View::closeEvent (QCloseEvent *event) event->ignore(); } +void CSVDoc::View::setupUi() +{ + // window menu + QMenu *view = menuBar()->addMenu (tr ("&View")); + + QAction *newWindow = new QAction (tr ("&New View"), this); + connect (newWindow, SIGNAL (triggered()), this, SLOT (newView())); + + view->addAction (newWindow); +} + CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document) : mViewManager (viewManager), mDocument (document) { + setCentralWidget (new QWidget); resize (200, 200); setWindowTitle ("New Document"); + + setupUi(); } const CSMDoc::Document *CSVDoc::View::getDocument() const @@ -28,4 +43,9 @@ const CSMDoc::Document *CSVDoc::View::getDocument() const CSMDoc::Document *CSVDoc::View::getDocument() { return mDocument; +} + +void CSVDoc::View::newView() +{ + mViewManager.addView (mDocument); } \ No newline at end of file diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index b12bb7e41a..df88ff2cc8 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -1,7 +1,9 @@ #ifndef CSV_DOC_VIEW_H #define CSV_DOC_VIEW_H -#include +#include + +class QAction; namespace CSMDoc { @@ -12,7 +14,7 @@ namespace CSVDoc { class ViewManager; - class View : public QWidget + class View : public QMainWindow { Q_OBJECT @@ -27,6 +29,8 @@ namespace CSVDoc void closeEvent (QCloseEvent *event); + void setupUi(); + public: View (ViewManager& viewManager, CSMDoc::Document *document); @@ -35,6 +39,10 @@ namespace CSVDoc const CSMDoc::Document *getDocument() const; CSMDoc::Document *getDocument(); + + private slots: + + void newView(); }; }