forked from skift-org/skift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
34 lines (22 loc) · 999 Bytes
/
main.cpp
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
#include <libsettings/Service.h>
#include <libsystem/process/Process.h>
#include <libwidget/Application.h>
#include <libwidget/Components.h>
#include <libwidget/Elements.h>
int main(int argc, char **argv)
{
if (argc == 1)
return -1;
Widget::Window *window = new Widget::Window(WINDOW_RESIZABLE);
window->size(Math::Vec2i(700, 500));
window->root()->add(Widget::titlebar(Graphic::Icon::get("image"), "Image Viewer"));
auto toolbar = window->root()->add(Widget::panel());
auto bitmap = Graphic::Bitmap::load_from_or_placeholder(argv[1]);
auto set_has_wallaper = toolbar->add(Widget::basic_button(Graphic::Icon::get("wallpaper"), "Set As Wallpaper", [&] {
Settings::Service::the()->write(Settings::Path::parse("appearance:wallpaper.image"), process_resolve(argv[1]));
}));
auto image = window->root()->add(Widget::image(bitmap));
image->flags(Widget::Element::FILL);
window->show();
return Widget::Application::the().run();
}