SDK/Widgets: Add OnKeyPressed/OnKeyReleased callbacks
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <NDK/EntityOwner.hpp>
|
||||
#include <NDK/World.hpp>
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Utility/Event.hpp>
|
||||
#include <Nazara/Utility/Mouse.hpp>
|
||||
#include <Nazara/Utility/Node.hpp>
|
||||
|
||||
@@ -70,6 +71,8 @@ namespace Ndk
|
||||
virtual void Layout();
|
||||
void InvalidateNode() override;
|
||||
|
||||
virtual void OnKeyPressed(const Nz::WindowEvent::KeyEvent& key);
|
||||
virtual void OnKeyReleased(const Nz::WindowEvent::KeyEvent& key);
|
||||
virtual void OnMouseEnter();
|
||||
virtual void OnMouseMoved(int x, int y, int deltaX, int deltaY);
|
||||
virtual void OnMouseButtonPress(int x, int y, Nz::Mouse::Button button);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Ndk
|
||||
void Layout() override;
|
||||
|
||||
void NotifyWidgetUpdate(std::size_t index);
|
||||
|
||||
|
||||
std::size_t RegisterWidget(BaseWidget* widget);
|
||||
|
||||
inline void SetKeyboardOwner(BaseWidget* widget);
|
||||
@@ -48,6 +48,8 @@ namespace Ndk
|
||||
void OnMouseButtonRelease(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseButtonEvent& event);
|
||||
void OnMouseMoved(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseMoveEvent& event);
|
||||
void OnMouseLeft(const Nz::EventHandler* eventHandler);
|
||||
void OnKeyPressed(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event);
|
||||
void OnKeyReleased(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event);
|
||||
void OnTextEntered(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::TextEvent& event);
|
||||
|
||||
struct WidgetBox
|
||||
@@ -56,6 +58,8 @@ namespace Ndk
|
||||
Nz::Boxf box;
|
||||
};
|
||||
|
||||
NazaraSlot(Nz::EventHandler, OnKeyPressed, m_keyPressedSlot);
|
||||
NazaraSlot(Nz::EventHandler, OnKeyReleased, m_keyReleasedSlot);
|
||||
NazaraSlot(Nz::EventHandler, OnMouseButtonPressed, m_mouseButtonPressedSlot);
|
||||
NazaraSlot(Nz::EventHandler, OnMouseButtonReleased, m_mouseButtonReleasedSlot);
|
||||
NazaraSlot(Nz::EventHandler, OnMouseMoved, m_mouseMovedSlot);
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Ndk
|
||||
{
|
||||
m_canvas = this;
|
||||
|
||||
m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, this, &Canvas::OnKeyPressed);
|
||||
m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, this, &Canvas::OnKeyReleased);
|
||||
m_mouseButtonPressedSlot.Connect(eventHandler.OnMouseButtonPressed, this, &Canvas::OnMouseButtonPressed);
|
||||
m_mouseButtonReleasedSlot.Connect(eventHandler.OnMouseButtonReleased, this, &Canvas::OnMouseButtonRelease);
|
||||
m_mouseMovedSlot.Connect(eventHandler.OnMouseMoved, this, &Canvas::OnMouseMoved);
|
||||
|
||||
Reference in New Issue
Block a user