#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_DEVICES_WINRTKEYBOARD_H
#define NUCLEX_INPUT_DEVICES_WINRTKEYBOARD_H
#include "../Buffered/BufferedKeyboard.h"
namespace Nuclex { namespace Input { namespace Devices {
// ------------------------------------------------------------------------------------------- //
/// Keyboard that captures input from a WinRT CoreWindow
class WinRTKeyboard : public BufferedKeyboard {
/// Initializes a new WinRT-based keyboard
public: WinRTKeyboard() {}
/// Destroys the keyboard
public: virtual ~WinRTKeyboard() {}
/// Whether the input device is currently attached
/// True if the input device is attached, otherwise false
public: bool IsAttached() const { return true; }
/// Retrieves the human-readable name of the input device
/// The human-readable name of the input device
public: const std::string &GetName() const {
static std::string name("WinRT/Metro keyboard translator");
return name;
}
/// Called when a key is pressed down
/// Window that registered the key press
/// Contains the pressed key
public: void InjectKeyDown(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::KeyEventArgs ^arguments
);
/// Called when a key is released
/// Window that registered the key release
/// Contains the released key
public: void InjectKeyUp(
Windows::UI::Core::CoreWindow ^sender, Windows::UI::Core::KeyEventArgs ^arguments
);
/// Called when a character has been entered
/// Window that received the character
/// Contains the entered character. Not.
public: void InjectCharacter(
Windows::UI::Core::CoreWindow ^sender,
Windows::UI::Core::CharacterReceivedEventArgs ^arguments
);
};
// ------------------------------------------------------------------------------------------- //
}}} // namespace Nuclex::Input::Devices
#endif // NUCLEX_INPUT_DEVICES_WINRTKEYBOARD_H