arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

gutz::EventMap< MT > Class Template Reference

#include <ManipEventBase.h>

List of all members.


Detailed Description

template<class MT>
class gutz::EventMap< MT >

Generic Manipulator Event Mapper.

It is simplest if manipulators sub-class from this so that we are not duplicating the interface all over the place.

Template parameter MT is the ManipType, right now this is either a gutz::Manip or a gutz::Camera.

Only stores SmartPtrs not the acutal object, therefore copy and asignment only copies the pointers, does not create new events.

The role of this class is to provide the interface and event handling for all manipulator objects. It maps event handlers (see gutz::ManipEventBase) to buttons and keys defined in gutzKeyMouse.h It also handles mouse events and forwards them to the appropriate event handler. I chose to make this class a base for Manip and Camera since I really don't want to duplicate the interface in both of these classes and it wouldn't make sense to have more than one of them in any class. Plus it facilitates building and copying events without having to create a manipulator or a camera.

Definition at line 118 of file ManipEventBase.h.

[] Accessors

ManipEventTypeSP operator[] (unsigned int key) const
 const, returns a pointer to the event, only if it is mapped! This is good since we don't want to add an event just to check if it exists!!

ManipEventTypeSPoperator[] (unsigned int key)
 standard non-const, same as the map [] operator


Event Interface

ManipEventTypeSP getEvent (const gutz::MouseEvent &me) const
void mapEvent (unsigned int button, ManipEventType *met)

Event Interface

bool mouse (ManipType *m, const gutz::MouseEvent &me)
bool move (ManipType *m, const gutz::MouseMoveEvent &mme)
void endEvent (ManipType *m, const gutz::MouseEvent &me)
bool tumble (ManipType *m)

Event Management

void clearEvents ()
 nuke all events

void cloneEvents (const EventMap &em)
 deep copy of events from some other map.

void shareEvents (const EventMap &em)
 shallow copy of events from some other map


Public Types

typedef MT ManipType
typedef ManipEventBase< MT > ManipEventType
typedef SmartPtr< ManipEventTypeManipEventTypeSP
typedef std::map< unsigned
int, ManipEventTypeSP, std::less<
unsigned int > > 
BaseType
typedef BaseType::iterator Iter
typedef BaseType::const_iterator CIter

Public Member Functions

 EventMap ()
 EventMap (const EventMap &em)
virtual ~EventMap ()
EventMapoperator= (const EventMap &em)

Protected Attributes

ManipEventTypeSP _lastEvent


Member Typedef Documentation

template<class MT>
typedef std::map<unsigned int, ManipEventTypeSP, std::less<unsigned int> > gutz::EventMap< MT >::BaseType
 

Definition at line 127 of file ManipEventBase.h.

Referenced by gutz::EventMap< MT >::EventMap().

template<class MT>
typedef BaseType::const_iterator gutz::EventMap< MT >::CIter
 

Definition at line 129 of file ManipEventBase.h.

Referenced by gutz::EventMap< MT >::cloneEvents(), gutz::EventMap< MT >::operator[](), and gutz::EventMap< MT >::shareEvents().

template<class MT>
typedef BaseType::iterator gutz::EventMap< MT >::Iter
 

Definition at line 128 of file ManipEventBase.h.

template<class MT>
typedef ManipEventBase<MT> gutz::EventMap< MT >::ManipEventType
 

Definition at line 125 of file ManipEventBase.h.

template<class MT>
typedef SmartPtr< ManipEventType > gutz::EventMap< MT >::ManipEventTypeSP
 

Definition at line 126 of file ManipEventBase.h.

Referenced by gutz::EventMap< MT >::getEvent(), and gutz::EventMap< MT >::operator[]().

template<class MT>
typedef MT gutz::EventMap< MT >::ManipType
 

Definition at line 124 of file ManipEventBase.h.


Constructor & Destructor Documentation

template<class MT>
gutz::EventMap< MT >::EventMap  )  [inline]
 

Definition at line 131 of file ManipEventBase.h.

References gutz::EventMap< MT >::BaseType.

template<class MT>
gutz::EventMap< MT >::EventMap const EventMap< MT > &  em  )  [inline]
 

Definition at line 132 of file ManipEventBase.h.

References gutz::EventMap< MT >::BaseType.

template<class MT>
virtual gutz::EventMap< MT >::~EventMap  )  [inline, virtual]
 

Definition at line 133 of file ManipEventBase.h.


Member Function Documentation

template<class MT>
void gutz::EventMap< MT >::clearEvents  )  [inline]
 

nuke all events

Definition at line 208 of file ManipEventBase.h.

template<class MT>
void gutz::EventMap< MT >::cloneEvents const EventMap< MT > &  em  )  [inline]
 

deep copy of events from some other map.

Will likely be used like:

         myManip.cloneEvents( someOtherManip );
since Manips are (sub-classes of) EventMaps

Definition at line 215 of file ManipEventBase.h.

References gutz::EventMap< MT >::CIter, and gutz::EventMap< MT >::mapEvent().

template<class MT>
void gutz::EventMap< MT >::endEvent ManipType m,
const gutz::MouseEvent me
[inline]
 

Definition at line 191 of file ManipEventBase.h.

References gutz::EventMap< MT >::_lastEvent.

template<class MT>
ManipEventTypeSP gutz::EventMap< MT >::getEvent const gutz::MouseEvent me  )  const [inline]
 

Definition at line 165 of file ManipEventBase.h.

References gutz::MouseEvent::getButton(), gutz::EventMap< MT >::ManipEventTypeSP, and gutz::EventMap< MT >::operator[]().

Referenced by gutz::EventMap< MT >::mouse().

template<class MT>
void gutz::EventMap< MT >::mapEvent unsigned int  button,
ManipEventType met
[inline]
 

Definition at line 170 of file ManipEventBase.h.

References gutz::EventMap< MT >::operator[]().

Referenced by gutz::EventMap< MT >::cloneEvents(), and gutz::EventMap< MT >::shareEvents().

template<class MT>
bool gutz::EventMap< MT >::mouse ManipType m,
const gutz::MouseEvent me
[inline]
 

Definition at line 180 of file ManipEventBase.h.

References gutz::EventMap< MT >::_lastEvent, gutz::EventMap< MT >::getEvent(), and gutz::MouseEvent::isButtonDown().

template<class MT>
bool gutz::EventMap< MT >::move ManipType m,
const gutz::MouseMoveEvent mme
[inline]
 

Definition at line 186 of file ManipEventBase.h.

References gutz::EventMap< MT >::_lastEvent.

template<class MT>
EventMap& gutz::EventMap< MT >::operator= const EventMap< MT > &  em  )  [inline]
 

Definition at line 134 of file ManipEventBase.h.

template<class MT>
ManipEventTypeSP& gutz::EventMap< MT >::operator[] unsigned int  key  )  [inline]
 

standard non-const, same as the map [] operator

Definition at line 155 of file ManipEventBase.h.

References gutz::EventMap< MT >::ManipEventTypeSP.

template<class MT>
ManipEventTypeSP gutz::EventMap< MT >::operator[] unsigned int  key  )  const [inline]
 

const, returns a pointer to the event, only if it is mapped! This is good since we don't want to add an event just to check if it exists!!

Definition at line 147 of file ManipEventBase.h.

References gutz::EventMap< MT >::CIter, end, and gutz::EventMap< MT >::ManipEventTypeSP.

Referenced by gutz::EventMap< MT >::getEvent(), and gutz::EventMap< MT >::mapEvent().

template<class MT>
void gutz::EventMap< MT >::shareEvents const EventMap< MT > &  em  )  [inline]
 

shallow copy of events from some other map

Definition at line 224 of file ManipEventBase.h.

References gutz::EventMap< MT >::CIter, and gutz::EventMap< MT >::mapEvent().

template<class MT>
bool gutz::EventMap< MT >::tumble ManipType m  )  [inline]
 

Definition at line 195 of file ManipEventBase.h.

References gutz::EventMap< MT >::_lastEvent.


Member Data Documentation

template<class MT>
ManipEventTypeSP gutz::EventMap< MT >::_lastEvent [protected]
 

Definition at line 236 of file ManipEventBase.h.

Referenced by gutz::EventMap< MT >::endEvent(), gutz::EventMap< MT >::mouse(), gutz::EventMap< MT >::move(), and gutz::EventMap< MT >::tumble().


The documentation for this class was generated from the following file:
Send questions, comments, and bug reports to:
jmk