The-Powder-Toy/src/cat/LuaWindow.h

81 lines
1.9 KiB
C
Raw Normal View History

2012-08-31 13:39:11 -05:00
#pragma once
extern "C" {
#include "lua5.1/lua.h"
#include "lua5.1/lauxlib.h"
#include "lua5.1/lualib.h"
2012-08-31 13:39:11 -05:00
}
#include "LuaLuna.h"
2012-08-31 14:32:14 -05:00
#include "interface/Platform.h"
2012-08-31 13:39:11 -05:00
namespace ui
{
class Window;
}
2012-09-01 14:13:51 -05:00
class LuaScriptInterface;
2012-08-31 13:39:11 -05:00
class LuaWindow
{
2012-08-31 14:32:14 -05:00
int onInitializedFunction;
int onExitFunction;
int onTickFunction;
int onDrawFunction;
int onFocusFunction;
int onBlurFunction;
int onTryExitFunction;
int onTryOkayFunction;
int onMouseMoveFunction;
int onMouseDownFunction;
int onMouseUpFunction;
int onMouseWheelFunction;
int onKeyPressFunction;
int onKeyReleaseFunction;
2012-08-31 13:39:11 -05:00
ui::Window * window;
lua_State * l;
int position(lua_State * l);
int size(lua_State * l);
int addComponent(lua_State * l);
2012-08-31 14:32:14 -05:00
//Set event handlers
int onInitialized(lua_State * l);
int onExit(lua_State * l);
int onTick(lua_State * l);
int onDraw(lua_State * l);
int onFocus(lua_State * l);
int onBlur(lua_State * l);
int onTryExit(lua_State * l);
int onTryOkay(lua_State * l);
int onMouseMove(lua_State * l);
int onMouseDown(lua_State * l);
int onMouseUp(lua_State * l);
int onMouseWheel(lua_State * l);
int onKeyPress(lua_State * l);
int onKeyRelease(lua_State * l);
void triggerOnInitialized();
void triggerOnExit();
void triggerOnTick(float deltaTime);
void triggerOnDraw();
void triggerOnFocus();
void triggerOnBlur();
void triggerOnTryExit();
void triggerOnTryOkay();
void triggerOnMouseMove(int x, int y, int dx, int dy);
void triggerOnMouseDown(int x, int y, unsigned button);
void triggerOnMouseUp(int x, int y, unsigned button);
void triggerOnMouseWheel(int x, int y, int d);
void triggerOnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
void triggerOnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt);
2012-08-31 13:39:11 -05:00
public:
2012-09-01 14:13:51 -05:00
LuaScriptInterface * ci;
int UserData;
2012-08-31 13:39:11 -05:00
static const char className[];
static Luna<LuaWindow>::RegType methods[];
ui::Window * GetWindow() { return window; }
LuaWindow(lua_State * l);
~LuaWindow();
};