Sdk/BaseWidget: Add HasFocus method
This commit is contained in:
@@ -79,7 +79,7 @@ namespace Ndk
|
||||
{
|
||||
m_backgroundSprite = Nz::Sprite::New();
|
||||
m_backgroundSprite->SetColor(m_backgroundColor);
|
||||
m_backgroundSprite->SetMaterial(Nz::Material::New((m_backgroundColor.IsOpaque()) ? "Basic2D" : "Translucent2D"));
|
||||
m_backgroundSprite->SetMaterial(Nz::Material::New((m_backgroundColor.IsOpaque()) ? "Basic2D" : "Translucent2D")); //< TODO: Use a shared material instead of creating one everytime
|
||||
|
||||
m_backgroundEntity = CreateEntity();
|
||||
m_backgroundEntity->AddComponent<GraphicsComponent>().Attach(m_backgroundSprite, -1);
|
||||
@@ -94,6 +94,18 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks if this widget has keyboard focus
|
||||
* \return true if widget has keyboard focus, false otherwhise
|
||||
*/
|
||||
bool BaseWidget::HasFocus() const
|
||||
{
|
||||
if (!IsRegisteredToCanvas())
|
||||
return false;
|
||||
|
||||
return m_canvas->IsKeyboardOwner(m_canvasIndex);
|
||||
}
|
||||
|
||||
void BaseWidget::SetBackgroundColor(const Nz::Color& color)
|
||||
{
|
||||
m_backgroundColor = color;
|
||||
|
||||
Reference in New Issue
Block a user