1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

More hacking on Widgets.

This commit is contained in:
Andreas Kling 2018-10-11 16:52:40 +02:00
parent c37ded0ae4
commit a4491e9630
9 changed files with 150 additions and 2 deletions

View file

@ -1,6 +1,7 @@
#include "Widget.h"
#include "Event.h"
#include "EventLoop.h"
#include "WindowManager.h"
#include <AK/Assertions.h>
Widget::Widget(Widget* parent)
@ -21,6 +22,17 @@ void Widget::setRect(const Rect& rect)
update();
}
void Widget::setIsWindow(bool value)
{
if (m_isWindow == value)
return;
m_isWindow = value;
if (m_isWindow) {
WindowManager::the().addWindow(*this);
}
update();
}
void Widget::event(Event& event)
{
switch (event.type()) {
@ -104,3 +116,10 @@ Widget::HitTestResult Widget::hitTest(int x, int y)
return { this, x, y };
}
void Widget::setWindowTitle(String&& title)
{
if (title == m_windowTitle)
return;
m_windowTitle = std::move(title);
WindowManager::the().notifyTitleChanged(*this);
}