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

Intense hacking on Widgets.

This commit is contained in:
Andreas Kling 2018-10-10 16:49:36 +02:00
parent 8c84f9749e
commit 6f37429f57
20 changed files with 290 additions and 5 deletions

View file

@ -13,7 +13,8 @@ AbstractScreen& AbstractScreen::the()
}
AbstractScreen::AbstractScreen(unsigned width, unsigned height)
: m_width(width)
: Object(nullptr)
, m_width(width)
, m_height(height)
{
ASSERT(!s_the);
@ -24,6 +25,17 @@ AbstractScreen::~AbstractScreen()
{
}
void AbstractScreen::event(Event& event)
{
if (event.type() == Event::MouseMove) {
auto& me = static_cast<MouseEvent&>(event);
printf("AbstractScreen::onMouseMove: %d, %d\n", me.x(), me.y());
auto result = m_rootWidget->hitTest(me.x(), me.y());
printf("hit test for %d,%d found: %s{%p} %d,%d\n", me.x(), me.y(), result.widget->className(), result.widget, result.localX, result.localY);
}
}
void AbstractScreen::setRootWidget(Widget* widget)
{
// FIXME: Should we support switching root widgets?