From 3089ac302e68b38b7394afb65c5d08eb910d591a Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 29 Jul 2015 13:06:49 +0800 Subject: [PATCH] Refine ui bindings and JS constants --- cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js | 6 ++++++ cocos/ui/UIScrollViewBar.cpp | 8 ++++++++ tools/tojs/cocos2dx_ui.ini | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js b/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js index da8ddface1..8cad380675 100644 --- a/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js +++ b/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js @@ -340,6 +340,12 @@ ccui.TextField.EVENT_DELETE_BACKWARD = 3; ccui.TextField.RENDERER_ZORDER = -1; +/* + * UIRadioButton + */ +ccui.RadioButton.EVENT_SELECTED = 0; +ccui.RadioButton.EVENT_UNSELECTED = 1; +ccui.RadioButtonGroup.EVENT_SELECT_CHANGED = 0; /* * UIMargin diff --git a/cocos/ui/UIScrollViewBar.cpp b/cocos/ui/UIScrollViewBar.cpp index 21413d3574..ec10cb2efc 100644 --- a/cocos/ui/UIScrollViewBar.cpp +++ b/cocos/ui/UIScrollViewBar.cpp @@ -183,6 +183,14 @@ void ScrollViewBar::updateLength(float length) void ScrollViewBar::onEnter() { +#if CC_ENABLE_SCRIPT_BINDING + if (_scriptType == kScriptTypeJavascript) + { + if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) + return; + } +#endif + ProtectedNode::onEnter(); scheduleUpdate(); } diff --git a/tools/tojs/cocos2dx_ui.ini b/tools/tojs/cocos2dx_ui.ini index 0d4ab95c7b..aaa3f101e8 100644 --- a/tools/tojs/cocos2dx_ui.ini +++ b/tools/tojs/cocos2dx_ui.ini @@ -32,7 +32,7 @@ headers = %(cocosdir)s/cocos/ui/CocosGUI.h %(cocosdir)s/cocos/ui/UIScrollViewBar # expression, it will be enclosed in "^$", like this: "^Menu*$". classes = Helper Layout Widget Button CheckBox ImageView Text TextAtlas TextBMFont RichText RichElement RichElementText RichElementImage RichElementCustomNode LoadingBar Slider TextField UICCTextField ScrollView ScrollViewBar PageView ListView LayoutParameter LinearLayoutParameter RelativeLayoutParameter VideoPlayer HBox VBox RelativeBox Scale9Sprite EditBox$ LayoutComponent RadioButtonGroup RadioButton AbstractCheckButton -classes_need_extend = Layout Widget Button CheckBox ImageView Text TextAtlas TextBMFont RichText RichElement RichElementText RichElementImage RichElementCustomNode LoadingBar Slider TextField ScrollView ScrollViewBar PageView ListView VideoPlayer HBox VBox RelativeBox Scale9Sprite EditBox$ LayoutComponent +classes_need_extend = Layout Widget Button CheckBox ImageView Text TextAtlas TextBMFont RichText RichElement RichElementText RichElementImage RichElementCustomNode LoadingBar Slider TextField ScrollView ScrollViewBar PageView ListView VideoPlayer HBox VBox RelativeBox Scale9Sprite EditBox$ LayoutComponent RadioButtonGroup RadioButton AbstractCheckButton # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also