2012-11-22 12:30:02 +00:00
|
|
|
|
|
|
|
#include "view.hpp"
|
|
|
|
|
2012-11-22 13:10:23 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <QCloseEvent>
|
2012-11-22 13:49:58 +00:00
|
|
|
#include <QMenuBar>
|
2012-11-22 13:10:23 +00:00
|
|
|
|
|
|
|
#include "viewmanager.hpp"
|
|
|
|
|
|
|
|
void CSVDoc::View::closeEvent (QCloseEvent *event)
|
|
|
|
{
|
|
|
|
if (!mViewManager.closeRequest (this))
|
|
|
|
event->ignore();
|
|
|
|
}
|
|
|
|
|
2012-11-22 13:49:58 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-11-22 13:10:23 +00:00
|
|
|
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document)
|
|
|
|
: mViewManager (viewManager), mDocument (document)
|
2012-11-22 12:30:02 +00:00
|
|
|
{
|
2012-11-22 13:49:58 +00:00
|
|
|
setCentralWidget (new QWidget);
|
2012-11-22 12:30:02 +00:00
|
|
|
resize (200, 200);
|
|
|
|
setWindowTitle ("New Document");
|
2012-11-22 13:49:58 +00:00
|
|
|
|
|
|
|
setupUi();
|
2012-11-22 13:10:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const CSMDoc::Document *CSVDoc::View::getDocument() const
|
|
|
|
{
|
|
|
|
return mDocument;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMDoc::Document *CSVDoc::View::getDocument()
|
|
|
|
{
|
|
|
|
return mDocument;
|
2012-11-22 13:49:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVDoc::View::newView()
|
|
|
|
{
|
|
|
|
mViewManager.addView (mDocument);
|
2012-11-22 12:30:02 +00:00
|
|
|
}
|