-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathBox_Picture2.cpp
More file actions
41 lines (35 loc) · 1.06 KB
/
Box_Picture2.cpp
File metadata and controls
41 lines (35 loc) · 1.06 KB
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
41
#include <filesystem>
#include <memory>
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Window.H>
using namespace std;
using namespace std::filesystem;
namespace Examples {
class Main_Window : public Fl_Window {
public:
Main_Window() : Fl_Window {200, 100, 300, 300, "Box with picture 2 example"} {
resizable(box1);
box1.align(FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
box1.box(FL_GTK_DOWN_BOX);
}
void show(int argc, char** argv) {
#if __APPLE__
picture = make_unique<Fl_PNG_Image>((path {argv[0]}.remove_filename()/".."/"Resources"/"Logo.png").string().c_str());
#else
picture = make_unique<Fl_PNG_Image>((path {argv[0]}.remove_filename()/"Resources"/"Logo.png").string().c_str());
#endif
box1.image(picture.get());
Fl_Window::show(argc, argv);
}
private:
Fl_Box box1 {20, 20, 260, 260};
unique_ptr<Fl_PNG_Image> picture;
};
}
auto main(int argc, char *argv[]) -> int {
auto window = Examples::Main_Window {};
window.show(argc, argv);
return Fl::run();
}