/* This file was generated by Maki Compiler, do not edit manually */

#include <precomp.h>

#include "c_layout.h"
#include <api/script/objcontroller.h>

C_Layout::C_Layout(ScriptObject *object) : C_Group(object) {
  inited = 0;
  obj = NULL;
  C_hook(object);
}

C_Layout::C_Layout() {
  inited = 0;
  obj = NULL;
}

void C_Layout::C_hook(ScriptObject *object) {
  ASSERT(!inited);
  ScriptObjectController *controller = object->vcpu_getController();
  obj = controller->cast(object, layoutGuid);
  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;
    ondock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onDock", this);
    onundock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onUndock", this);
    onscale_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onScale", this);
    getscale_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getScale", this);
    setscale_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setScale", this);
    setdesktopalpha_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setDesktopAlpha", this);
    getdesktopalpha_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getDesktopAlpha", this);
    getcontainer_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getContainer", this);
    center_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"center", this);
    onmove_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onMove", this);
    onendmove_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onEndMove", this);
    onuserresize_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onUserResize", this);
    snapadjust_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"snapAdjust", this);
    getsnapadjusttop_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getSnapAdjustTop", this);
    getsnapadjustright_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getSnapAdjustRight", this);
    getsnapadjustleft_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getSnapAdjustLeft", this);
    getsnapadjustbottom_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"getSnapAdjustBottom", this);
    setredrawonresize_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setRedrawOnResize", this);
    beforeredock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"beforeRedock", this);
    redock_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"redock", this);
    istransparencysafe_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"isTransparencySafe", this);
    islayoutanimationsafe_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"isLayoutAnimationSafe", this);
    onmouseenterlayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onMouseEnterLayout", this);
    onmouseleavelayout_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onMouseLeaveLayout", this);
    onsnapadjustchanged_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onSnapAdjustChanged", this);
  }
  inited = 1;
}

C_Layout::~C_Layout() {
}

ScriptObject *C_Layout::getScriptObject() {
  if (obj != NULL) return obj;
  return C_LAYOUT_PARENT::getScriptObject();
}

void C_Layout::onDock() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), ondock_id, NULL);
}

void C_Layout::onUndock() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onundock_id, NULL);
}

void C_Layout::onScale(double newscalevalue) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_DOUBLE(newscalevalue);
  scriptVar *params[1] = {&a};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onscale_id, params);
}

double C_Layout::getScale() {
  ASSERT(inited);
  return GET_SCRIPT_DOUBLE(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getscale_id, NULL));
}

void C_Layout::setScale(double scalevalue) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_DOUBLE(scalevalue);
  scriptVar *params[1] = {&a};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), setscale_id, params);
}

void C_Layout::setDesktopAlpha(int onoff) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_INT(onoff);
  scriptVar *params[1] = {&a};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), setdesktopalpha_id, params);
}

int C_Layout::getDesktopAlpha() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getdesktopalpha_id, NULL));
}

ScriptObject *C_Layout::getContainer() {
  ASSERT(inited);
  return GET_SCRIPT_OBJECT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getcontainer_id, NULL));
}

void C_Layout::center() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), center_id, NULL);
}

void C_Layout::onMove() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onmove_id, NULL);
}

void C_Layout::onEndMove() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onendmove_id, NULL);
}

void C_Layout::onUserResize(int x, int y, int w, int h) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_INT(x);
  scriptVar b = MAKE_SCRIPT_INT(y);
  scriptVar c = MAKE_SCRIPT_INT(w);
  scriptVar d = MAKE_SCRIPT_INT(h);
  scriptVar *params[4] = {&a, &b, &c, &d};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onuserresize_id, params);
}

void C_Layout::snapAdjust(int left, int top, int right, int bottom) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_INT(left);
  scriptVar b = MAKE_SCRIPT_INT(top);
  scriptVar c = MAKE_SCRIPT_INT(right);
  scriptVar d = MAKE_SCRIPT_INT(bottom);
  scriptVar *params[4] = {&a, &b, &c, &d};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), snapadjust_id, params);
}

int C_Layout::getSnapAdjustTop() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getsnapadjusttop_id, NULL));
}

int C_Layout::getSnapAdjustRight() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getsnapadjustright_id, NULL));
}

int C_Layout::getSnapAdjustLeft() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getsnapadjustleft_id, NULL));
}

int C_Layout::getSnapAdjustBottom() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), getsnapadjustbottom_id, NULL));
}

void C_Layout::setRedrawOnResize(int wantredrawonresize) {
  ASSERT(inited);
  scriptVar a = MAKE_SCRIPT_INT(wantredrawonresize);
  scriptVar *params[1] = {&a};
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), setredrawonresize_id, params);
}

void C_Layout::beforeRedock() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), beforeredock_id, NULL);
}

void C_Layout::redock() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), redock_id, NULL);
}

int C_Layout::isTransparencySafe() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), istransparencysafe_id, NULL));
}

int C_Layout::isLayoutAnimationSafe() {
  ASSERT(inited);
  return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), islayoutanimationsafe_id, NULL));
}

void C_Layout::onMouseEnterLayout() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onmouseenterlayout_id, NULL);
}

void C_Layout::onMouseLeaveLayout() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onmouseleavelayout_id, NULL);
}

void C_Layout::onSnapAdjustChanged() {
  ASSERT(inited);
  WASABI_API_MAKI->maki_callFunction(getScriptObject(), onsnapadjustchanged_id, NULL);
}

int C_Layout::loaded=0;
int C_Layout::ondock_id=0;
int C_Layout::onundock_id=0;
int C_Layout::onscale_id=0;
int C_Layout::getscale_id=0;
int C_Layout::setscale_id=0;
int C_Layout::setdesktopalpha_id=0;
int C_Layout::getdesktopalpha_id=0;
int C_Layout::getcontainer_id=0;
int C_Layout::center_id=0;
int C_Layout::onmove_id=0;
int C_Layout::onendmove_id=0;
int C_Layout::onuserresize_id=0;
int C_Layout::snapadjust_id=0;
int C_Layout::getsnapadjusttop_id=0;
int C_Layout::getsnapadjustright_id=0;
int C_Layout::getsnapadjustleft_id=0;
int C_Layout::getsnapadjustbottom_id=0;
int C_Layout::setredrawonresize_id=0;
int C_Layout::beforeredock_id=0;
int C_Layout::redock_id=0;
int C_Layout::istransparencysafe_id=0;
int C_Layout::islayoutanimationsafe_id=0;
int C_Layout::onmouseenterlayout_id=0;
int C_Layout::onmouseleavelayout_id=0;
int C_Layout::onsnapadjustchanged_id=0;