rename cocos2dx_gui to cocos2dx_ui

This commit is contained in:
andyque 2014-03-11 17:37:00 +08:00
parent 032ca5f309
commit dcc98ef79f
8 changed files with 141 additions and 1379 deletions

View File

@ -2,176 +2,197 @@
--------------------------------
-- @module ScrollView
--------------------------------
-- @function [parent=#ScrollView] scrollToTop
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] scrollToPercentHorizontal
-- @param self
-- @param #float float
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] isInertiaScrollEnabled
-- @function [parent=#ScrollView] isClippingToBounds
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] scrollToPercentBothDirection
-- @function [parent=#ScrollView] setContainer
-- @param self
-- @param #cc.Node node
--------------------------------
-- @function [parent=#ScrollView] onTouchEnded
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#ScrollView] setContentOffsetInDuration
-- @param self
-- @param #point_table point
-- @param #float float
--------------------------------
-- @function [parent=#ScrollView] setZoomScaleInDuration
-- @param self
-- @param #float float
-- @param #float float
--------------------------------
-- @function [parent=#ScrollView] setBounceable
-- @param self
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] getDirection
-- @param self
-- @return SCROLLVIEW_DIR#SCROLLVIEW_DIR ret (return value: ccui.SCROLLVIEW_DIR)
-- @return ScrollView::Direction#ScrollView::Direction ret (return value: cc.ScrollView::Direction)
--------------------------------
-- @function [parent=#ScrollView] scrollToBottomLeft
-- @function [parent=#ScrollView] getContainer
-- @param self
-- @return Node#Node ret (return value: cc.Node)
--------------------------------
-- @function [parent=#ScrollView] updateTweenAction
-- @param self
-- @param #float float
-- @param #bool bool
-- @param #string str
--------------------------------
-- @function [parent=#ScrollView] getInnerContainer
-- @function [parent=#ScrollView] getZoomScale
-- @param self
-- @return Layout#Layout ret (return value: ccui.Layout)
-- @return float#float ret (return value: float)
--------------------------------
-- @function [parent=#ScrollView] jumpToBottom
-- @function [parent=#ScrollView] updateInset
-- @param self
--------------------------------
-- @function [parent=#ScrollView] initWithViewSize
-- @param self
-- @param #size_table size
-- @param #cc.Node node
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] pause
-- @param self
-- @param #cc.Ref ref
--------------------------------
-- @function [parent=#ScrollView] setDirection
-- @param self
-- @param #ccui.SCROLLVIEW_DIR scrollview_dir
-- @param #cc.ScrollView::Direction direction
--------------------------------
-- @function [parent=#ScrollView] scrollToTopLeft
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToTopRight
-- @param self
--------------------------------
-- @function [parent=#ScrollView] jumpToBottomLeft
-- @param self
--------------------------------
-- @function [parent=#ScrollView] setInnerContainerSize
-- @param self
-- @param #size_table size
--------------------------------
-- @function [parent=#ScrollView] getInnerContainerSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#ScrollView] isBounceEnabled
-- @function [parent=#ScrollView] init
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] jumpToPercentVertical
-- @param self
-- @param #float float
--------------------------------
-- @function [parent=#ScrollView] setInertiaScrollEnabled
-- @param self
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToTopLeft
-- @param self
--------------------------------
-- @function [parent=#ScrollView] jumpToPercentHorizontal
-- @param self
-- @param #float float
--------------------------------
-- @function [parent=#ScrollView] jumpToBottomRight
-- @param self
--------------------------------
-- @function [parent=#ScrollView] setBounceEnabled
-- @param self
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToTop
-- @param self
--------------------------------
-- @function [parent=#ScrollView] scrollToLeft
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToPercentBothDirection
-- @function [parent=#ScrollView] setContentOffset
-- @param self
-- @param #point_table point
--------------------------------
-- @function [parent=#ScrollView] scrollToPercentVertical
-- @param self
-- @param #float float
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] scrollToBottom
-- @function [parent=#ScrollView] isDragging
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] isTouchEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] isBounceable
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] setTouchEnabled
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] scrollToBottomRight
-- @function [parent=#ScrollView] onTouchMoved
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#ScrollView] getContentOffset
-- @param self
-- @return point_table#point_table ret (return value: point_table)
--------------------------------
-- @function [parent=#ScrollView] resume
-- @param self
-- @param #cc.Ref ref
--------------------------------
-- @function [parent=#ScrollView] setClippingToBounds
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToLeft
-- @function [parent=#ScrollView] setViewSize
-- @param self
-- @param #size_table size
--------------------------------
-- @function [parent=#ScrollView] scrollToRight
-- @function [parent=#ScrollView] onTouchCancelled
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#ScrollView] getViewSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- @function [parent=#ScrollView] maxContainerOffset
-- @param self
-- @return point_table#point_table ret (return value: point_table)
--------------------------------
-- @function [parent=#ScrollView] onTouchBegan
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] isTouchMoved
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] isNodeVisible
-- @param self
-- @param #cc.Node node
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#ScrollView] minContainerOffset
-- @param self
-- @return point_table#point_table ret (return value: point_table)
--------------------------------
-- overload function: setZoomScale(float, bool)
--
-- overload function: setZoomScale(float)
--
-- @function [parent=#ScrollView] setZoomScale
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] jumpToRight
-- overload function: create()
--
-- overload function: create(size_table, cc.Node)
--
-- @function [parent=#ScrollView] create
-- @param self
--------------------------------
-- @function [parent=#ScrollView] scrollToTopRight
-- @param self
-- @param #float float
-- @param #bool bool
--------------------------------
-- @function [parent=#ScrollView] create
-- @param self
-- @return ScrollView#ScrollView ret (return value: ccui.ScrollView)
--------------------------------
-- @function [parent=#ScrollView] createInstance
-- @param self
-- @return Ref#Ref ret (return value: cc.Ref)
-- @param #size_table size
-- @param #cc.Node node
-- @return ScrollView#ScrollView ret (retunr value: cc.ScrollView)
--------------------------------
-- @function [parent=#ScrollView] ScrollView
-- @param self

View File

@ -1,94 +0,0 @@
--------------------------------
-- @module ccui
--------------------------------------------------------
-- the ccui LayoutParameter
-- @field [parent=#ccui] LayoutParameter#LayoutParameter LayoutParameter preloaded module
--------------------------------------------------------
-- the ccui LinearLayoutParameter
-- @field [parent=#ccui] LinearLayoutParameter#LinearLayoutParameter LinearLayoutParameter preloaded module
--------------------------------------------------------
-- the ccui RelativeLayoutParameter
-- @field [parent=#ccui] RelativeLayoutParameter#RelativeLayoutParameter RelativeLayoutParameter preloaded module
--------------------------------------------------------
-- the ccui Widget
-- @field [parent=#ccui] Widget#Widget Widget preloaded module
--------------------------------------------------------
-- the ccui Layout
-- @field [parent=#ccui] Layout#Layout Layout preloaded module
--------------------------------------------------------
-- the ccui Button
-- @field [parent=#ccui] Button#Button Button preloaded module
--------------------------------------------------------
-- the ccui CheckBox
-- @field [parent=#ccui] CheckBox#CheckBox CheckBox preloaded module
--------------------------------------------------------
-- the ccui ImageView
-- @field [parent=#ccui] ImageView#ImageView ImageView preloaded module
--------------------------------------------------------
-- the ccui Text
-- @field [parent=#ccui] Text#Text Text preloaded module
--------------------------------------------------------
-- the ccui TextAtlas
-- @field [parent=#ccui] TextAtlas#TextAtlas TextAtlas preloaded module
--------------------------------------------------------
-- the ccui LoadingBar
-- @field [parent=#ccui] LoadingBar#LoadingBar LoadingBar preloaded module
--------------------------------------------------------
-- the ccui ScrollView
-- @field [parent=#ccui] ScrollView#ScrollView ScrollView preloaded module
--------------------------------------------------------
-- the ccui ListView
-- @field [parent=#ccui] ListView#ListView ListView preloaded module
--------------------------------------------------------
-- the ccui Slider
-- @field [parent=#ccui] Slider#Slider Slider preloaded module
--------------------------------------------------------
-- the ccui TextField
-- @field [parent=#ccui] TextField#TextField TextField preloaded module
--------------------------------------------------------
-- the ccui TextBMFont
-- @field [parent=#ccui] TextBMFont#TextBMFont TextBMFont preloaded module
--------------------------------------------------------
-- the ccui PageView
-- @field [parent=#ccui] PageView#PageView PageView preloaded module
--------------------------------------------------------
-- the ccui Helper
-- @field [parent=#ccui] Helper#Helper Helper preloaded module
return nil

View File

@ -1 +0,0 @@
8a35e56a7f283d9816a34997ab75c41201e1c1da

View File

@ -1,351 +0,0 @@
#ifndef __cocos2dx_ui_h__
#define __cocos2dx_ui_h__
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
int register_all_cocos2dx_ui(lua_State* tolua_S);
#endif // __cocos2dx_ui_h__

View File

@ -1,765 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "lua_cocos2dx_gui_manual.hpp"
#include "cocos2d.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
#include "LuaScriptHandlerMgr.h"
#include "CCLuaValue.h"
#include "CocosGUI.h"
#include "CCLuaEngine.h"
using namespace ui;
class LuaCocoStudioEventListener:public Ref
{
public:
LuaCocoStudioEventListener();
virtual ~LuaCocoStudioEventListener();
static LuaCocoStudioEventListener* create();
virtual void eventCallbackFunc(Ref* sender,int eventType);
};
LuaCocoStudioEventListener::LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener::~LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener* LuaCocoStudioEventListener::create()
{
LuaCocoStudioEventListener* listener = new LuaCocoStudioEventListener();
if (nullptr == listener)
return nullptr;
listener->autorelease();
return listener;
}
void LuaCocoStudioEventListener::eventCallbackFunc(Ref* sender,int eventType)
{
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
if (0 != handler)
{
LuaStudioEventListenerData eventData(sender,eventType);
BasicScriptData data(this,(void*)&eventData);
LuaEngine::getInstance()->handleEvent(ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER, (void*)&data);
}
}
static int lua_cocos2dx_Widget_addTouchEventListener(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Widget* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.Widget",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Widget*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "widgetTouchEvent");
self->addTouchEventListener(listener, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addTouchEventListener' function of Widget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addTouchEventListener'.",&tolua_err);
return 0;
#endif
}
static void extendWidget(lua_State* L)
{
lua_pushstring(L, "ccui.Widget");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addTouchEventListener", lua_cocos2dx_Widget_addTouchEventListener);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_CheckBox_addEventListenerCheckBox(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
CheckBox* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.CheckBox",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<CheckBox*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_CheckBox_addEventListenerCheckBox'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "checkBoxEventListener");
self->addEventListenerCheckBox(listener, checkboxselectedeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerCheckBox' function of CheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerCheckBox'.",&tolua_err);
return 0;
#endif
}
static void extendCheckBox(lua_State* L)
{
lua_pushstring(L, "ccui.CheckBox");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerCheckBox", lua_cocos2dx_CheckBox_addEventListenerCheckBox);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_Slider_addEventListenerSlider(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Slider* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Slider*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Slider_addEventListenerSlider'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "sliderEventListener");
self->addEventListenerSlider(listener, sliderpercentchangedselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerSlider' function of Slider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerSlider'.",&tolua_err);
return 0;
#endif
}
static void extendSlider(lua_State* L)
{
lua_pushstring(L, "ccui.Slider");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerSlider", lua_cocos2dx_Slider_addEventListenerSlider);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_TextField_addEventListenerTextField(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TextField* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.TextField",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListenerTextField'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "textfieldEventListener");
self->addEventListenerTextField(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerTextField' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerTextField'.",&tolua_err);
return 0;
#endif
}
static void extendTextField(lua_State* L)
{
lua_pushstring(L, "ccui.TextField");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerTextField", lua_cocos2dx_TextField_addEventListenerTextField);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_PageView_addEventListenerPageView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
PageView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.PageView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListenerPageView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "pageViewEventListener");
self->addEventListenerPageView(listener, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerPageView' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerPageView'.",&tolua_err);
return 0;
#endif
}
static void extendPageView(lua_State* L)
{
lua_pushstring(L, "ccui.PageView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerPageView", lua_cocos2dx_PageView_addEventListenerPageView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_ScrollView_addEventListenerScrollView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
ScrollView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.ScrollView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<ScrollView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ScrollView_addEventListenerScrollView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "scrollViewEventListener");
self->addEventListenerScrollView(listener, scrollvieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerScrollView' function of ScrollView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerScrollView'.",&tolua_err);
return 0;
#endif
}
static void extendScrollView(lua_State* L)
{
lua_pushstring(L, "ccui.ScrollView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerScrollView", lua_cocos2dx_ScrollView_addEventListenerScrollView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_ListView_addEventListenerListView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
ListView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<ListView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addEventListenerListView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
__Dictionary* dict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == dict)
{
dict = Dictionary::create();
self->setUserObject(dict);
}
dict->setObject(listener, "listViewEventListener");
self->addEventListenerListView(listener, listvieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerListView' function of ListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerListView'.",&tolua_err);
return 0;
#endif
}
static void extendListView(lua_State* L)
{
lua_pushstring(L, "ccui.ListView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerListView", lua_cocos2dx_ListView_addEventListenerListView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_LayoutParameter_setMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_setMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_istable(L, 2, 0, &tolua_err))
{
goto tolua_lerror;
}
#endif
Margin margin;
lua_pushstring(L, "left");
lua_gettable(L,2);
margin.left = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "top");
lua_gettable(L,2);
margin.top = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "right");
lua_gettable(L,2);
margin.right = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "bottom");
lua_gettable(L,2);
margin.bottom = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
self->setMargin(margin);
return 0;
}
CCLOG("'setMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'setMargin'.",&tolua_err);
return 0;
#endif
}
static int lua_cocos2dx_LayoutParameter_getMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_getMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (0 == argc)
{
Margin margin = self->getMargin();
lua_newtable(L);
lua_pushstring(L, "left");
lua_pushnumber(L, (lua_Number) margin.left);
lua_rawset(L, -3);
lua_pushstring(L, "top");
lua_pushnumber(L, (lua_Number) margin.top);
lua_rawset(L, -3);
lua_pushstring(L, "right");
lua_pushnumber(L, (lua_Number) margin.right);
lua_rawset(L, -3);
lua_pushstring(L, "bottom");
lua_pushnumber(L, (lua_Number) margin.bottom);
lua_rawset(L, -3);
return 1;
}
CCLOG("'getMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'getMargin'.",&tolua_err);
return 0;
#endif
}
static void extendLayoutParameter(lua_State* L)
{
lua_pushstring(L, "ccui.LayoutParameter");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "setMargin", lua_cocos2dx_LayoutParameter_setMargin);
tolua_function(L, "getMargin", lua_cocos2dx_LayoutParameter_getMargin);
}
lua_pop(L, 1);
}
int register_all_cocos2dx_ui_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendWidget(L);
extendCheckBox(L);
extendSlider(L);
extendTextField(L);
extendPageView(L);
extendScrollView(L);
extendListView(L);
extendLayoutParameter(L);
return 0;
}

View File

@ -1,48 +0,0 @@
/****************************************************************************
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H
#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
#include "CCRef.h"
TOLUA_API int register_all_cocos2dx_ui_manual(lua_State* L);
struct LuaStudioEventListenerData
{
cocos2d::Ref* objTarget;
int eventType;
LuaStudioEventListenerData(cocos2d::Ref* _objTarget, int _eventType):objTarget(_objTarget),eventType(_eventType)
{
}
};
#endif // #ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H

View File

@ -106,7 +106,7 @@ def main():
if platform == 'win32':
config.set('DEFAULT', 'extra_flags', '-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__')
conf_ini_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'userconf.ini'))
conf_ini_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'userconf.ini'))
print 'generating userconf.ini...'
with open(conf_ini_file, 'w') as configfile:
@ -128,7 +128,7 @@ def main():
cmd_args = {'cocos2dx.ini' : ('cocos2d-x', 'lua_cocos2dx_auto'), \
'cocos2dx_extension.ini' : ('cocos2dx_extension', 'lua_cocos2dx_extension_auto'), \
'cocos2dx_gui.ini' : ('cocos2dx_gui', 'lua_cocos2dx_gui_auto'), \
'cocos2dx_ui.ini' : ('cocos2dx_ui', 'lua_cocos2dx_ui_auto'), \
'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \
'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \
'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \
@ -158,7 +158,7 @@ def main():
sys.exit(1)
else:
raise
# -------------- main --------------
if __name__ == '__main__':