summaryrefslogtreecommitdiffstats
path: root/tdefifteen/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdefifteen/src/mainwindow.cpp')
-rw-r--r--tdefifteen/src/mainwindow.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tdefifteen/src/mainwindow.cpp b/tdefifteen/src/mainwindow.cpp
new file mode 100644
index 00000000..258b0220
--- /dev/null
+++ b/tdefifteen/src/mainwindow.cpp
@@ -0,0 +1,45 @@
+// Author: Denis Kozadaev - (c) 2017-2020
+
+
+#include "mainwindow.h"
+
+#include <tdeactionclasses.h>
+#include <tdemenubar.h>
+
+#include <kiconloader.h>
+
+
+MainWindow::MainWindow(TQWidget* parent, const char* name) : TDEMainWindow(parent, name)
+{
+ TDEAction* actionQuit = KStdAction::quit(this, SLOT(close()), 0);
+ TDEAction* actionNew = new TDEAction( "&New Game", "reload", TQt::CTRL + TQt::Key_N, this, SLOT(newGame()), this, "New Game");
+
+ mMenu = new TDEPopupMenu(this);
+ mMenu->insertItem(SmallIcon("images_display"), "Load an image", this, SLOT(loadImage()), TQt::CTRL + TQt::Key_L);
+ mMenu->insertSeparator();
+
+ actionNew->plug(mMenu);
+ actionQuit->plug(mMenu);
+ menuBar()->insertItem(tr("Menu"), mMenu);
+
+ mBoard = new GameBoard(this);
+ setCentralWidget(mBoard);
+}
+
+MainWindow::~MainWindow()
+{
+ delete mBoard;
+ delete mMenu;
+}
+
+void MainWindow::newGame()
+{
+ mBoard->newGame();
+}
+
+void MainWindow::loadImage()
+{
+ mBoard->loadImage();
+}
+
+#include "mainwindow.moc"