MAUtil::Environment Class Reference

#include <MAUtil/Environment.h>

Inheritance diagram for MAUtil::Environment:

MAUtil::Moblet List of all members.

Detailed Description

A base class for cross-platform event managers.


Public Member Functions

void addFocusListener (FocusListener *kl)
void removeFocusListener (FocusListener *kl)
bool isFocusListener (FocusListener *kl)
void addKeyListener (KeyListener *kl)
void removeKeyListener (KeyListener *kl)
bool isKeyListener (KeyListener *kl)
void addPointerListener (PointerListener *pl)
void removePointerListener (PointerListener *pl)
bool isPointerListener (PointerListener *pl)
void setBluetoothListener (BluetoothListener *btl)
void removeBluetoothListener ()
void setConnListener (MAHandle conn, ConnListener *cl)
void removeConnListener (MAHandle conn)
void addCloseListener (CloseListener *cl)
void removeCloseListener (CloseListener *cl)
virtual void addIdleListener (IdleListener *il)
virtual void removeIdleListener (IdleListener *il)
void addTimer (TimerListener *tl, int period, int numTimes)
void removeTimer (TimerListener *tl)
virtual ~Environment ()

Static Public Member Functions

static EnvironmentgetEnvironment ()

Protected Member Functions

 Environment ()
void fireFocusGainedEvent ()
void fireFocusLostEvent ()
void fireKeyPressEvent (int keyCode, int nativeCode)
void fireKeyReleaseEvent (int keyCode, int nativeCode)
void firePointerPressEvent (MAPoint2d p)
void firePointerMoveEvent (MAPoint2d p)
void firePointerReleaseEvent (MAPoint2d p)
void fireBluetoothEvent (int state)
void fireConnEvent (const MAConnEventData &data)
void fireCloseEvent ()
void runIdleListeners ()

Protected Attributes

ListenerSet< KeyListenermKeyListeners
ListenerSet< PointerListenermPointerListeners
BluetoothListenermBtListener
Vector< CloseListener * > mCloseListeners
ListenerSet< ConnListenermConnListeners
ListenerSet< IdleListenermIdleListeners
ListenerSet< TimerEventInstancemTimerEvents
ListenerSet< FocusListenermFocusListeners

Classes

class  TimerEventInstance


Constructor & Destructor Documentation

virtual MAUtil::Environment::~Environment  )  [virtual]
 

MAUtil::Environment::Environment  )  [protected]
 

Causes a panic if another Environment already exists. There can be only one.


Member Function Documentation

void MAUtil::Environment::addFocusListener FocusListener kl  ) 
 

Adds the specified listener to the end of the list, unless it is already in the list.

void MAUtil::Environment::removeFocusListener FocusListener kl  ) 
 

Removes the specified listener from the list, if it's in it.

bool MAUtil::Environment::isFocusListener FocusListener kl  ) 
 

Queries whether the specified listener is in the list of key listeners.

void MAUtil::Environment::addKeyListener KeyListener kl  ) 
 

Adds the specified listener to the end of the list, unless it is already in the list.

void MAUtil::Environment::removeKeyListener KeyListener kl  ) 
 

Removes the specified listener from the list, if it's in it.

bool MAUtil::Environment::isKeyListener KeyListener kl  ) 
 

Queries whether the specified listener is in the list of key listeners.

void MAUtil::Environment::addPointerListener PointerListener pl  ) 
 

Adds the specified listener to the end of the list, unless it is already in the list.

void MAUtil::Environment::removePointerListener PointerListener pl  ) 
 

Removes the specified listener from the list, if it's in it.

bool MAUtil::Environment::isPointerListener PointerListener pl  ) 
 

Queries whether the specified listener is in the list of key listeners.

void MAUtil::Environment::setBluetoothListener BluetoothListener btl  ) 
 

Sets the Bluetooth Discovery listener. Causes a panic if there is already a listener set.

Parameters:
btl The listener, or NULL, to remove the set listener, if any.

void MAUtil::Environment::removeBluetoothListener  ) 
 

Removes the set Bluetooth Discovery listener. Causes a panic if there is no listener set.

void MAUtil::Environment::setConnListener MAHandle  conn,
ConnListener cl
 

Sets the listener for a connection. Only one listener per connection is allowed, but the same ConnListener can be used with several connections.

void MAUtil::Environment::removeConnListener MAHandle  conn  ) 
 

Removes the listener for a connection, if any.

void MAUtil::Environment::addCloseListener CloseListener cl  ) 
 

Adds a listener for the Close event. Adds the specified listener to the end of the list, unless it is already in the list.

void MAUtil::Environment::removeCloseListener CloseListener cl  ) 
 

Removes a listener for the Close event. Removes the specified listener from the list, if it's in it. Must not be called from within closeEvent().

virtual void MAUtil::Environment::addIdleListener IdleListener il  )  [virtual]
 

Adds the specified IdleListener to the end of the list, unless it is already in the list.

IdleListeners are run again and again while they are registered. Take care, as constant processor usage will drain battery power quickly.

virtual void MAUtil::Environment::removeIdleListener IdleListener il  )  [virtual]
 

Removes the specified IdleListener from the list, if it's in it.

void MAUtil::Environment::addTimer TimerListener tl,
int  period,
int  numTimes
 

Adds a timer. This causes the runTimerEvent() function of the specified TimerListener to be called a number of times, at a fixed rate. The timer is then removed automatically.

You can only have one timer per listener, so if a timer with the specified listener is already active, it is overwritten.

Parameters:
tl The TimerListener to use.
period The timer's average period, in milliseconds.
numTimes The number of periods that should pass before the timer is removed. May be zero or negative. If so, the timer is never removed automatically.

void MAUtil::Environment::removeTimer TimerListener tl  ) 
 

Removes the timer associated with the specified listener, if any.

static Environment& MAUtil::Environment::getEnvironment  )  [static]
 

Returns a reference to the Environment. Causes a panic if no Environment exists.

void MAUtil::Environment::fireFocusGainedEvent  )  [protected]
 

Calls focusGained() of all registered FocusListeners.

void MAUtil::Environment::fireFocusLostEvent  )  [protected]
 

Calls focusLost() of all registered FocusListeners.

void MAUtil::Environment::fireKeyPressEvent int  keyCode,
int  nativeCode
[protected]
 

Calls keyPressEvent() of all registered KeyListeners with the specified keyCode.

void MAUtil::Environment::fireKeyReleaseEvent int  keyCode,
int  nativeCode
[protected]
 

Calls keyReleaseEvent() of all registered KeyListeners with the specified keyCode.

void MAUtil::Environment::firePointerPressEvent MAPoint2d  p  )  [protected]
 

Calls pointerPressEvent() of all registered PointerListeners with the specified keyCode.

void MAUtil::Environment::firePointerMoveEvent MAPoint2d  p  )  [protected]
 

Calls pointerMoveEvent() of all registered PointerListeners with the specified keyCode.

void MAUtil::Environment::firePointerReleaseEvent MAPoint2d  p  )  [protected]
 

Calls pointerReleaseEvent() of all registered PointerListeners with the specified keyCode.

void MAUtil::Environment::fireBluetoothEvent int  state  )  [protected]
 

Calls the registered BluetoothListener, if any.

void MAUtil::Environment::fireConnEvent const MAConnEventData data  )  [protected]
 

Calls the registered ConnListener, if any, for the MAHandle specified by data.

void MAUtil::Environment::fireCloseEvent  )  [protected]
 

Calls all registered CloseListeners.

void MAUtil::Environment::runIdleListeners  )  [protected]
 

Calls all registered IdleListeners once each.


Member Data Documentation

ListenerSet<KeyListener> MAUtil::Environment::mKeyListeners [protected]
 

ListenerSet<PointerListener> MAUtil::Environment::mPointerListeners [protected]
 

BluetoothListener* MAUtil::Environment::mBtListener [protected]
 

Vector<CloseListener*> MAUtil::Environment::mCloseListeners [protected]
 

ListenerSet<ConnListener> MAUtil::Environment::mConnListeners [protected]
 

ListenerSet<IdleListener> MAUtil::Environment::mIdleListeners [protected]
 

ListenerSet<TimerEventInstance> MAUtil::Environment::mTimerEvents [protected]
 

ListenerSet<FocusListener> MAUtil::Environment::mFocusListeners [protected]
 


Generated on Sat Feb 13 00:15:39 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO