BaseWidget: Renamed GrabKeyboard to SetFocus, added ClearFocus and focus virtual methods

This commit is contained in:
Lynix
2017-11-11 18:38:11 +01:00
parent f5b639ec0f
commit f136530a74
5 changed files with 47 additions and 7 deletions

View File

@@ -46,6 +46,12 @@ namespace Ndk
return m_world;
}
inline void Canvas::ClearKeyboardOwner(std::size_t canvasIndex)
{
if (m_keyboardOwner == canvasIndex)
SetKeyboardOwner(InvalidCanvasIndex);
}
inline void Canvas::NotifyWidgetBoxUpdate(std::size_t index)
{
WidgetBox& entry = m_widgetBoxes[index];
@@ -67,6 +73,12 @@ namespace Ndk
inline void Canvas::SetKeyboardOwner(std::size_t canvasIndex)
{
if (m_keyboardOwner != InvalidCanvasIndex)
m_widgetBoxes[m_keyboardOwner].widget->OnFocusLost();
m_keyboardOwner = canvasIndex;
if (m_keyboardOwner != InvalidCanvasIndex)
m_widgetBoxes[m_keyboardOwner].widget->OnFocusReceived();
}
}