mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
11db8c1697
Clicking the button generates a WindowCloseRequest event which the client app then has to deal with. The default behavior for GWindow is to close() itself. I also added a flag, GWindow::should_exit_event_loop_on_close() which does what it sounds like it does. This patch exposed some bugs in GWindow and GWidget teardown.
22 lines
479 B
C++
22 lines
479 B
C++
#include <LibGUI/GEventLoop.h>
|
|
#include <LibGUI/GWindow.h>
|
|
#include "ClockWidget.h"
|
|
|
|
int main(int, char**)
|
|
{
|
|
GEventLoop loop;
|
|
|
|
auto* window = new GWindow;
|
|
window->set_title("Clock");
|
|
window->set_rect({ 600, 100, 100, 40 });
|
|
window->set_should_exit_app_on_close(true);
|
|
|
|
auto* clock_widget = new ClockWidget;
|
|
clock_widget->set_relative_rect({ 0, 0, 100, 40 });
|
|
window->set_main_widget(clock_widget);
|
|
|
|
window->show();
|
|
return loop.exec();
|
|
}
|
|
|
|
|