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

78 lines
1.9 KiB
C
Raw Normal View History

2012-08-31 13:39:11 -05:00
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#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;
}
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:
static const char className[];
static Luna<LuaWindow>::RegType methods[];
ui::Window * GetWindow() { return window; }
LuaWindow(lua_State * l);
~LuaWindow();
};