mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-10 11:59:58 -05:00
Initial community commit
This commit is contained in:
47
Src/Wasabi/api/script/objects/c_script/scripthook.cpp
Normal file
47
Src/Wasabi/api/script/objects/c_script/scripthook.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <precomp.h>
|
||||
|
||||
#include <api/script/scriptobj.h>
|
||||
#include <api/script/objcontroller.h>
|
||||
#include "scripthook.h"
|
||||
|
||||
#define CBCLASS ScriptHookI
|
||||
START_DISPATCH;
|
||||
CB(EVENTCALLBACK, eventCallback);
|
||||
END_DISPATCH;
|
||||
|
||||
ScriptHookI::ScriptHookI() {
|
||||
}
|
||||
|
||||
ScriptHookI::~ScriptHookI() {
|
||||
WASABI_API_MAKI->maki_remDlfRef(this);
|
||||
foreach(controllers)
|
||||
controllers.getfor()->removeHooks(this);
|
||||
endfor
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ScriptHookI::addMonitorObject(ScriptObject *o, const GUID *hookedclass) {
|
||||
WASABI_API_MAKI->maki_addDlfClassRef(o->vcpu_getController(), this);
|
||||
ScriptObjectController *cont = o->vcpu_getController();
|
||||
if (hookedclass == NULL) {
|
||||
cont->addObjectHook(this, o);
|
||||
} else {
|
||||
while (cont) {
|
||||
if (cont->getClassGuid() == *hookedclass) {
|
||||
cont->addObjectHook(this, o);
|
||||
break;
|
||||
}
|
||||
cont = cont->getAncestorController();
|
||||
}
|
||||
}
|
||||
if (cont == NULL) // guid not found
|
||||
return;
|
||||
controllers.addItem(cont);
|
||||
}
|
||||
|
||||
void ScriptHookI::addMonitorClass(ScriptObject *o) {
|
||||
WASABI_API_MAKI->maki_addDlfClassRef(o->vcpu_getController(), this);
|
||||
o->vcpu_getController()->addClassHook(this);
|
||||
controllers.addItem(o->vcpu_getController());
|
||||
}
|
Reference in New Issue
Block a user