1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:57:44 +00:00

Port all apps to GApplication.

This commit is contained in:
Andreas Kling 2019-02-11 14:56:23 +01:00
parent 9483b39227
commit 3351f1ccc1
10 changed files with 48 additions and 106 deletions

View file

@ -2,8 +2,18 @@
#include <LibGUI/GEventLoop.h>
#include <LibGUI/GMenuBar.h>
static GApplication* s_the;
GApplication& GApplication::the()
{
ASSERT(s_the);
return *s_the;
}
GApplication::GApplication(int argc, char** argv)
{
ASSERT(!s_the);
s_the = this;
m_event_loop = make<GEventLoop>();
}
@ -16,6 +26,11 @@ int GApplication::exec()
return m_event_loop->exec();
}
void GApplication::exit(int exit_code)
{
m_event_loop->exit(exit_code);
}
void GApplication::set_menubar(OwnPtr<GMenuBar>&& menubar)
{
m_menubar = move(menubar);

View file

@ -7,9 +7,12 @@ class GMenuBar;
class GApplication {
public:
static GApplication& the();
GApplication(int argc, char** argv);
~GApplication();
int exec();
void exit(int);
void set_menubar(OwnPtr<GMenuBar>&&);

View file

@ -1,7 +1,7 @@
#include <LibGUI/GStyle.h>
#include <SharedGraphics/Painter.h>
GStyle* s_the;
static GStyle* s_the;
GStyle& GStyle::the()
{

View file

@ -24,6 +24,7 @@ LIBGUI_OBJS = \
GMenuBar.o \
GMenu.o \
GMenuItem.o \
GApplication.o \
GWindow.o
OBJS = $(SHAREDGRAPHICS_OBJS) $(LIBGUI_OBJS)