testing-repository/Gtkmm3/gtk141_minesweeper2/src/InputBox.hh

34 lines
785 B
C++
Raw Normal View History

2022-10-17 22:21:25 +08:00
#pragma once
#include <gtkmm.h>
2022-10-17 23:05:19 +08:00
#include <vector>
#include "../json_nlohmann/json.hpp"
using json = nlohmann::json;
2022-10-17 22:21:25 +08:00
class InputBox : public Gtk::Dialog{
public:
2022-10-17 23:05:19 +08:00
static InputBox *create(Gtk::Window &parent);
2022-10-17 22:21:25 +08:00
InputBox(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_Glade);
2022-10-17 23:05:19 +08:00
void set_game_time(int time);
protected:
void on_response(int response_id) override;
2022-10-17 22:21:25 +08:00
private:
2022-10-17 23:05:19 +08:00
int game_time;
// Data to write to json file
json data;
std::vector<std::string> names;
std::vector<int> times;
// Builder Object
2022-10-17 22:21:25 +08:00
Glib::RefPtr<Gtk::Builder> ref_builder;
2022-10-17 23:05:19 +08:00
// Child widget
Gtk::Entry *entry_name;
2022-10-17 23:17:11 +08:00
// Signal Handlers
void entry_activated();
2022-10-17 22:21:25 +08:00
};