| 144 | } |
| 145 | |
| 146 | int main(int argc, char** argv){ |
| 147 | window = new Lemon::GUI::Window("Text Editor", {512, 256}, WINDOW_FLAGS_RESIZABLE, Lemon::GUI::WindowType::GUI); |
| 148 | window->CreateMenuBar(); |
| 149 | |
| 150 | fileMenu.first = "File"; |
| 151 | fileMenu.second.push_back({.id = TEXTEDIT_OPEN, .name = std::string("Open...")}); |
| 152 | fileMenu.second.push_back({.id = TEXTEDIT_SAVEAS, .name = std::string("Save As...")}); |
| 153 | fileMenu.second.push_back({.id = TEXTEDIT_SAVE, .name = std::string("Save...")}); |
| 154 | |
| 155 | window->menuBar->items.push_back(fileMenu); |
| 156 | |
| 157 | window->OnMenuCmd = OnWindowCmd; |
| 158 | window->OnPaint = OnWindowPaint; |
| 159 | |
| 160 | textBox = new ExtendedTextBox({{0, 0}, {0, 20}}); |
| 161 | window->AddWidget(textBox); |
| 162 | textBox->SetLayout(Lemon::GUI::LayoutSize::Stretch, Lemon::GUI::LayoutSize::Stretch, Lemon::GUI::WidgetAlignment::WAlignLeft); |
| 163 | |
| 164 | textBox->font = Lemon::Graphics::LoadFont("/initrd/sourcecodepro.ttf", "monospace", 12); |
| 165 | textBox->multiline = true; |
| 166 | textBox->editable = true; |
| 167 | |
| 168 | if(argc > 1){ |
| 169 | LoadFile(argv[1]); |
| 170 | } |
| 171 | |
| 172 | while(!window->closed){ |
| 173 | Lemon::LemonEvent ev; |
| 174 | while(window->PollEvent(ev)){ |
| 175 | window->GUIHandleEvent(ev); |
| 176 | } |
| 177 | |
| 178 | window->Paint(); |
| 179 | } |
| 180 | |
| 181 | delete window; |
| 182 | return 0; |
| 183 | } |
nothing calls this directly
no test coverage detected