60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
|
/* This file was generated by Maki Compiler, do not edit manually */
|
||
|
|
||
|
#include <precomp.h>
|
||
|
|
||
|
#include "c_togglebutton.h"
|
||
|
#include <api/script/objcontroller.h>
|
||
|
|
||
|
C_ToggleButton::C_ToggleButton(ScriptObject *object) : C_Button(object) {
|
||
|
inited = 0;
|
||
|
obj = NULL;
|
||
|
C_hook(object);
|
||
|
}
|
||
|
|
||
|
C_ToggleButton::C_ToggleButton() {
|
||
|
inited = 0;
|
||
|
obj = NULL;
|
||
|
}
|
||
|
|
||
|
void C_ToggleButton::C_hook(ScriptObject *object) {
|
||
|
ASSERT(!inited);
|
||
|
ScriptObjectController *controller = object->vcpu_getController();
|
||
|
obj = controller->cast(object, toggleButtonGuid);
|
||
|
if (obj != object && obj != NULL)
|
||
|
controller = obj->vcpu_getController();
|
||
|
else
|
||
|
obj = NULL;
|
||
|
|
||
|
int iter = WASABI_API_APP->app_getInitCount();
|
||
|
if (!loaded || loaded != iter) {
|
||
|
loaded = iter;
|
||
|
ontoggle_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onToggle", this);
|
||
|
getcurcfgval_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getCurCfgVal", this);
|
||
|
}
|
||
|
inited = 1;
|
||
|
}
|
||
|
|
||
|
C_ToggleButton::~C_ToggleButton() {
|
||
|
}
|
||
|
|
||
|
ScriptObject *C_ToggleButton::getScriptObject() {
|
||
|
if (obj != NULL) return obj;
|
||
|
return C_TOGGLEBUTTON_PARENT::getScriptObject();
|
||
|
}
|
||
|
|
||
|
void C_ToggleButton::onToggle(int (null)) {
|
||
|
ASSERT(inited);
|
||
|
scriptVar a = MAKE_SCRIPT_INT((null));
|
||
|
scriptVar *params[1] = {&a};
|
||
|
WASABI_API_MAKI->maki_callFunction(getScriptObject(), ontoggle_id, params);
|
||
|
}
|
||
|
|
||
|
int C_ToggleButton::getCurCfgVal() {
|
||
|
ASSERT(inited);
|
||
|
return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getcurcfgval_id, NULL));
|
||
|
}
|
||
|
|
||
|
int C_ToggleButton::loaded=0;
|
||
|
int C_ToggleButton::ontoggle_id=0;
|
||
|
int C_ToggleButton::getcurcfgval_id=0;
|