winamp/Src/Wasabi/api/script/objects/c_script/h_container.cpp

66 lines
2.2 KiB
C++

/* This file was generated by Maki Compiler, do not edit manually */
#include <precomp.h>
#include <api/script/objcontroller.h>
#include "h_container.h"
H_Container::H_Container(ScriptObject *o) : H_RootObject(o) {
inited = 0;
obj = NULL;
H_hook(o);
}
H_Container::H_Container() {
inited = 0;
obj = NULL;
}
void H_Container::H_hook(ScriptObject *o) {
ASSERT(!inited);
ScriptObjectController *controller = o->vcpu_getController();
obj = controller->cast(o, containerGuid);
if (obj != o && obj != NULL)
o = obj;
else
obj = NULL;
addMonitorObject(o, &containerGuid);
int iter = WASABI_API_APP->app_getInitCount();
if (!loaded || loaded != iter) {
onswitchtolayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onSwitchToLayout", this);
onbeforeswitchtolayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onBeforeSwitchToLayout", this);
onhidelayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onHideLayout", this);
onshowlayout_id= WASABI_API_MAKI->maki_addDlfRef(o->vcpu_getController(), L"onShowLayout", this);
loaded = 1;
}
inited=1;
}
H_Container::~H_Container() {
if (!inited) return;
WASABI_API_MAKI->maki_remDlfRef(this);
}
ScriptObject *H_Container::getHookedObject() {
if (obj != NULL) return obj;
return H_CONTAINER_PARENT::getHookedObject();
}
int H_Container::eventCallback(ScriptObject *object, int dlfid, scriptVar **params, int nparams) {
if (object != getHookedObject()) return 0;
if (H_CONTAINER_PARENT::eventCallback(object, dlfid, params, nparams)) return 1;
if (dlfid == onswitchtolayout_id) { hook_onSwitchToLayout(GET_SCRIPT_OBJECT(*params[0])); return 1; }
if (dlfid == onbeforeswitchtolayout_id) { hook_onBeforeSwitchToLayout(GET_SCRIPT_OBJECT(*params[0]), GET_SCRIPT_OBJECT(*params[1])); return 1; }
if (dlfid == onhidelayout_id) { hook_onHideLayout(GET_SCRIPT_OBJECT(*params[0])); return 1; }
if (dlfid == onshowlayout_id) { hook_onShowLayout(GET_SCRIPT_OBJECT(*params[0])); return 1; }
return 0;
}
int H_Container::onswitchtolayout_id=0;
int H_Container::onbeforeswitchtolayout_id=0;
int H_Container::onhidelayout_id=0;
int H_Container::onshowlayout_id=0;
int H_Container::loaded=0;