90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
|
/* This file was generated by Maki Compiler, do not edit manually */
|
||
|
|
||
|
#include <precomp.h>
|
||
|
|
||
|
#include "c_text.h"
|
||
|
#include <api/script/objcontroller.h>
|
||
|
|
||
|
C_Text::C_Text(ScriptObject *object) : C_GuiObject(object) {
|
||
|
inited = 0;
|
||
|
obj = NULL;
|
||
|
C_hook(object);
|
||
|
}
|
||
|
|
||
|
C_Text::C_Text() {
|
||
|
inited = 0;
|
||
|
obj = NULL;
|
||
|
}
|
||
|
|
||
|
void C_Text::C_hook(ScriptObject *object) {
|
||
|
ASSERT(!inited);
|
||
|
ScriptObjectController *controller = object->vcpu_getController();
|
||
|
obj = controller->cast(object, textGuid);
|
||
|
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;
|
||
|
settext_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setText", this);
|
||
|
setalternatetext_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setAlternateText", this);
|
||
|
gettext_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getText", this);
|
||
|
gettextwidth_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getTextWidth", this);
|
||
|
ontextchanged_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onTextChanged", this);
|
||
|
}
|
||
|
inited = 1;
|
||
|
}
|
||
|
|
||
|
C_Text::~C_Text() {
|
||
|
}
|
||
|
|
||
|
ScriptObject *C_Text::getScriptObject() {
|
||
|
if (obj != NULL) return obj;
|
||
|
return C_TEXT_PARENT::getScriptObject();
|
||
|
}
|
||
|
|
||
|
void C_Text::setText(const wchar_t *txt)
|
||
|
{
|
||
|
ASSERT(inited);
|
||
|
scriptVar a = MAKE_SCRIPT_STRING(txt);
|
||
|
scriptVar *params[1] = {&a};
|
||
|
WASABI_API_MAKI->maki_callFunction(getScriptObject(), settext_id, params);
|
||
|
}
|
||
|
|
||
|
void C_Text::setAlternateText(const wchar_t *txt)
|
||
|
{
|
||
|
ASSERT(inited);
|
||
|
scriptVar a = MAKE_SCRIPT_STRING(txt);
|
||
|
scriptVar *params[1] = {&a};
|
||
|
WASABI_API_MAKI->maki_callFunction(getScriptObject(), setalternatetext_id, params);
|
||
|
}
|
||
|
|
||
|
const wchar_t *C_Text::getText()
|
||
|
{
|
||
|
ASSERT(inited);
|
||
|
return GET_SCRIPT_STRING(WASABI_API_MAKI->maki_callFunction(getScriptObject(), gettext_id, NULL));
|
||
|
}
|
||
|
|
||
|
int C_Text::getTextWidth()
|
||
|
{
|
||
|
ASSERT(inited);
|
||
|
return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), gettextwidth_id, NULL));
|
||
|
}
|
||
|
|
||
|
void C_Text::onTextChanged(const wchar_t *newtxt)
|
||
|
{
|
||
|
ASSERT(inited);
|
||
|
scriptVar a = MAKE_SCRIPT_STRING(newtxt);
|
||
|
scriptVar *params[1] = {&a};
|
||
|
WASABI_API_MAKI->maki_callFunction(getScriptObject(), ontextchanged_id, params);
|
||
|
}
|
||
|
|
||
|
int C_Text::loaded=0;
|
||
|
int C_Text::settext_id=0;
|
||
|
int C_Text::setalternatetext_id=0;
|
||
|
int C_Text::gettext_id=0;
|
||
|
int C_Text::gettextwidth_id=0;
|
||
|
int C_Text::ontextchanged_id=0;
|