#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2010 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
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Nuclex.Input;
namespace Nuclex.UserInterface.Input {
/// Interface for classes that can process user input
///
/// This interface is implemented by any class that can process user input.
/// Normally, user input is directly fed into the class
/// which manages the global state of an isolated GUI system. It is also possible,
/// though not recommended, to use this interface for sending input directly
/// to a control, for example, to simulate text input for an input box.
///
public interface IInputReceiver {
/// Injects an input command into the input receiver
/// Input command to be injected
///
///
/// If the GUI is run without the usual GUI input methods (eg. when a GUI is
/// displayed on a gaming console), this is the sole way to feed input to
/// the controls.
///
///
/// By default, normal key presses will generate a command in addition to the
/// KeyPress itself, so unless a control does something very special, it
/// should respond to this method only and leave the KeyPress method alone ;)
///
///
void InjectCommand(Command command);
/// Called when a button on the gamepad has been pressed
/// Button that has been pressed
void InjectButtonPress(Buttons button);
/// Called when a button on the gamepad has been released
/// Button that has been released
void InjectButtonRelease(Buttons button);
/// Injects a mouse position update into the receiver
/// New X coordinate of the mouse cursor on the screen
/// New Y coordinate of the mouse cursor on the screen
///
/// When the mouse leaves the valid region (eg. if the game runs in windowed mode
/// and the mouse cursor is moved outside of the window), a final mouse move
/// notification is generated with the coordinates -1, -1
///
void InjectMouseMove(float x, float y);
/// Called when a mouse button has been pressed down
/// Index of the button that has been pressed
void InjectMousePress(MouseButtons button);
/// Called when a mouse button has been released again
/// Index of the button that has been released
void InjectMouseRelease(MouseButtons button);
/// Called when the mouse wheel has been rotated
/// Number of ticks that the mouse wheel has been rotated
void InjectMouseWheel(float ticks);
/// Called when a key on the keyboard has been pressed down
/// Code of the key that was pressed
///
/// Only handle this if you need it for some special purpose. For standard commands
/// like confirmation and cancellation, simply respond to InjectCommand()
///
void InjectKeyPress(Keys keyCode);
/// Called when a key on the keyboard has been released again
/// Code of the key that was released
///
/// Only handle this if you need it for some special purpose. For standard commands
/// like confirmation and cancellation, simply respond to InjectCommand()
///
void InjectKeyRelease(Keys keyCode);
/// Handle user text input by a physical or virtual keyboard
/// Character that has been entered
void InjectCharacter(char character);
}
} // namespace Nuclex.UserInterface.Input