/*****************************************************************************
 * $LastChangedDate: 2009-12-16 21:42:17 -0500 (Wed, 16 Dec 2009) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Mouse event struct (system-neutral).
 *//*
 * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef INPUT_EVENT_MOUSE_HH
#define INPUT_EVENT_MOUSE_HH 1

#include "math/module.hh"
#include "math/vertex.hh"
using namespace math;

namespace input {

////////////////////////////////////////////////////////////////////////////////
/// @brief Mouse event (system-neutral).
///
/// If change is eChange_MOVEMENT then button members are invalid, v.v.
///
/// Mouse position:
/// (0,0) bottom-left of window
/// (w,h) top-right of window (w,h = width,height of window)
///
/// When mouse moves outside window, no more mouse events will be generated.
///
struct MouseEvent
{
    enum eChange
    {
        eChange_NONE,
        eChange_MOVEMENT,
        eChange_BUTTON
    };

    CLASS_CONST uint INVALID_BUTTON = 0xffff;  // -1 could cause signed problems

    MouseEvent( void )
    : mChange(eChange_NONE), mPos(0,0), mButtonNum(INVALID_BUTTON), mButtonState(false)
    { }

    MouseEvent( const eChange change, const Vector2& pos, const uint buttonNum, const bool buttonState )
    : mChange(change), mPos(pos), mButtonNum(buttonNum), mButtonState(buttonState)
    { }

    eChange     mChange;        ///< what changed (movement, click)
    Vector2     mPos;           ///< 2D screen position
    uint        mButtonNum;     ///< which button changed
    bool        mButtonState;   ///< true:pressed/down false:released/up
};

} // namespace input

#endif // INPUT_EVENT_MOUSE_HH
