From 2d486c096ec890425ef0b23dcb6486e87ccf9788 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 18 Feb 2012 14:37:21 +0000 Subject: Created basic Qt MDI area. --- src/Makefile.am | 8 +++++--- src/editor.cc | 18 +++++++++++++++++- src/mainwindow.cc | 35 +++++++++++++++++++++++++++++++++++ src/mainwindow.h | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 src/mainwindow.cc create mode 100644 src/mainwindow.h diff --git a/src/Makefile.am b/src/Makefile.am index 5d98d2d..231fd8a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,13 +3,15 @@ bin_PROGRAMS = editor # You have two .cpp files you wrote, editor.cpp and another.cpp # Remember to include the name of the resource file with the .cpp extension. editor_SOURCES = \ - editor.cc + editor.cc \ + mainwindow.cc # You have one .h file, it's called editor.h. Therefore, here I list # its mocced name, moc_editor.cpp. nodist_editor_SOURCES = \ - moc_editor.cc + moc_mainwindow.cc # This rule lets GNU make create any moc_*.cpp from the equivalent *.h moc_%.cc: %.h - moc $< -o $@ \ No newline at end of file + moc $< -o $@ + \ No newline at end of file diff --git a/src/editor.cc b/src/editor.cc index 96fe0ea..28f75a7 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -1,4 +1,20 @@ +/* + editor.cc + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ -int main(int arc, char ** argv) +#include +#include "mainwindow.h" + +int main(int argc, char ** argv) { + + QApplication editor_application(argc, argv); + editor::MainWindow editor_mainwindow; + + editor_mainwindow.show(); + return editor_application.exec(); + } diff --git a/src/mainwindow.cc b/src/mainwindow.cc new file mode 100644 index 0000000..22347a5 --- /dev/null +++ b/src/mainwindow.cc @@ -0,0 +1,35 @@ +/* + mainwindow.cc + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ + +#include + +namespace editor +{ + +MainWindow::MainWindow() +{ + // set window title + setWindowTitle(tr("Project::OSiRiON zone editor")); + + // initialize MDI (multiple document interface) area + mainwindow_mdiarea = new QMdiArea(); + mainwindow_mdiarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + mainwindow_mdiarea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setCentralWidget(mainwindow_mdiarea); + + // initialize menu bar + init_menu(); + +} + +void MainWindow::init_menu() +{ + mainwindow_filemenu = menuBar()->addMenu(tr("&File")); + mainwindow_editmenu = menuBar()->addMenu(tr("&Edit")); +} + +} \ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h new file mode 100644 index 0000000..702cc18 --- /dev/null +++ b/src/mainwindow.h @@ -0,0 +1,38 @@ +/* + mainwindow.h + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_EDITOR_MAINWINDOW__ +#define __INCLUDED_EDITOR_MAINWINDOW__ + +#include + +#include + +class QMenu; +class QMdiArea; + +namespace editor +{ + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +private: + void init_menu(); + + QMdiArea *mainwindow_mdiarea; + QMenu *mainwindow_filemenu; + QMenu *mainwindow_editmenu; +}; + +} + +#endif // __INCLUDED_EDITOR_MAINWINDOW__ \ No newline at end of file -- cgit v1.2.3