#pragma once
#include "RawCSAMEvent.hpp"
#ifdef __INPUT_RAWMOUSEEVENT_CPP_
#define RAW_MOUSE_EVENT_DECL FDX_DLL_EXPORT
#else
#define RAW_MOUSE_EVENT_DECL FDX_DLL_IMPORT
#endif
namespace Input
{
class RawMouseEvent :
public RawCSAMEvent
{
public:
RAW_MOUSE_EVENT_DECL RawMouseEvent();
RAW_MOUSE_EVENT_DECL RawMouseEvent(const parameter_strings & parms);
RAW_MOUSE_EVENT_DECL virtual ~RawMouseEvent();
DECL_CLASS_COMMON_TYPES(RawMouseEvent);
RAW_MOUSE_EVENT_DECL void initialize(const parameter_strings & parms);
///Give comparisons value semantics
RAW_MOUSE_EVENT_DECL bool operator==(RawMouseEvent const& cmp) const;
public:
/**
(from W3C DOM L3 Events)
The horizontal coordinate at which the event occurred relative to the origin of the screen coordinate system.
The uninitialized value of this attribute must be 0.
*/
long screenX;
/**
(from W3C DOM L3 Events)
The vertical coordinate at which the event occurred relative to the origin of the screen coordinate system.
The uninitialized value of this attribute must be 0.
*/
long screenY;
/**
(from W3C DOM L3 Events)
During mouse events caused by the depression or release of a mouse button, button must be used to indicate which pointer device button changed state.
The value of the MouseEvent.button attribute must be as follows:
0 must indicate the primary button of the device (in general, the left button or the only button on single-button devices, used to activate a user interface control or select text) or the un-initialized value.
1 must indicate the auxiliary button (in general, the middle button, often combined with a mouse wheel).
2 must indicate the secondary button (in general, the right button, often used to display a context menu).
Some pointing devices provide or simulate more buttons, and values higher than 2 may be used to represent such buttons.
Note: The value of button is not updated for events not caused by the depression/release of a mouse button. In these scenarios, take care not to interpret the value 0 as the left button,
but rather as the un-initialized value
Authoring Note: Some default actions related to events such as mousedown and mouseup depend on the specific mouse button in use.
The uninitialized value of this attribute must be 0.
*/
short button;
/**
(from W3C DOM L3 Events)
During any mouse events, buttons must be used to indicate which combination of mouse buttons are currently being pressed, expressed as a bitmask.
Note: Though similarly named, the values for the buttons attribute and the button attribute are very different. The value of button is assumed to be valid during mousedown/ mouseup event handlers,
whereas the buttons attribute reflects the state of the mouse's buttons for any trusted MouseEvent object (while it is being dispatched), because it can represent the "no button currently active" state (0).
The value of the MouseEvent.buttons attribute must be as follows:
0 must indicates no button is currently active.
1 must indicate the primary button of the device (in general, the left button or the only button on single-button devices, used to activate a user interface control or select text).
2 must indicate the secondary button (in general, the right button, often used to display a context menu), if present.
4 must indicate the auxiliary button (in general, the middle button, often combined with a mouse wheel).
Some pointing devices provide or simulate more buttons. To represent such buttons, the value must be doubled for each successive button (in the binary series 8, 16, 32, ... ).
Note: Because the sum of any set of button values is a unique number, a content author can use a bitwise operation to determine how many buttons are currently being pressed and which buttons they are,
for an arbitrary number of mouse buttons on a device, e.g., the value 3 indicates that the left and right button are currently both pressed, while the value 5 indicates that the left and middle button
are currently both pressed.
Authoring Note: Some default actions related to events such as mousedown and mouseup depend on the specific mouse button in use.
The uninitialized value of this attribute must be 0.
*/
short buttons;
protected:
friend class boost::serialization::access;
template
RAW_MOUSE_EVENT_DECL void serialize(Archive &ar, const unsigned int version);
//{
// ar & boost::serialization::base_object(*this);
// ar & screenX;
// ar & screenY;
// ar & button;
// ar & buttons;
//}
};
}
BOOST_CLASS_EXPORT_KEY(Input::RawMouseEvent);