main.cpp 781 B

12345678910111213141516171819202122232425262728
  1. #include "HexEditorWidget.h"
  2. #include <LibDraw/PNGLoader.h>
  3. int main(int argc, char** argv)
  4. {
  5. GApplication app(argc, argv);
  6. auto window = GWindow::construct();
  7. window->set_title("Hex Editor");
  8. window->set_rect(20, 200, 640, 400);
  9. auto hex_editor_widget = HexEditorWidget::construct();
  10. window->set_main_widget(hex_editor_widget);
  11. window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
  12. if (hex_editor_widget->request_close())
  13. return GWindow::CloseRequestDecision::Close;
  14. return GWindow::CloseRequestDecision::StayOpen;
  15. };
  16. if (argc >= 2)
  17. hex_editor_widget->open_file(argv[1]);
  18. window->show();
  19. window->set_icon(load_png("/res/icons/16x16/app-hexeditor.png"));
  20. return app.exec();
  21. }