/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM 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 GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

module NMM {
  
  /**
   * Display events.
   * Defines events that can be sent by the display nodes and caught by the application.
   * The most common use is for capturing keyboard and mouse events by the application.
   *
   * The application should only register itself for the events of this interface it is
   * actually interested in. Some implementations might check for which events listeners
   * have been registered to optimize event handling.
   */
  interface IDisplayEvents {
    
    /**
     * Mouse buttons.
     * These are identifiers for the three mouse buttons and bitmasks for the mouse
     * button state.
     */
    enum MouseButtons { MOUSE_BUTTON_LEFT=1, MOUSE_BUTTON_RIGHT=2, MOUSE_BUTTON_MIDDLE=4 };
    
    
    /**
     * Key was pressed.
     * Sent by the display to notify the application that a key was pressed in the context of
     * the display window.
     * @param key the identifier of the pressed key
     */
    Result keyPressed(in string key) instream;
    
    /**
     * Key was released.
     * Sent by the display to notify the application that a key was released in the context of
     * the display window.
     * @param key the identifier of the pressed key
     */
    Result keyReleased(in string key) instream;

    /**
     * Key was pressed.
     * Sent by the display to notify the application that a key was pressed in the context of
     * the display window.
     * @param key the KeySym of the pressed key
     */
    Result keysym_keyPressed(in nmm_uint32 keysym) instream;

    /**
     * Key was released.
     * Sent by the display to notify the application that a key was released in the context of
     * the display window.
     * @param key the KeySym of the pressed key
     */
    Result keysym_keyReleased(in nmm_uint32  keysym) instream;
    
    /**
     * Mouse button was pressed.
     * Sent by the display to notify the application that a mouse button was pressed in the context of
     * the display window.
     * @param button identifies the mouse button
     * @param x x coordinate of mouse pointer
     * @param y y coordinate of mouse pointer
     * @param buttons mouse button state bitmask
     * @param shift shift key is held down
     */
    Result mouseButtonPressed(in nmm_int32 button, in nmm_int32 x, in nmm_int32 y, in nmm_int32 buttons, in nmm_bool shift) instream;

    /**
     * Mouse button was released.
     * Sent by the display to notify the application that a mouse button was released in the context of
     * the display window.
     * @param button identifies the mouse button
     * @param x x coordinate of mouse pointer
     * @param y y coordinate of mouse pointer
     * @param buttons mouse button state bitmask
     * @param shift shift key is held down
     */
    Result mouseButtonReleased(in nmm_int32 button, in nmm_int32 x, in nmm_int32 y, in nmm_int32 buttons, in nmm_bool shift) instream;
    
    /**
     * Mouse was moved
     * Sent by the display to notify the application that th mouse was moved over
     * the display window.
     * @param x x coordinate of mouse pointer
     * @param y y coordinate of mouse pointer
     * @param buttons mouse button state bitmask
     * @param shift shift key is held down
     */
    Result mouseMoved(in nmm_int32 x, in nmm_int32 y, in nmm_int32 buttons,in nmm_bool shift) instream;
    
    /**
     * The display window was exposed.
     * Sent by the display to notify the application that the user exposed
     * the display window.
     */
    Result windowExposed() instream;

    /**
     * The display window was closed.
     * Sent by the display to notify the application that the user closed
     * the display window.
     */
    Result windowClosed() instream;

    /**
     * The display window was resized.
     * Sent by the display to notify the application that the user resized
     * the display window.
     * @param xsize new x size of window
     * @param ysize new y size of window
     */
    Result windowResized(in nmm_int32 xsize, in nmm_int32 ysize) instream;
  };
}
