Mercurial > MadButterfly
changeset 724:503f3d18248e
Add symbolic name of event types.
author | wycc |
---|---|
date | Mon, 16 Aug 2010 07:32:56 +0800 |
parents | f95d58a8edd1 |
children | cb50ce5912ac |
files | nodejs/mbapp.js nodejs/testsvg.js |
diffstat | 2 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/mbapp.js Sun Aug 15 19:44:09 2010 +0800 +++ b/nodejs/mbapp.js Mon Aug 16 07:32:56 2010 +0800 @@ -24,9 +24,27 @@ app.prototype.addKeyboardListener=function(type,f) { return this.mb_rt.kbevents.add_event_observer(type,f); } +app.prototype.refresh=function() { + this.mb_rt.redraw_all(); + this.mb_rt.flush(); +} exports.app=app; // Put all key definition here -exports.KEY_UP=111; +exports.KEY_UP = 111; exports.KEY_DOWN=116; +exports.EVT_ANY=0; +exports.EVT_MOUSE_OVER=1; +exports.EVT_MOUSE_OUT=2; +exports.EVT_MOUSE_MOVE=3; +exports.EVT_MOUSE_BUT_PRESS4; +exports.EVT_MOUSE_BUT_RELEASE=5 +exports.EVT_KB_PRESS=6; +exports.EVT_KB_RELEASE=7; +exports.EVT_PROGM_COMPLETE=8; +exports.EVT_RDMAN_REDRAW=9; +exports.EVT_MONITOR_ADD=10; +exports.EVT_MONITOR_REMOVE=11; +exports.EVT_MONITOR_FREE=12; +exports.EVT_MOUSE_MOVE_RAW=13;
--- a/nodejs/testsvg.js Sun Aug 15 19:44:09 2010 +0800 +++ b/nodejs/testsvg.js Mon Aug 16 07:32:56 2010 +0800 @@ -34,7 +34,7 @@ animated(app,obj); } lightbar.animated_loc = 1; -app.addKeyboardListener(6, function(evt) { +app.addKeyboardListener(mbapp.EVT_KB_PRESS, function(evt) { if (evt.keycode == mbapp.KEY_UP) { item = item - 1; if (item == 0) item = 1;