mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Implement basic focus.
This commit is contained in:
parent
44a32039be
commit
1929cb6b71
6 changed files with 45 additions and 4 deletions
|
@ -120,3 +120,16 @@ void Widget::setWindow(Window* window)
|
|||
return;
|
||||
m_window = window;
|
||||
}
|
||||
|
||||
bool Widget::isFocused() const
|
||||
{
|
||||
return m_window && m_window->focusedWidget() == this;
|
||||
}
|
||||
|
||||
void Widget::setFocus(bool focus)
|
||||
{
|
||||
if (focus == isFocused())
|
||||
return;
|
||||
if (m_window)
|
||||
m_window->setFocusedWidget(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue