| 46 | } |
| 47 | |
| 48 | int main(int argc, char** argv){ |
| 49 | if(argc > 1){ |
| 50 | if(LoadImage(argv[1])){ |
| 51 | return -1; |
| 52 | } |
| 53 | } else if(LoadImage(Lemon::GUI::FileDialog("."))){ |
| 54 | return -1; |
| 55 | } |
| 56 | |
| 57 | fileMenu.first = "File"; |
| 58 | fileMenu.second.push_back({.id = IMGVIEW_OPEN, .name = std::string("Open...")}); |
| 59 | |
| 60 | window = new Lemon::GUI::Window("Image Viewer", {800, 500}, 0, Lemon::GUI::WindowType::GUI); |
| 61 | window->CreateMenuBar(); |
| 62 | window->menuBar->items.push_back(fileMenu); |
| 63 | window->OnMenuCmd = OnWindowCmd; |
| 64 | |
| 65 | sv = new Lemon::GUI::ScrollView({{0, 0}, {window->GetSize().x, window->GetSize().y}}); |
| 66 | imgWidget = new Lemon::GUI::Bitmap({{0, 0}, {0, 0}}, &image); |
| 67 | |
| 68 | sv->AddWidget(imgWidget); |
| 69 | |
| 70 | window->AddWidget(sv); |
| 71 | |
| 72 | while(!window->closed){ |
| 73 | Lemon::LemonEvent ev; |
| 74 | while(window->PollEvent(ev)){ |
| 75 | window->GUIHandleEvent(ev); |
| 76 | } |
| 77 | |
| 78 | window->Paint(); |
| 79 | window->WaitEvent(); |
| 80 | } |
| 81 | } |
nothing calls this directly
no test coverage detected