blob: d43d848d97d180532de37fdd44a602e27223c6f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <FL/Fl_Native_File_Chooser.H>
#include <memory>
#include <stdio.h>
#include <string>
#include "menu_callbacks.hpp"
#include "solution_algorithm.hpp"
void load_file_callback(Fl_Widget *sender, void*)
{
auto dialog = Fl_Native_File_Chooser{};
dialog.type(Fl_Native_File_Chooser::BROWSE_FILE);
dialog.filter("JPEG Files (*.jpg)\tPNG Files (*.png)");
#if defined(_WIN32)
dialog.directory((string {getenv("HOMEPATH")} + "\\Desktop").c_str());
#else
dialog.directory((std::string {getenv("HOME")} + "/Desktop").c_str());
#endif
dialog.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM |
Fl_Native_File_Chooser::NEW_FOLDER);
if (dialog.show() == 0)
printf("%s\n", dialog.filename());
}
void exit_callback(Fl_Widget *w, void*)
{
w->parent()->hide();
}
void solve_problem_callback(Fl_Widget *w, void *gp)
{
std::unique_ptr<ASearch> algorithm =
ASearch::Start(reinterpret_cast<GameParams*>(gp));
Node *goal = algorithm->FindSolution();
algorithm->ShowSolution(goal);
}
void about_callback(Fl_Widget *w, void*)
{
}
|