41 lines
939 B
C++
41 lines
939 B
C++
#pragma once
|
|
|
|
#include <gtkmm.h>
|
|
#include <memory>
|
|
#include "minefield.hpp"
|
|
#include "board_widget.hpp"
|
|
|
|
class MainWindow : public Gtk::ApplicationWindow {
|
|
public:
|
|
MainWindow();
|
|
~MainWindow() override;
|
|
|
|
private:
|
|
// UI Setup
|
|
void setup_header_bar();
|
|
void setup_board();
|
|
|
|
// Actions
|
|
void start_new_game(const GameDifficulty& difficulty);
|
|
void on_game_state_changed();
|
|
bool on_timer_tick();
|
|
void show_game_over_dialog(bool won);
|
|
|
|
// Widgets
|
|
Gtk::HeaderBar header_bar_;
|
|
Gtk::Button btn_new_game_;
|
|
Gtk::MenuButton btn_difficulty_;
|
|
Gtk::Popover menu_difficulty_;
|
|
Gtk::Box box_difficulty_; // Content for popover
|
|
|
|
Gtk::Label lbl_time_;
|
|
Gtk::Label lbl_flags_;
|
|
|
|
BoardWidget board_widget_;
|
|
|
|
// Game State
|
|
std::shared_ptr<Minefield> minefield_;
|
|
sigc::connection timer_conn_;
|
|
GameDifficulty current_difficulty_ = Minefield::DifficultyEasy;
|
|
};
|