ContextPointer Class Reference

ContextPointer forms the bridge between the ViewPort (GUI) and the InputEngine (core). More...

List of all members.

Public Member Functions

int x () const
int y () const
QPoint pos ()
int scene_x () const
int scene_y () const
QPointF scene_pos () const
void set_point (int x, int y)
int on_first_input_event_x () const
int on_first_input_event_y () const
int on_first_input_event_scene_x () const
int on_first_input_event_scene_y () const
void inputengine_first_input_event ()
int get_current_mode () const
void jog_start ()
void jog_finished ()
void reset_cursor ()
ViewPortget_viewport ()
void set_current_viewport (ViewPort *vp)
QList< QObject * > get_context_items ()
void add_contextitem (QObject *item)
void remove_contextitem (QObject *item)
QList< QObject * > get_contextmenu_items () const
void set_contextmenu_items (QList< QObject * > list)

Friends

ContextPointercpointer ()


Detailed Description

ContextPointer forms the bridge between the ViewPort (GUI) and the InputEngine (core).

Use it in classes that inherit ViewPort to discover ViewItems under
the mouse cursor on the first input event x/y coordinates.

Also provides convenience functions to get ViewPort x/y coordinates
as well as scene x/y coordinates, which can be used for example in the
jog() implementation of Command classes.

ViewPort's mouse event handling automatically updates the state of ContextPointer
as well as the InputEngine, which makes sure the mouse is grabbed and released
during Hold type Command's.

Use cpointer() to get a reference to the singleton object!

See also:
ViewPort, InputEngine

Member Function Documentation

int ContextPointer::x (  )  const [inline]

Returns the current ViewPort's mouse x coordinate

Returns:
The current ViewPort's mouse x coordinate

Referenced by TrackPan::begin_hold(), TrackPan::jog(), and Gain::jog().

int ContextPointer::y (  )  const [inline]

Returns the current ViewPort's mouse y coordinate

Returns:
The current ViewPort's mouse y coordinate

Referenced by Gain::jog().

QPoint ContextPointer::pos (  )  [inline]

Convenience function, equals QPoint(cpointer().x(), cpointer().y())

Returns:
The current ViewPorts mouse position;

Referenced by Gain::begin_hold().

int ContextPointer::scene_x (  )  const [inline]

Convenience function that maps the ViewPort's mouse x
coordinate to the scene x coordinate

Returns:
The current scene x coordinate, mapped from the ViewPort's mouse x coordinate

Referenced by MoveClip::jog().

int ContextPointer::scene_y (  )  const [inline]

Convenience function that maps the ViewPort's mouse y
coordinate to the ViewPort's scene y coordinate

Returns:
The current ViewPort's scene y coordinate, mapped from the ViewPort's mouse y coordinate

QPointF ContextPointer::scene_pos (  )  const [inline]

Returns the current's ViewPort's mouse position in the ViewPort's scene position.

Returns:
The current's ViewPort's mouse position in the ViewPort's scene position.

void ContextPointer::set_point ( int  x,
int  y 
) [inline]

Used by ViewPort to update the internal state of ContextPointer Not intended to be used somewhere else.

Parameters:
x The ViewPort's mouse x coordinate
y The ViewPort's mouse y coordinate

int ContextPointer::on_first_input_event_x (  )  const [inline]

Returns the ViewPort x coordinate on first input event.

Returns:
The ViewPort x coordinate on first input event.

int ContextPointer::on_first_input_event_y (  )  const [inline]

Returns the ViewPort y coordinate on first input event.

Returns:
The ViewPort y coordinate on first input event.

int ContextPointer::on_first_input_event_scene_x (  )  const [inline]

Returns the scene x coordinate on first input event.

Returns:
The scene x coordinate on first input event.

Referenced by MoveClip::begin_hold().

int ContextPointer::on_first_input_event_scene_y (  )  const [inline]

Returns the scene y coordinate on first input event.

Returns:
The scene y coordinate on first input event.

void ContextPointer::inputengine_first_input_event (  )  [inline]

Called _only_ by InputEngine, not to be used anywhere else.

void ContextPointer::jog_start (  ) 

Called _only_ by InputEngine, not to be used anywhere else.

void ContextPointer::jog_finished (  ) 

Called _only_ by InputEngine, not to be used anywhere else.

void ContextPointer::reset_cursor (  ) 

Used by InputEngine to reset the current ViewPort's HoldCursor
after a 'Hold type' Command has been finished. Not be called
from anywhere else

References ViewPort::reset_cursor().

ViewPort * ContextPointer::get_viewport (  ) 

QList< QObject * > ContextPointer::get_context_items (  ) 

Returns a list of all 'soft selected' ContextItems.

To be able to also dispatch key facts to objects that don't inherit from ContextItem, but do inherit from QObject, the returned list holds QObjects.

Returns:
A list of 'soft selected' ContextItems, as QObject's.

References ContextItem::get_context(), and ViewPort::get_pointed_context_items().

void ContextPointer::add_contextitem ( QObject *  item  ) 

Use this function to add an object that inherits from QObject
permanently to the 'soft selected' item list.

The added object will always be added to the list returned in
get_context_items(). This way, one can add objects that do not
inherit ContextItem, to be processed into the key fact dispatching
of InputEngine.

Parameters:
item The QObject to be added to the 'soft selected' item list


Friends And Related Function Documentation

ContextPointer& cpointer (  )  [friend]

Returns:
A reference to the singleton (static) ContextPointer object


The documentation for this class was generated from the following files:

Generated on Sun Mar 8 12:44:05 2009 for traverso by  doxygen 1.5.5