1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:47:35 +00:00

Start working on a Widgets library.

This commit is contained in:
Andreas Kling 2018-10-10 15:12:38 +02:00
parent a181a8f6e7
commit 8c84f9749e
18 changed files with 594 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#include "AbstractScreen.h"
#include "EventLoop.h"
#include "Event.h"
#include "Widget.h"
#include <AK/Assertions.h>
static AbstractScreen* s_the;
AbstractScreen& AbstractScreen::the()
{
ASSERT(s_the);
return *s_the;
}
AbstractScreen::AbstractScreen(unsigned width, unsigned height)
: m_width(width)
, m_height(height)
{
ASSERT(!s_the);
s_the = this;
}
AbstractScreen::~AbstractScreen()
{
}
void AbstractScreen::setRootWidget(Widget* widget)
{
// FIXME: Should we support switching root widgets?
ASSERT(!m_rootWidget);
ASSERT(widget);
m_rootWidget = widget;
EventLoop::main().postEvent(m_rootWidget, make<ShowEvent>());
}