void LuaEventHandler::editBoxEvent(const char *e, CCEditBox *eb){ if(_handler && e){ lua_pushstring(_lua, e); lua_pushlightuserdata(_lua, eb); executeHandler(2); } }
// ********************************************************************************************************* void CLuaEventForwarder::onSelect(bool selected) { //H_AUTO(R2_CLuaEventForwarder_onSelect) CLuaState *ls = getLua(); if (!ls) return; ls->push(selected); executeHandler(LuaStr_onSelect, 1); }
// ********************************************************************************************************* void CLuaEventForwarder::onFocus(bool focused) { //H_AUTO(R2_CLuaEventForwarder_onFocus) CLuaState *ls = getLua(); if (!ls) return; ls->push(focused); executeHandler(LuaStr_onFocus, 1); }
// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstancePostHrcMove(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstancePostHrcMove) CLuaState *ls = getLua(); if (!ls) return; ls->push(refMakerAttr); ls->push((double) refMakerAttrIndex); executeHandler(LuaStr_onTargetInstancePostHrcMove, 2); }
// ********************************************************************************************************* void CLuaEventForwarder::onAttrModified(const std::string &attrName, sint32 index) { //H_AUTO(R2_CLuaEventForwarder_onAttrModified) CLuaState *ls = getLua(); if (!ls) return; ls->push(attrName); ls->push((double) index); executeHandler(LuaStr_onAttrModified, 2); }
// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstanceAttrModified(const std::string &refMakerAttr, sint32 refMakerAttrIndex, const std::string &targetAttrName, sint32 targetAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstanceAttrModified) CLuaState *ls = getLua(); if (!ls) return; ls->push(refMakerAttr); ls->push((double) refMakerAttrIndex); ls->push(targetAttrName); ls->push((double) targetAttrIndex); executeHandler(LuaStr_onTargetInstanceAttrModified, 4); }
// ********************************************************************************************************* void CLuaEventForwarder::onPostHrcMove() { //H_AUTO(R2_CLuaEventForwarder_onPostHrcMove) if (!getLua()) return; executeHandler(LuaStr_onPostHrcMove, 0); }
// ********************************************************************************************************* void CLuaEventForwarder::onErase() { //H_AUTO(R2_CLuaEventForwarder_onErase) if (!getLua()) return; executeHandler(LuaStr_onErase, 0); }
// ********************************************************************************************************* void CLuaEventForwarder::onContinentChanged() { //H_AUTO(R2_CLuaEventForwarder_onContinentChanged) if (!getLua()) return; executeHandler(LuaStr_onContinentChanged, 0); }
int main(int argc, char *argv[]) { int winid; struct Msg msg; struct Context context; //int shell_pid; //int finder_pid; short isRun = 1; // short isInit = 1; ClickableManager manager; winid = init_context(&context, 800, 600); fill_rect(context, 0, 0, context.width, context.height, 0xffff); // puts_str(context, "desktop: welcome", 0x0, 0, 0); PICNODE pic1, pic2, pic3/*, background*/; loadBitmap(&pic1, "music.bmp"); loadBitmap(&pic2, "setting.bmp"); loadBitmap(&pic3, "notes.bmp"); //loadBitmap(&background, "bg.bmp"); set_icon_alpha(&pic1); set_icon_alpha(&pic2); set_icon_alpha(&pic3); // set_icon_alpha(&pic4); // fill_rect(context, 160, 400, 500, 150, 0x0101); // //loadBitmap(&background, "bg.bmp"); //draw_picture(context, background, 0, 0); draw_picture(context, pic1, 225, 450); draw_picture(context, pic2, 367, 450); draw_picture(context, pic3, 500, 450); //draw_iconlist(context, iconlist, sizeof(iconlist) / sizeof(ICON)); manager = initClickManager(context); createClickable(&manager, initRect(225, 450, 75, 75), MSG_DOUBLECLICK, playmusic); createClickable(&manager, initRect(367, 450, 75, 75), MSG_DOUBLECLICK, shellinit); createClickable(&manager, initRect(500, 450, 75, 75), MSG_DOUBLECLICK, finderinit); while(isRun) { getMsg(&msg); switch(msg.msg_type) { case MSG_UPDATE: updateWindow(winid, context.addr); //printf(0, "desktop"); /*if (isInit) { finderinit((Point){0, 0}); //finderinit((Point){0, 0}); //shell_pid = shellinit((Point){context.width / 2, context.height / 2}); //shellinit((Point){context.width / 2, context.height / 2}); isInit = 0; }*/ break; case MSG_PARTIAL_UPDATE: updatePartialWindow(winid, context.addr, msg.concrete_msg.msg_partial_update.x1, msg.concrete_msg.msg_partial_update.y1, msg.concrete_msg.msg_partial_update.x2, msg.concrete_msg.msg_partial_update.y2); break; case MSG_DOUBLECLICK: executeHandler(manager.double_click, initPoint(msg.concrete_msg.msg_mouse.x, msg.concrete_msg.msg_mouse.y)); break; default: break; } } //int windowId; //int result; //windowId = createWindow(0, 0, 800, 600); //printf(0, "windowId: %d\n", windowId); //result = updateWindow(windowId, context.addr); //printf(0, "updateResult: %d\n", result); free_context(&context, winid); exit(); }