summaryrefslogtreecommitdiff
path: root/MainWindow.h
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-11 01:57:18 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-11 01:57:18 +0930
commit1d38c1aa4c7fda8e55325783596df26e54a9777e (patch)
tree4b4b1f1f48c615ee2d0fa4dfa0d3e6452cbb216d /MainWindow.h
downloadfoxminesweeper-1d38c1aa4c7fda8e55325783596df26e54a9777e.tar.gz
foxminesweeper-1d38c1aa4c7fda8e55325783596df26e54a9777e.zip
initial progress
Diffstat (limited to 'MainWindow.h')
-rw-r--r--MainWindow.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/MainWindow.h b/MainWindow.h
new file mode 100644
index 0000000..1eb3514
--- /dev/null
+++ b/MainWindow.h
@@ -0,0 +1,78 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <fx.h>
+#include <FXScrollArea.h>
+#include <algorithm>
+#include "Board.h"
+#include "icons.h"
+
+class MainWindow : public FXMainWindow
+{
+ FXDECLARE(MainWindow)
+
+ public:
+ explicit MainWindow(FXApp* a);
+ ~MainWindow();
+ virtual void create();
+
+ /* Event system */
+ // Messages for our class
+ enum {
+ UI_Tile = FXMainWindow::ID_LAST,
+ UI_New,
+ };
+
+ /* Event handlers */
+ long on_Tile_Click(FXObject *sender, FXSelector sel, void *data);
+ long on_New_Click(FXObject *sender, FXSelector sel, void *data);
+ FXApp *get_app(){ return app; };
+
+
+ protected:
+ // Required constructor for FXObject
+ MainWindow(){}
+
+ private:
+ void create_ui();
+ void new_game(int width, int height, int minecount);
+ void draw_buttons();
+ FXHorizontalFrame *contents; // Content frame
+ FXVerticalFrame *canvasFrame; // Canvas frame
+ FXVerticalFrame *buttonFrame; // Button frame
+ FXScrollWindow *scroll_area;
+ FXApp *app;
+ Board *board;
+ FXMatrix *matrix;
+ std::vector<std::shared_ptr<FXButton>> tile_buttons;
+ /* icons */
+ FXIcon *bomb_icon;
+ FXIcon *empty_icon;
+ FXIcon *tile_1_icon;
+ FXIcon *tile_2_icon;
+ FXIcon *tile_3_icon;
+ FXIcon *tile_4_icon;
+ FXIcon *tile_5_icon;
+ FXIcon *tile_6_icon;
+ FXIcon *tile_7_icon;
+ FXIcon *tile_8_icon;
+
+
+};
+
+#endif // MAINWINDOW_H