MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / main

Function main

Applications/ImgView/main.cpp:48–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int 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}

Callers

nothing calls this directly

Calls 9

FileDialogFunction · 0.85
CreateMenuBarMethod · 0.80
PollEventMethod · 0.80
GUIHandleEventMethod · 0.80
WaitEventMethod · 0.80
LoadImageFunction · 0.70
GetSizeMethod · 0.45
AddWidgetMethod · 0.45
PaintMethod · 0.45

Tested by

no test coverage detected