|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CDasherComponent
dasher.CDasherModule
dasher.CInputFilter
public class CInputFilter
Input filters are a key part of the Dasher infrastructure.
They are responsible for taking raw input co-ordinates and modifying the DasherModel in some way if appropriate.
They are also notified of all key presses and are given a chance to apply graphical decorations towards the end of the drawing cycle.
The most important method is Timer, which will be fired at the beginning of each new frame. This is responsible for obtaining input co-ordinates from the View, typically using the GetCoordinates method, and interacting with the model in some way, typically by calling Tap_on_display.
Timer will always be called every frame, regardless of the filter in use, except for when Dasher is paused or locked.
Being Modules, InputFilters have an Activate and Deactivate method which is intended to allow the allocation and deallocation of temporary helper objects, helper threads, network connections and so forth.
It is very important that the Timer method should return as near instantaneously as possible, as this will be called tens of times per second.
Input filters may also interact with the main Dasher interface, typically to start and stop Dasher in response to key presses.
| Field Summary | |
|---|---|
protected CDasherInterfaceBase |
m_Interface
Interface which this InputFilter may control |
| Fields inherited from class dasher.CDasherComponent |
|---|
m_EventHandler, m_SettingsStore |
| Constructor Summary | |
|---|---|
CInputFilter(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CDasherInterfaceBase Interface,
long iID,
int iType,
java.lang.String szName)
Creates a new filter. |
|
| Method Summary | |
|---|---|
void |
Activate()
Activates this filter; now is the time to start helper threads, allocate resources, and so forth. |
void |
Deactivate()
Deactivates this filter; threads should be stopped and resources which can be freed should be. |
boolean |
DecorateView(CDasherView View)
Should draw any decorations applicable to this filter. |
void |
HandleEvent(CEvent Event)
Ignores all events; to be overridden by subclasses if desired. |
void |
KeyDown(long Time,
int iId,
CDasherModel Model)
Notifies the filter of a key-down event at a given time, and allows it to make changes to the Model but not the View in response to this change. |
void |
KeyUp(long Time,
int iId,
CDasherModel Model)
Notifies the filter of a key-up event at a given time, and allows it to make changes to the Model but not the View in response to this change. |
boolean |
Timer(long Time,
CDasherView m_DasherView,
CDasherModel m_DasherModel)
Requests that the input filter should modify the indicated Model. |
| Methods inherited from class dasher.CDasherModule |
|---|
GetID, GetName, GetType, Ref, Unref |
| Methods inherited from class dasher.CDasherComponent |
|---|
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CDasherInterfaceBase m_Interface
| Constructor Detail |
|---|
public CInputFilter(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CDasherInterfaceBase Interface,
long iID,
int iType,
java.lang.String szName)
EventHandler - Event handler with which we should register ourselvesSettingsStore - Settings repository to useInterface - Interface which this filter may controliID - Unique identifier for this ModuleiType - Module type (see DasherModule for a list)szName - Friendly name (ideally unique)CDasherModule| Method Detail |
|---|
public void HandleEvent(CEvent Event)
HandleEvent in class CDasherComponentEvent - Event received.public boolean DecorateView(CDasherView View)
For example, DefaultFilter might draw a line indicating the mouse position at this stage.
If we wish to allow any helper classes to do their own decorating, we should pass the View to them at this stage.
View - View to which we should draw our decorations.
public void KeyDown(long Time,
int iId,
CDasherModel Model)
Time - System time at which the key event took place, as a unix timestamp.iId - ID of the key pressed (see DasherInterfaceBase.KeyDown for a list)Model - DasherModel which may be modified in response to this keypress
public void KeyUp(long Time,
int iId,
CDasherModel Model)
Time - System time at which the key event took place, as a unix timestamp.iId - ID of the key pressed (see DasherInterfaceBase.KeyDown for a list)Model - DasherModel which may be modified in response to this keypress
public boolean Timer(long Time,
CDasherView m_DasherView,
CDasherModel m_DasherModel)
Nothing should be drawn at this stage in spite of the availability of the View; drawing should take place during the call to DecorateView.
See DefaultFilter for a typical example of a Timer method.
Time - System time as a unix timestampm_DasherView - View against which co-ordinates should be resolvedm_DasherModel - Model which we may manipulate in response to this event
public void Activate()
public void Deactivate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||