dtCore::Mouse Class Reference

The model of the mouse used throughout Delta3D. More...

#include <mouse.h>

Inheritance diagram for dtCore::Mouse:

dtCore::InputDevice dtCore::Base

List of all members.

Public Types

enum  MouseButton { LeftButton, MiddleButton, RightButton }
 Mouse buttons. More...
typedef std::list
< dtCore::RefPtr
< MouseListener > > 
MouseListenerList
 The list of mouse listeners.

Public Member Functions

 Mouse (const std::string &name="mouse")
 Constructor.
 Mouse (dtCore::View *view, const std::string &name="mouse")
 Constructor.
void GetPosition (float &x, float &y) const
 Gets the current mouse position.
osg::Vec2 GetPosition () const
void SetPosition (float x, float y)
 Sets the current mouse position.
void SetPosition (const osg::Vec2 &xy)
bool GetButtonState (MouseButton button) const
 Gets the state of the specified mouse button.
void AddMouseListener (MouseListener *mouseListener)
 Pushes a listener to the back of its list.
void InsertMouseListener (const MouseListenerList::value_type &pos, MouseListener *ml)
 Inserts the listener into the list at a position BEFORE pos.
void RemoveMouseListener (MouseListener *mouseListener)
 Removes a listener for mouse events.
virtual bool MouseScroll (osgGA::GUIEventAdapter::ScrollingMotion sm)
 For injecting mouse scroll events.
virtual bool MouseMotion (float x, float y)
 For injecting mouse drag events.
virtual bool PassiveMouseMotion (float x, float y)
 For injecting passive mouse motion events.
virtual bool ButtonDown (float x, float y, MouseButton button)
 For injecting button press events.
virtual bool DoubleButtonDown (float x, float y, MouseButton button)
 For injecting double button press events.
virtual bool ButtonUp (float x, float y, MouseButton button)
 For injecting button release events.
const MouseListenerListGetListeners () const
 
Returns:
the container of MouseListener instances.

bool GetHasFocus ()
 
Returns:
if the mouse has window focus, false otherwise

dtCore::ViewGetView ()
 
Returns:
the mOsgViewerView

const dtCore::ViewGetView () const
 
Returns:
the const mView


Protected Member Functions

virtual ~Mouse ()
 Destructor.
void SetView (dtCore::View *view)
 define the mOsgViewerView

Protected Attributes

MouseListenerList mMouseListeners
 The container of observers.
osg::observer_ptr< dtCore::ViewmView
 needed to control the cursor on the window.

Friends

class KeyboardMouseHandler


Detailed Description

The model of the mouse used throughout Delta3D.

Member Typedef Documentation

typedef std::list<dtCore::RefPtr<MouseListener> > dtCore::Mouse::MouseListenerList

The list of mouse listeners.


Member Enumeration Documentation

enum dtCore::Mouse::MouseButton

Mouse buttons.

Enumerator:
LeftButton 
MiddleButton 
RightButton 


Constructor & Destructor Documentation

Mouse::~Mouse (  )  [protected, virtual]

Destructor.

Mouse::Mouse ( const std::string &  name = "mouse"  ) 

Constructor.

Parameters:
name the instance name

Mouse::Mouse ( dtCore::View view,
const std::string &  name = "mouse" 
)

Constructor.

Parameters:
view owner of this instance
name the instance name


Member Function Documentation

void Mouse::GetPosition ( float &  x,
float &  y 
) const

Gets the current mouse position.

Parameters:
x a reference to the location in which to store the x coordinate
y a reference to the location in which to store the y coordinate

osg::Vec2 Mouse::GetPosition (  )  const

void Mouse::SetPosition ( float  x,
float  y 
)

Sets the current mouse position.

Parameters:
x the new x coordinate
y the new y coordinate

void Mouse::SetPosition ( const osg::Vec2 &  xy  ) 

bool Mouse::GetButtonState ( MouseButton  button  )  const

Gets the state of the specified mouse button.

Parameters:
button the button to check
Returns:
true if the button is pressed, false otherwise

void Mouse::AddMouseListener ( MouseListener mouseListener  ) 

Pushes a listener to the back of its list.

Parameters:
mouseListener the listener to add

void Mouse::InsertMouseListener ( const MouseListenerList::value_type &  pos,
MouseListener ml 
)

Inserts the listener into the list at a position BEFORE pos.

void Mouse::RemoveMouseListener ( MouseListener mouseListener  ) 

Removes a listener for mouse events.

Parameters:
mouseListener the listener to remove

bool Mouse::MouseScroll ( osgGA::GUIEventAdapter::ScrollingMotion  sm  )  [virtual]

For injecting mouse scroll events.

Parameters:
sm the scroll type

bool Mouse::MouseMotion ( float  x,
float  y 
) [virtual]

For injecting mouse drag events.

Parameters:
x the x coordinate
y the y coordinate

bool Mouse::PassiveMouseMotion ( float  x,
float  y 
) [virtual]

For injecting passive mouse motion events.

Parameters:
x the x coordinate
y the y coordinate

bool Mouse::ButtonDown ( float  x,
float  y,
MouseButton  button 
) [virtual]

For injecting button press events.

Parameters:
x the x coordinate
y the y coordinate
button the button identifier

bool Mouse::DoubleButtonDown ( float  x,
float  y,
MouseButton  button 
) [virtual]

For injecting double button press events.

Parameters:
x the x coordinate
y the y coordinate
button the button identifier

bool Mouse::ButtonUp ( float  x,
float  y,
MouseButton  button 
) [virtual]

For injecting button release events.

Parameters:
x the x coordinate
y the y coordinate
button the button identifier

const MouseListenerList& dtCore::Mouse::GetListeners (  )  const [inline]

Returns:
the container of MouseListener instances.

bool Mouse::GetHasFocus (  ) 

Returns:
if the mouse has window focus, false otherwise

dtCore::View* dtCore::Mouse::GetView (  )  [inline]

Returns:
the mOsgViewerView

const dtCore::View* dtCore::Mouse::GetView (  )  const [inline]

Returns:
the const mView

void dtCore::Mouse::SetView ( dtCore::View view  )  [inline, protected]

define the mOsgViewerView


Friends And Related Function Documentation

friend class KeyboardMouseHandler [friend]


Member Data Documentation

MouseListenerList dtCore::Mouse::mMouseListeners [protected]

The container of observers.

osg::observer_ptr<dtCore::View> dtCore::Mouse::mView [protected]

needed to control the cursor on the window.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008