Home · All Classes

MReactionMap Class Reference

MReactionMap can be used to add low latency haptic feedback to applications. More...

#include <mreactionmap.h>

Inheritance diagram for MReactionMap:
[legend]

List of all members.

Public Member Functions

virtual ~MReactionMap ()
 Class destructor.
void setInactiveDrawingValue ()
 Sets a drawing value that gives no reaction when user touches it.
void setReactiveDrawingValue ()
 Sets a drawing value that reacts when user touches or lifts finger from it.
void setTransparentDrawingValue ()
 Sets a drawing value that is transparent when user touches or lifts finger from it.
void setDrawingValue (const QString &pressFeedback, const QString &releaseFeedback)
 Sets a drawing value that represents the specified press and release feedbacks.
QTransform transform () const
 Returns a QTransform transformation matrix that maps screen coordinates to reaction map coordinates.
void setTransform (QTransform transform)
 Sets a QTransform transformation matrix which is used when drawing to the reaction map.
void setTransform (QGraphicsItem *item, QGraphicsView *view)
 Generates a QTransform transformation matrix from QGraphicsItem and QGraphicsView which is used when drawing to the reaction map.
void fillRectangle (int x, int y, int width, int height)
 Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.
void fillRectangle (const QRect &rectangle)
 Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.
void fillRectangle (const QRectF &rectangle)
 Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.
void fillRectangle (const QRect &rectangle, const QString &pressFeedback, const QString &releaseFeedback)
 Draws a filled rectangle on the reaction map with the given press and release values. The current transformation matrix is used.
void fillRectangle (const QRectF &rectangle, const QString &pressFeedback, const QString &releaseFeedback)
 Draws a filled rectangle on the reaction map with the given press and release values. The current transformation matrix is used.
void fillItemBoundRect (QGraphicsItem *item)
 Draws a filled bound rectangle for a graphics item.
void fillItemBoundRect (QGraphicsItem *item, const QString &pressFeedback, const QString &releaseFeedback)
 Draws a filled bound rectangle for a graphics item.
int width () const
 Reaction map width.
int height () const
 Reaction map height.
void clear ()
 Clears the reaction map.

Static Public Member Functions

static MReactionMapinstance (QWidget &anyWidget)
 Returns the reaction map for a (top-level) widget.
static MReactionMapcreateInstance (QWidget &anyWidget, const QString &appIdentifier=QString(), QObject *parent=0)
 Created a reaction map for a (top-level) widget.

Static Public Attributes

static const QString Press = "press"
static const QString Release = "release"
static const QString Cancel = "cancel"
static const QString Transparent = "transparent"
static const QString Inactive = ""

Protected Member Functions

 MReactionMap (QWidget &topLevelWidget, const QString &appIdentifier=QString(), QObject *parent=0)
 Class constructor.

Protected Attributes

MReactionMapPrivate * d


Detailed Description

MReactionMap can be used to add low latency haptic feedback to applications.

MReactionMap draws a reactive map to shared memory which is used by meegofeedback daemon to provide haptic feedback. The daemon listens to touchscreen events directly from the touchscreen kernel interface and delivers haptic feedback based on the reaction map that has been drawn by MReactionMap. This is done to minimize the latency of the haptic feedback.

MReactionMap instance can be constructed after the top-level QWidget of the application has been created. Please note that there can be only one MReactionMap instance per top-level QWidget.

After the MReactionMap instance has been created the MReactionMap API can be used to draw on the created reaction map. Any point on the map defines which feedback will be played when the user's finger enters or leaves the display at that point.

Copyright © Copyright (C) 2011 Nokia Corporation

License The GNU Lesser General Public License, version 2.1


Constructor & Destructor Documentation

MReactionMap::MReactionMap ( QWidget topLevelWidget,
const QString appIdentifier = QString(),
QObject parent = 0 
) [explicit, protected]

Class constructor.

Creates the widget's reaction map. There must be only one reaction map instance per top-level widget.

Note:
Reaction map may only be defined for a top-level widget.
Parameters:
topLevelWidget Reference to a top-level widget
appIdentifier Application identifier that is used to locate custom feedback effects for the program using theming. If appIdentifier name is not provided, application identifier is determined from the name of the executable binary file of the application.
parent Optional parent object.
State: Stable

MReactionMap::~MReactionMap (  )  [virtual]

Class destructor.

Destroys the reaction map.

State: Stable


Member Function Documentation

MReactionMap * MReactionMap::instance ( QWidget anyWidget  )  [static]

Returns the reaction map for a (top-level) widget.

If the supplied widget is not a top-level widget, reaction map will be returned for top-level widget that is the ancestor of the supplied widget.

Parameters:
anyWidget Reference to a top-level widget or a descendant of a top-level widget
Returns:
Reaction map for the top-level widget otherwise 0.
Stable

MReactionMap * MReactionMap::createInstance ( QWidget anyWidget,
const QString appIdentifier = QString(),
QObject parent = 0 
) [static]

Created a reaction map for a (top-level) widget.

If the supplied widget is not a top-level widget, reaction map will be created for top-level widget that is the ancestor of the supplied widget. If a reaction map has been created already, the existing reaction map is returned.

Parameters:
anyWidget Reference to a top-level widget or a descendant of a top-level widget
appIdentifier Application identifier that is used to locate custom feedback effects for the program using theming. If appIdentifier name is not provided, application identifier is determined from the name of the executable binary file of the application.
parent Optional parent object.
Returns:
Reaction map for the (top-level) widget.
Stable

void MReactionMap::setInactiveDrawingValue (  ) 

Sets a drawing value that gives no reaction when user touches it.

This is the equivalent of setDrawingValue(MReactionMap::Inactive, MReactionMap::Inactive).

See also:
MReactionMap::fillRectangle().
Stable

void MReactionMap::setReactiveDrawingValue (  ) 

Sets a drawing value that reacts when user touches or lifts finger from it.

This is the equivalent of setDrawingValue(MReactionMap::Press, MReactionMap::Release).

See also:
MReactionMap::fillRectangle().
Stable

void MReactionMap::setTransparentDrawingValue (  ) 

Sets a drawing value that is transparent when user touches or lifts finger from it.

This is the equivalent of setDrawingValue(MReactionMap::Transparent, MReactionMap::Transparent).

See also:
MReactionMap::fillRectangle().
Stable

void MReactionMap::setDrawingValue ( const QString pressFeedback,
const QString releaseFeedback 
)

Sets a drawing value that represents the specified press and release feedbacks.

Useful when you want to specify different feedbacks to be played when the screen is pressed and released.

See also:
MReactionMap::fillRectangle().
Note:
The maximum number of different press&release pairs is limited to 255.
Parameters:
pressFeedback Name of feedback to be played when screen is pressed. Empty string means Inactive value.
releaseFeedback Name of feedback to be played when screen is released. Empty string means Inactive value.
Stable

QTransform MReactionMap::transform (  )  const

Returns a QTransform transformation matrix that maps screen coordinates to reaction map coordinates.

Returns:
QTransform transformation matrix that maps screen coordinates to reaction map coordinates.
Note:
Reaction maps does not necessarily have the same resolution as the device's display.

This transformation matrix is used by default when drawing to reaction map.

Stable

void MReactionMap::setTransform ( QTransform  transform  ) 

Sets a QTransform transformation matrix which is used when drawing to the reaction map.

Sets a QTransform transformation matrix that maps given coordinates to reaction map coordinates. This transformation matrix is then used when drawing to the reaction map.

Warning:
The only supported transformations are scaling and translating. Use of rotating and shearing results undefined behavior.
Parameters:
transform Mapping transformation.
See also:
MReactionMap::fillRectangle().
Stable

void MReactionMap::setTransform ( QGraphicsItem item,
QGraphicsView view 
)

Generates a QTransform transformation matrix from QGraphicsItem and QGraphicsView which is used when drawing to the reaction map.

Sets a QTransform transformation matrix that maps local item coordinates in the given view to reaction map coordinates. This transformation matrix is then used when drawing to the reaction map.

Warning:
The only supported transformations are scaling and translating. Use of rotating and shearing will result in undefined result.
Parameters:
item Graphics item.
view Graphics view.
See also:
MReactionMap::fillRectangle().
Stable

void MReactionMap::fillRectangle ( int  x,
int  y,
int  width,
int  height 
)

Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.

Parameters:
x X coordinate of the top-left corner of the rectangle.
y Y coordinate of the top-left corner of the rectangle.
width Width of the rectangle.
height Height of the rectangle.
Stable

void MReactionMap::fillRectangle ( const QRect rectangle  ) 

Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.

Parameters:
rectangle The filled rectangle to be drawn.
Stable

void MReactionMap::fillRectangle ( const QRectF rectangle  ) 

Draws a filled rectangle on the reaction map using the current transformation matrix and drawing value.

Parameters:
rectangle The filled rectangle to be drawn.
Stable

void MReactionMap::fillRectangle ( const QRect rectangle,
const QString pressFeedback,
const QString releaseFeedback 
)

Draws a filled rectangle on the reaction map with the given press and release values. The current transformation matrix is used.

Even though the specified values override the currently set drawing value, the currently set drawing value itself will not be changed by this method. Therefore subsequent calls to for example fillRectangle(QRect &rectangle) will still use the drawing value that was set before this method was called.

Parameters:
rectangle The filled rectangle to be drawn.
pressFeedback Name of feedback to be played when screen is pressed. Empty string means Inactive value.
releaseFeedback Name of feedback to be played when screen is released. Empty string means Inactive value.
See also:
setTransform()
Stable

void MReactionMap::fillRectangle ( const QRectF rectangle,
const QString pressFeedback,
const QString releaseFeedback 
)

Draws a filled rectangle on the reaction map with the given press and release values. The current transformation matrix is used.

Even though the specified values override the currently set drawing value, the currently set drawing value itself will not be changed by this method. Therefore subsequent calls to for example fillRectangle(QRect &rectangle) will still use the drawing value that was set before this method was called.

Parameters:
rectangle The filled rectangle to be drawn.
pressFeedback Name of feedback to be played when screen is pressed. Empty string means Inactive value.
releaseFeedback Name of feedback to be played when screen is released. Empty string means Inactive value.
See also:
setTransform()
Stable

void MReactionMap::fillItemBoundRect ( QGraphicsItem item  ) 

Draws a filled bound rectangle for a graphics item.

Draws a filled bound rectangle of a graphics item in the view that is associated with the reaction map instance that this function is called from.

Parameters:
item A graphics item to be drawn.
Stable

void MReactionMap::fillItemBoundRect ( QGraphicsItem item,
const QString pressFeedback,
const QString releaseFeedback 
)

Draws a filled bound rectangle for a graphics item.

Draws a filled bound rectangle of a graphics item in the view that is associated with the reaction map instance that this function is called from. Even though the specified drawing values override the currently set drawing values, the currently set drawing value itself won't be changed by this method.

Parameters:
item A graphics item to be drawn.
pressFeedback Name of feedback to be played when screen is pressed. Empty string means Inactive value.
releaseFeedback Name of feedback to be played when screen is released. Empty string means Inactive value.
Stable

int MReactionMap::width (  )  const

Reaction map width.

Returns:
Width, in pixels.
Stable

int MReactionMap::height (  )  const

Reaction map height.

Returns:
Height, in pixels.
Stable

void MReactionMap::clear (  ) 

Clears the reaction map.

Clears the reaction map by filling the entire reaction map with Inactive drawing value.

Stable


Member Data Documentation

const QString MReactionMap::Press = "press" [static]

Default press feedback. Used when the user presses on an object.

const QString MReactionMap::Release = "release" [static]

Default release feedback. Used when finger is released on the object.

const QString MReactionMap::Cancel = "cancel" [static]

Default cancel feedback.

Deprecated

const QString MReactionMap::Transparent = "transparent" [static]

Transparent feedback. Used when the topmost window has transparent areas. There might be a window beneath the current window that uses reaction maps. Paint all transparent areas with this value.

Note:
This is a special value that cannot be overridden by theming.
See also:
MReactionMap::Inactive

const QString MReactionMap::Inactive = "" [static]

Inactive feedback. Used when no feedback is wanted when finger is pressed or released.

Note:
This is a special value that cannot be overridden by theming.

The difference between Inactive and Transparent value is that when finger is pressed or released on Transparent value, the used value is looked from the next window behind the current window according to the top-level window stacking order. If the window beneath the current one uses reactionmaps, feedback is played according to what is drawn on that window's reaction map. When finger is pressed or released on a Inactive value, no feedback is given and no other windows are considered.

MReactionMapPrivate* MReactionMap::d [protected]


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

Copyright © 2010 Nokia Corporation
MeeGo Touch