2001-01-11 00:32:10 +08:00
|
|
|
#ifndef OSGUTIL_GUIEVENTADAPTER
|
|
|
|
#define OSGUTIL_GUIEVENTADAPTER 1
|
|
|
|
|
|
|
|
#include <osg/Referenced>
|
|
|
|
#include <osgUtil/Export>
|
|
|
|
|
|
|
|
namespace osgUtil{
|
|
|
|
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Pure virtual base class for adapting platform specific events into
|
|
|
|
* generic keyboard and mouse events.
|
|
|
|
*
|
|
|
|
* Used as GUI toolkit independent input into the osgUtil::CameraManipualor's.
|
|
|
|
* For an example of how GUIEventAdapter is specialised for a particular GUI
|
|
|
|
* Toolkit see osgGLUT::GLUTEventAdapter.
|
|
|
|
*/
|
2001-01-11 00:32:10 +08:00
|
|
|
class GUIEventAdapter : public osg::Referenced
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
GUIEventAdapter() {}
|
|
|
|
|
|
|
|
|
|
|
|
enum MouseButtonMask {
|
|
|
|
LEFT_BUTTON=1,
|
|
|
|
MIDDLE_BUTTON=2,
|
|
|
|
RIGHT_BUTTON=4
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EventType {
|
|
|
|
PUSH,
|
|
|
|
RELEASE,
|
|
|
|
DRAG,
|
|
|
|
MOVE,
|
|
|
|
KEYBOARD,
|
|
|
|
FRAME,
|
|
|
|
RESIZE,
|
|
|
|
NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Get the EventType of the GUI event.*/
|
|
|
|
virtual EventType getEventType() const = 0;
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** key pressed, return -1 if inappropriate for this event. */
|
2001-01-11 00:32:10 +08:00
|
|
|
virtual int getKey() const = 0;
|
|
|
|
|
|
|
|
/** button pressed/released, return -1 if inappropriate for this event.*/
|
|
|
|
virtual int getButton() const = 0;
|
|
|
|
|
|
|
|
/** window minimum x. */
|
|
|
|
virtual int getXmin() const = 0;
|
|
|
|
|
|
|
|
/** window maximum x. */
|
|
|
|
virtual int getXmax() const = 0;
|
|
|
|
|
|
|
|
/** window minimum y. */
|
|
|
|
virtual int getYmin() const = 0;
|
|
|
|
|
|
|
|
/** window maximum y. */
|
|
|
|
virtual int getYmax() const = 0;
|
|
|
|
|
|
|
|
/** current mouse x position.*/
|
|
|
|
virtual int getX() const = 0;
|
|
|
|
|
|
|
|
/** current mouse y position.*/
|
|
|
|
virtual int getY() const = 0;
|
|
|
|
|
|
|
|
/** current mouse button state */
|
|
|
|
virtual unsigned int getButtonMask() const = 0;
|
|
|
|
|
|
|
|
/** time in seconds of event. */
|
|
|
|
virtual float time() const = 0;
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
/** Force users to create on heap, so that multiple referencing is safe.*/
|
2001-01-11 00:32:10 +08:00
|
|
|
virtual ~GUIEventAdapter() {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|