#pragma region CPL License
/*
Nuclex Native Framework
Copyright (C) 2002-2013 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#pragma endregion // CPL License
#ifndef NUCLEX_INPUT_WINRT_WINRTINPUTMANAGER_IMPL_H
#define NUCLEX_INPUT_WINRT_WINRTINPUTMANAGER_IMPL_H
#include "Nuclex/Input/WinRTInputManager.h"
#include "../Devices/WinRT/WinRTKeyboard.h"
#include "../Devices/WinRT/WinRTMouse.h"
#include "../Devices/Virtuals/VirtualGamePad.h"
#include "../Devices/Virtuals/VirtualTouchPanel.h"
// --------------------------------------------------------------------------------------------- //
namespace Nuclex { namespace Input {
// ------------------------------------------------------------------------------------------- //
/// Structure containing private implementation details
ref struct WinRTInputManager::Impl sealed {
/// Initializes the WinRT input manager implementation details
/// Window from which input will be captured
public: Impl(Windows::UI::Core::CoreWindow ^window);
/// Releases all resources owned by the instance
public: ~Impl();
/// Called when a key is pressed down
/// Window that registered the key press
/// Contains the pressed key
private: void keyDown(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::KeyEventArgs ^arguments
) {
this->Keyboard.InjectKeyDown(sender, arguments);
}
/// Called when a key is released
/// Window that registered the key release
/// Contains the released key
private: void keyUp(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::KeyEventArgs ^arguments
) {
this->Keyboard.InjectKeyUp(sender, arguments);
}
/// Called when a character has been entered
/// Window that received the character
/// Contains the entered character
private: void characterReceived(
Windows::UI::Core::CoreWindow ^sender,
Windows::UI::Core::CharacterReceivedEventArgs ^arguments
) {
this->Keyboard.InjectCharacter(sender, arguments);
}
/// Called when a mouse button is pressed
/// Window that registered the button press
/// Contains the pressed button
private: void pointerPressed(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::PointerEventArgs ^arguments
);
/// Called when a mouse button is released
/// Window that registered the button release
/// Contains the released button
private: void pointerReleased(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::PointerEventArgs ^arguments
);
/// Called when a mouse cursor is moved
/// Window that registered the mouse cursor movement
/// Contains the new position of the mouse cursor
private: void pointerMoved(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::PointerEventArgs ^arguments
);
/// Called when a mouse wheel is rotated
/// Window that registered the mouse wheel rotation
/// Contains the new amount the mouse wheel has rotated
private: void pointerWheelChanged(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::PointerEventArgs ^arguments
);
/// Subscribes to the events of the CoreWindow instance
private: void subscribeWindowEvents();
/// The keyboard provided by the input manager
internal: Devices::WinRTKeyboard Keyboard;
/// The mouse provided by the input manager
internal: Devices::WinRTMouse Mouse;
/// Dummy game pads provided by this input manager
internal: Devices::VirtualGamePad GamePad[8];
/// Dummy touch pannel provided by this input manager
internal: Devices::VirtualTouchPanel TouchPanel;
/// Window from which input is being captured
private: Windows::UI::Core::CoreWindow ^window;
/// Token for the subscription to the KeyDown event
private: Windows::Foundation::EventRegistrationToken keyDownEventToken;
/// Token for the subscription to the KeyUp event
private: Windows::Foundation::EventRegistrationToken keyUpEventToken;
/// Token for the subscription to the CharacterReceived event
private: Windows::Foundation::EventRegistrationToken characterReceivedEventToken;
/// Token for the subscription to the PointerPressed event
private: Windows::Foundation::EventRegistrationToken pointerPressedEventToken;
/// Token for the subscription to the PointerReleased event
private: Windows::Foundation::EventRegistrationToken pointerReleasedEventToken;
/// Token for the subscription to the PointerMoved event
private: Windows::Foundation::EventRegistrationToken pointerMovedEventToken;
/// Token for the subscription to the PointerWheelChanged event
private: Windows::Foundation::EventRegistrationToken pointerWheelChangedEventToken;
};
// ------------------------------------------------------------------------------------------- //
}} // namespace Nuclex::Input
#endif // NUCLEX_INPUT_WINRT_WINRTINPUTMANAGER_IMPL_H