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:
parent
a181a8f6e7
commit
8c84f9749e
18 changed files with 594 additions and 0 deletions
35
Widgets/AbstractScreen.cpp
Normal file
35
Widgets/AbstractScreen.cpp
Normal 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>());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue