mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4175 from nutty898/develop_nutty_optimizeguireader_3
[ci skip]Develop nutty optimizeguireader 3
This commit is contained in:
commit
44bed76c21
File diff suppressed because it is too large
Load Diff
|
@ -31,49 +31,90 @@
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
#define kCCSVersion 1.0
|
#define kCCSVersion 1.0
|
||||||
class CCSGUIReader : cocos2d::Object
|
class GUIReader : public cocos2d::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCSGUIReader();
|
GUIReader();
|
||||||
~CCSGUIReader();
|
~GUIReader();
|
||||||
static CCSGUIReader* shareReader();
|
static GUIReader* shareReader();
|
||||||
static void purgeCCSGUIReader();
|
static void purgeGUIReader();
|
||||||
|
|
||||||
gui::UIWidget* widgetFromJsonFile(const char* fileName);
|
gui::UIWidget* widgetFromJsonFile(const char* fileName);
|
||||||
gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* data);
|
|
||||||
|
|
||||||
int getVersionInteger(const char* str);
|
int getVersionInteger(const char* str);
|
||||||
|
|
||||||
void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForContainerWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForPanelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForTextAreaFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForTextButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForImageButtonFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
|
||||||
void setPropsForListViewFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
|
||||||
void setPropsForPageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
void setPropsForDragPanelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
|
||||||
|
|
||||||
void storeFileDesignSize(const char* fileName, const cocos2d::Size &size);
|
void storeFileDesignSize(const char* fileName, const cocos2d::Size &size);
|
||||||
|
|
||||||
const cocos2d::Size getFileDesignSize(const char* fileName) const;
|
const cocos2d::Size getFileDesignSize(const char* fileName) const;
|
||||||
protected:
|
protected:
|
||||||
std::string m_strFilePath;
|
std::string m_strFilePath;
|
||||||
bool m_bOlderVersion;
|
|
||||||
cocos2d::Dictionary* _fileDesignSizes;
|
cocos2d::Dictionary* _fileDesignSizes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WidgetPropertiesReader : public cocos2d::Object
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName)=0;
|
||||||
|
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic) = 0;
|
||||||
|
protected:
|
||||||
|
std::string m_strFilePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WidgetPropertiesReader0250 : public WidgetPropertiesReader
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
WidgetPropertiesReader0250(){};
|
||||||
|
virtual ~WidgetPropertiesReader0250(){};
|
||||||
|
|
||||||
|
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName);
|
||||||
|
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic);
|
||||||
|
virtual void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
|
||||||
|
virtual void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
|
||||||
|
virtual void setPropsForLayoutFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
};
|
||||||
|
|
||||||
|
class WidgetPropertiesReader0300 : public WidgetPropertiesReader
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
WidgetPropertiesReader0300(){};
|
||||||
|
virtual ~WidgetPropertiesReader0300(){};
|
||||||
|
|
||||||
|
virtual gui::UIWidget* createWidget(JsonDictionary* dic, const char* fullPath, const char* fileName);
|
||||||
|
virtual gui::UIWidget* widgetFromJsonDictionary(JsonDictionary* dic);
|
||||||
|
virtual void setPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
|
||||||
|
virtual void setColorPropsForWidgetFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForButtonFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForCheckBoxFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForImageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelAtlasFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLabelBMFontFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForLoadingBarFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForSliderFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForTextFieldFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
|
||||||
|
virtual void setPropsForLayoutFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForPageViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForScrollViewFromJsonDictionary(gui::UIWidget*widget,JsonDictionary* options);
|
||||||
|
virtual void setPropsForListViewFromJsonDictionary(gui::UIWidget* widget, JsonDictionary* options);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ _frontCrossRenderer(NULL),
|
||||||
_backGroundBoxDisabledRenderer(NULL),
|
_backGroundBoxDisabledRenderer(NULL),
|
||||||
_frontCrossDisabledRenderer(NULL),
|
_frontCrossDisabledRenderer(NULL),
|
||||||
_isSelected(true),
|
_isSelected(true),
|
||||||
_selectedStateEventListener(NULL),
|
_checkBoxEventListener(NULL),
|
||||||
_selectedStateEventSelector(NULL),
|
_checkBoxEventSelector(NULL),
|
||||||
_backGroundTexType(UI_TEX_TYPE_LOCAL),
|
_backGroundTexType(UI_TEX_TYPE_LOCAL),
|
||||||
_backGroundSelectedTexType(UI_TEX_TYPE_LOCAL),
|
_backGroundSelectedTexType(UI_TEX_TYPE_LOCAL),
|
||||||
_frontCrossTexType(UI_TEX_TYPE_LOCAL),
|
_frontCrossTexType(UI_TEX_TYPE_LOCAL),
|
||||||
|
@ -51,8 +51,8 @@ _frontCrossDisabledFileName("")
|
||||||
|
|
||||||
UICheckBox::~UICheckBox()
|
UICheckBox::~UICheckBox()
|
||||||
{
|
{
|
||||||
_selectedStateEventListener = NULL;
|
_checkBoxEventListener = NULL;
|
||||||
_selectedStateEventSelector = NULL;
|
_checkBoxEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UICheckBox* UICheckBox::create()
|
UICheckBox* UICheckBox::create()
|
||||||
|
@ -285,24 +285,24 @@ bool UICheckBox::getSelectedState()
|
||||||
|
|
||||||
void UICheckBox::selectedEvent()
|
void UICheckBox::selectedEvent()
|
||||||
{
|
{
|
||||||
if (_selectedStateEventListener && _selectedStateEventSelector)
|
if (_checkBoxEventListener && _checkBoxEventSelector)
|
||||||
{
|
{
|
||||||
(_selectedStateEventListener->*_selectedStateEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
|
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UICheckBox::unSelectedEvent()
|
void UICheckBox::unSelectedEvent()
|
||||||
{
|
{
|
||||||
if (_selectedStateEventListener && _selectedStateEventSelector)
|
if (_checkBoxEventListener && _checkBoxEventSelector)
|
||||||
{
|
{
|
||||||
(_selectedStateEventListener->*_selectedStateEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
|
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UICheckBox::addEventListener(cocos2d::Object *target, SEL_SelectedStateEvent selector)
|
void UICheckBox::addEventListenerCheckBox(cocos2d::Object *target, SEL_SelectedStateEvent selector)
|
||||||
{
|
{
|
||||||
_selectedStateEventListener = target;
|
_checkBoxEventListener = target;
|
||||||
_selectedStateEventSelector = selector;
|
_checkBoxEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UICheckBox::setFlipX(bool flipX)
|
void UICheckBox::setFlipX(bool flipX)
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
||||||
|
|
||||||
//add a call back function would called when checkbox is selected or unselected.
|
//add a call back function would called when checkbox is selected or unselected.
|
||||||
void addEventListener(cocos2d::Object* target,SEL_SelectedStateEvent selector);
|
void addEventListenerCheckBox(cocos2d::Object* target,SEL_SelectedStateEvent selector);
|
||||||
|
|
||||||
//override "setFlipX" method of widget.
|
//override "setFlipX" method of widget.
|
||||||
virtual void setFlipX(bool flipX);
|
virtual void setFlipX(bool flipX);
|
||||||
|
@ -190,8 +190,8 @@ protected:
|
||||||
cocos2d::Sprite* _frontCrossDisabledRenderer;
|
cocos2d::Sprite* _frontCrossDisabledRenderer;
|
||||||
bool _isSelected;
|
bool _isSelected;
|
||||||
|
|
||||||
cocos2d::Object* _selectedStateEventListener;
|
cocos2d::Object* _checkBoxEventListener;
|
||||||
SEL_SelectedStateEvent _selectedStateEventSelector;
|
SEL_SelectedStateEvent _checkBoxEventSelector;
|
||||||
|
|
||||||
TextureResType _backGroundTexType;
|
TextureResType _backGroundTexType;
|
||||||
TextureResType _backGroundSelectedTexType;
|
TextureResType _backGroundSelectedTexType;
|
||||||
|
|
|
@ -129,7 +129,17 @@ void UILayout::setClippingEnabled(bool able)
|
||||||
void UILayout::onSizeChanged()
|
void UILayout::onSizeChanged()
|
||||||
{
|
{
|
||||||
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
|
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
|
||||||
doLayout();
|
if (strcmp(getDescription(), "Layout") == 0)
|
||||||
|
{
|
||||||
|
cocos2d::ccArray* arrayChildren = _children->data;
|
||||||
|
int length = arrayChildren->num;
|
||||||
|
for (int i=0; i<length; ++i)
|
||||||
|
{
|
||||||
|
UIWidget* child = (UIWidget*)arrayChildren->arr[i];
|
||||||
|
child->updateSizeAndPosition();
|
||||||
|
}
|
||||||
|
doLayout();
|
||||||
|
}
|
||||||
if (_backGroundImage)
|
if (_backGroundImage)
|
||||||
{
|
{
|
||||||
_backGroundImage->setPosition(cocos2d::Point(_size.width/2.0f, _size.height/2.0f));
|
_backGroundImage->setPosition(cocos2d::Point(_size.width/2.0f, _size.height/2.0f));
|
||||||
|
|
|
@ -32,7 +32,10 @@ UIListView::UIListView():
|
||||||
_model(NULL),
|
_model(NULL),
|
||||||
_items(NULL),
|
_items(NULL),
|
||||||
_gravity(LISTVIEW_GRAVITY_CENTER_HORIZONTAL),
|
_gravity(LISTVIEW_GRAVITY_CENTER_HORIZONTAL),
|
||||||
_itemsMargin(0.0f)
|
_itemsMargin(0.0f),
|
||||||
|
_listViewEventListener(NULL),
|
||||||
|
_listViewEventSelector(NULL),
|
||||||
|
_curSelectedIndex(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +44,8 @@ UIListView::~UIListView()
|
||||||
{
|
{
|
||||||
_items->removeAllObjects();
|
_items->removeAllObjects();
|
||||||
CC_SAFE_RELEASE(_items);
|
CC_SAFE_RELEASE(_items);
|
||||||
|
_listViewEventListener = NULL;
|
||||||
|
_listViewEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIListView* UIListView::create()
|
UIListView* UIListView::create()
|
||||||
|
@ -376,7 +381,44 @@ void UIListView::refreshView()
|
||||||
remedyLayoutParameter(item);
|
remedyLayoutParameter(item);
|
||||||
}
|
}
|
||||||
updateInnerContainerSize();
|
updateInnerContainerSize();
|
||||||
doLayout();
|
}
|
||||||
|
|
||||||
|
void UIListView::addEventListenerListView(cocos2d::Object *target, SEL_ListViewEvent selector)
|
||||||
|
{
|
||||||
|
_listViewEventListener = target;
|
||||||
|
_listViewEventSelector = selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIListView::selectedItemEvent()
|
||||||
|
{
|
||||||
|
if (_listViewEventListener && _listViewEventSelector)
|
||||||
|
{
|
||||||
|
(_listViewEventListener->*_listViewEventSelector)(this, LISTVIEW_ONSELECEDTITEM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIListView::interceptTouchEvent(int handleState, gui::UIWidget *sender, const cocos2d::Point &touchPoint)
|
||||||
|
{
|
||||||
|
UIScrollView::interceptTouchEvent(handleState, sender, touchPoint);
|
||||||
|
if (handleState != 1)
|
||||||
|
{
|
||||||
|
UIWidget* parent = sender;
|
||||||
|
while (parent)
|
||||||
|
{
|
||||||
|
if (parent && parent->getParent() == _innerContainer)
|
||||||
|
{
|
||||||
|
_curSelectedIndex = getIndex(parent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent->getParent();
|
||||||
|
}
|
||||||
|
selectedItemEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int UIListView::getCurSelectedIndex() const
|
||||||
|
{
|
||||||
|
return _curSelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIListView::onSizeChanged()
|
void UIListView::onSizeChanged()
|
||||||
|
|
|
@ -40,6 +40,14 @@ typedef enum
|
||||||
LISTVIEW_GRAVITY_BOTTOM,
|
LISTVIEW_GRAVITY_BOTTOM,
|
||||||
LISTVIEW_GRAVITY_CENTER_VERTICAL,
|
LISTVIEW_GRAVITY_CENTER_VERTICAL,
|
||||||
}ListViewGravity;
|
}ListViewGravity;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LISTVIEW_ONSELECEDTITEM
|
||||||
|
}ListViewEventType;
|
||||||
|
|
||||||
|
typedef void (cocos2d::Object::*SEL_ListViewEvent)(cocos2d::Object*,ListViewEventType);
|
||||||
|
#define listvieweventselector(_SELECTOR) (SEL_ListViewEvent)(&_SELECTOR)
|
||||||
|
|
||||||
class UIListView : public UIScrollView
|
class UIListView : public UIScrollView
|
||||||
{
|
{
|
||||||
|
@ -145,6 +153,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void refreshView();
|
void refreshView();
|
||||||
|
|
||||||
|
int getCurSelectedIndex() const;
|
||||||
|
|
||||||
|
void addEventListenerListView(cocos2d::Object* target, SEL_ListViewEvent selector);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes scroll direction of scrollview.
|
* Changes scroll direction of scrollview.
|
||||||
*
|
*
|
||||||
|
@ -164,12 +176,17 @@ protected:
|
||||||
virtual UIWidget* createCloneInstance();
|
virtual UIWidget* createCloneInstance();
|
||||||
virtual void copySpecialProperties(UIWidget* model);
|
virtual void copySpecialProperties(UIWidget* model);
|
||||||
virtual void copyClonedWidgetChildren(UIWidget* model);
|
virtual void copyClonedWidgetChildren(UIWidget* model);
|
||||||
|
void selectedItemEvent();
|
||||||
|
virtual void interceptTouchEvent(int handleState,UIWidget* sender,const cocos2d::Point &touchPoint);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
UIWidget* _model;
|
UIWidget* _model;
|
||||||
cocos2d::Array* _items;
|
cocos2d::Array* _items;
|
||||||
ListViewGravity _gravity;
|
ListViewGravity _gravity;
|
||||||
float _itemsMargin;
|
float _itemsMargin;
|
||||||
|
cocos2d::Object* _listViewEventListener;
|
||||||
|
SEL_ListViewEvent _listViewEventSelector;
|
||||||
|
int _curSelectedIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ _autoScrollDistance(0.0f),
|
||||||
_autoScrollSpeed(0.0f),
|
_autoScrollSpeed(0.0f),
|
||||||
_autoScrollDir(0),
|
_autoScrollDir(0),
|
||||||
_childFocusCancelOffset(5.0f),
|
_childFocusCancelOffset(5.0f),
|
||||||
_eventListener(NULL),
|
_pageViewEventListener(NULL),
|
||||||
_eventSelector(NULL)
|
_pageViewEventSelector(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ UIPageView::~UIPageView()
|
||||||
{
|
{
|
||||||
_pages->removeAllObjects();
|
_pages->removeAllObjects();
|
||||||
CC_SAFE_RELEASE(_pages);
|
CC_SAFE_RELEASE(_pages);
|
||||||
_eventListener = NULL;
|
_pageViewEventListener = NULL;
|
||||||
_eventSelector = NULL;
|
_pageViewEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIPageView* UIPageView::create()
|
UIPageView* UIPageView::create()
|
||||||
|
@ -565,16 +565,16 @@ void UIPageView::interceptTouchEvent(int handleState, UIWidget *sender, const co
|
||||||
|
|
||||||
void UIPageView::pageTurningEvent()
|
void UIPageView::pageTurningEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_pageViewEventListener && _pageViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, PAGEVIEW_EVENT_TURNING);
|
(_pageViewEventListener->*_pageViewEventSelector)(this, PAGEVIEW_EVENT_TURNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIPageView::addEventListener(cocos2d::Object *target, SEL_PageViewEvent selector)
|
void UIPageView::addEventListenerPageView(cocos2d::Object *target, SEL_PageViewEvent selector)
|
||||||
{
|
{
|
||||||
_eventListener = target;
|
_pageViewEventListener = target;
|
||||||
_eventSelector = selector;
|
_pageViewEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UIPageView::getCurPageIndex() const
|
int UIPageView::getCurPageIndex() const
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
cocos2d::Array* getPages();
|
cocos2d::Array* getPages();
|
||||||
|
|
||||||
// event
|
// event
|
||||||
void addEventListener(cocos2d::Object *target, SEL_PageViewEvent selector);
|
void addEventListenerPageView(cocos2d::Object *target, SEL_PageViewEvent selector);
|
||||||
|
|
||||||
|
|
||||||
//override "removeChild" method of widget.
|
//override "removeChild" method of widget.
|
||||||
|
@ -186,8 +186,8 @@ protected:
|
||||||
float _autoScrollSpeed;
|
float _autoScrollSpeed;
|
||||||
int _autoScrollDir;
|
int _autoScrollDir;
|
||||||
float _childFocusCancelOffset;
|
float _childFocusCancelOffset;
|
||||||
cocos2d::Object* _eventListener;
|
cocos2d::Object* _pageViewEventListener;
|
||||||
SEL_PageViewEvent _eventSelector;
|
SEL_PageViewEvent _pageViewEventSelector;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,15 +69,15 @@ _bouncing(false),
|
||||||
_bounceDir(cocos2d::Point::ZERO),
|
_bounceDir(cocos2d::Point::ZERO),
|
||||||
_bounceOriginalSpeed(0.0f),
|
_bounceOriginalSpeed(0.0f),
|
||||||
_inertiaScrollEnabled(true),
|
_inertiaScrollEnabled(true),
|
||||||
_eventListener(NULL),
|
_scrollViewEventListener(NULL),
|
||||||
_eventSelector(NULL)
|
_scrollViewEventSelector(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UIScrollView::~UIScrollView()
|
UIScrollView::~UIScrollView()
|
||||||
{
|
{
|
||||||
_eventListener = NULL;
|
_scrollViewEventListener = NULL;
|
||||||
_eventSelector = NULL;
|
_scrollViewEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UIScrollView* UIScrollView::create()
|
UIScrollView* UIScrollView::create()
|
||||||
|
@ -1458,80 +1458,80 @@ void UIScrollView::checkChildInfo(int handleState,UIWidget* sender,const cocos2d
|
||||||
|
|
||||||
void UIScrollView::scrollToTopEvent()
|
void UIScrollView::scrollToTopEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_TOP);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_TOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::scrollToBottomEvent()
|
void UIScrollView::scrollToBottomEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::scrollToLeftEvent()
|
void UIScrollView::scrollToLeftEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_LEFT);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::scrollToRightEvent()
|
void UIScrollView::scrollToRightEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_RIGHT);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLL_TO_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::scrollingEvent()
|
void UIScrollView::scrollingEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_SCROLLING);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_SCROLLING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::bounceTopEvent()
|
void UIScrollView::bounceTopEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_TOP);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_TOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::bounceBottomEvent()
|
void UIScrollView::bounceBottomEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_BOTTOM);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_BOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::bounceLeftEvent()
|
void UIScrollView::bounceLeftEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_LEFT);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::bounceRightEvent()
|
void UIScrollView::bounceRightEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_scrollViewEventListener && _scrollViewEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_RIGHT);
|
(_scrollViewEventListener->*_scrollViewEventSelector)(this, SCROLLVIEW_EVENT_BOUNCE_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::addEventListener(cocos2d::Object *target, SEL_ScrollViewEvent selector)
|
void UIScrollView::addEventListenerScrollView(cocos2d::Object *target, SEL_ScrollViewEvent selector)
|
||||||
{
|
{
|
||||||
_eventListener = target;
|
_scrollViewEventListener = target;
|
||||||
_eventSelector = selector;
|
_scrollViewEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScrollView::setDirection(SCROLLVIEW_DIR dir)
|
void UIScrollView::setDirection(SCROLLVIEW_DIR dir)
|
||||||
|
|
|
@ -231,7 +231,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Add call back function called scrollview event triggered
|
* Add call back function called scrollview event triggered
|
||||||
*/
|
*/
|
||||||
void addEventListener(cocos2d::Object* target, SEL_ScrollViewEvent selector);
|
void addEventListenerScrollView(cocos2d::Object* target, SEL_ScrollViewEvent selector);
|
||||||
|
|
||||||
//override "addChild" method of widget.
|
//override "addChild" method of widget.
|
||||||
virtual bool addChild(UIWidget* widget);
|
virtual bool addChild(UIWidget* widget);
|
||||||
|
@ -382,8 +382,8 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cocos2d::Object* _eventListener;
|
cocos2d::Object* _scrollViewEventListener;
|
||||||
SEL_ScrollViewEvent _eventSelector;
|
SEL_ScrollViewEvent _scrollViewEventSelector;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ _slidBallPressedTextureFile(""),
|
||||||
_slidBallDisabledTextureFile(""),
|
_slidBallDisabledTextureFile(""),
|
||||||
_capInsetsBarRenderer(cocos2d::Rect::ZERO),
|
_capInsetsBarRenderer(cocos2d::Rect::ZERO),
|
||||||
_capInsetsProgressBarRenderer(cocos2d::Rect::ZERO),
|
_capInsetsProgressBarRenderer(cocos2d::Rect::ZERO),
|
||||||
_slidPercentListener(NULL),
|
_sliderEventListener(NULL),
|
||||||
_slidPercentSelector(NULL),
|
_sliderEventSelector(NULL),
|
||||||
_barTexType(UI_TEX_TYPE_LOCAL),
|
_barTexType(UI_TEX_TYPE_LOCAL),
|
||||||
_progressBarTexType(UI_TEX_TYPE_LOCAL),
|
_progressBarTexType(UI_TEX_TYPE_LOCAL),
|
||||||
_ballNTexType(UI_TEX_TYPE_LOCAL),
|
_ballNTexType(UI_TEX_TYPE_LOCAL),
|
||||||
|
@ -58,8 +58,8 @@ _ballDTexType(UI_TEX_TYPE_LOCAL)
|
||||||
|
|
||||||
UISlider::~UISlider()
|
UISlider::~UISlider()
|
||||||
{
|
{
|
||||||
_slidPercentListener = NULL;
|
_sliderEventListener = NULL;
|
||||||
_slidPercentSelector = NULL;
|
_sliderEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UISlider* UISlider::create()
|
UISlider* UISlider::create()
|
||||||
|
@ -411,17 +411,17 @@ float UISlider::getPercentWithBallPos(float px)
|
||||||
return (((px-(-_barLength/2.0f))/_barLength)*100.0f);
|
return (((px-(-_barLength/2.0f))/_barLength)*100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UISlider::addEventListener(cocos2d::Object *target, SEL_SlidPercentChangedEvent selector)
|
void UISlider::addEventListenerSlider(cocos2d::Object *target, SEL_SlidPercentChangedEvent selector)
|
||||||
{
|
{
|
||||||
_slidPercentListener = target;
|
_sliderEventListener = target;
|
||||||
_slidPercentSelector = selector;
|
_sliderEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UISlider::percentChangedEvent()
|
void UISlider::percentChangedEvent()
|
||||||
{
|
{
|
||||||
if (_slidPercentListener && _slidPercentSelector)
|
if (_sliderEventListener && _sliderEventSelector)
|
||||||
{
|
{
|
||||||
(_slidPercentListener->*_slidPercentSelector)(this,SLIDER_PERCENTCHANGED);
|
(_sliderEventListener->*_sliderEventSelector)(this,SLIDER_PERCENTCHANGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Add call back function called when slider's percent has changed to slider.
|
* Add call back function called when slider's percent has changed to slider.
|
||||||
*/
|
*/
|
||||||
void addEventListener(cocos2d::Object* target,SEL_SlidPercentChangedEvent selector);
|
void addEventListenerSlider(cocos2d::Object* target,SEL_SlidPercentChangedEvent selector);
|
||||||
|
|
||||||
//override "onTouchBegan" method of widget.
|
//override "onTouchBegan" method of widget.
|
||||||
virtual bool onTouchBegan(const cocos2d::Point &touchPoint);
|
virtual bool onTouchBegan(const cocos2d::Point &touchPoint);
|
||||||
|
@ -226,8 +226,8 @@ protected:
|
||||||
cocos2d::Rect _capInsetsBarRenderer;
|
cocos2d::Rect _capInsetsBarRenderer;
|
||||||
cocos2d::Rect _capInsetsProgressBarRenderer;
|
cocos2d::Rect _capInsetsProgressBarRenderer;
|
||||||
|
|
||||||
cocos2d::Object* _slidPercentListener;
|
cocos2d::Object* _sliderEventListener;
|
||||||
SEL_SlidPercentChangedEvent _slidPercentSelector;
|
SEL_SlidPercentChangedEvent _sliderEventSelector;
|
||||||
TextureResType _barTexType;
|
TextureResType _barTexType;
|
||||||
TextureResType _progressBarTexType;
|
TextureResType _progressBarTexType;
|
||||||
TextureResType _ballNTexType;
|
TextureResType _ballNTexType;
|
||||||
|
|
|
@ -275,16 +275,16 @@ _textFieldRenderer(NULL),
|
||||||
_touchWidth(0.0f),
|
_touchWidth(0.0f),
|
||||||
_touchHeight(0.0f),
|
_touchHeight(0.0f),
|
||||||
_useTouchArea(false),
|
_useTouchArea(false),
|
||||||
_eventListener(NULL),
|
_textFieldEventListener(NULL),
|
||||||
_eventSelector(NULL),
|
_textFieldEventSelector(NULL),
|
||||||
_passwordStyleText("")
|
_passwordStyleText("")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UITextField::~UITextField()
|
UITextField::~UITextField()
|
||||||
{
|
{
|
||||||
_eventListener = NULL;
|
_textFieldEventListener = NULL;
|
||||||
_eventSelector = NULL;
|
_textFieldEventSelector = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
UITextField* UITextField::create()
|
UITextField* UITextField::create()
|
||||||
|
@ -472,40 +472,40 @@ void UITextField::setDeleteBackward(bool deleteBackward)
|
||||||
|
|
||||||
void UITextField::attachWithIMEEvent()
|
void UITextField::attachWithIMEEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_textFieldEventListener && _textFieldEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_ATTACH_WITH_IME);
|
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_ATTACH_WITH_IME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITextField::detachWithIMEEvent()
|
void UITextField::detachWithIMEEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_textFieldEventListener && _textFieldEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DETACH_WITH_IME);
|
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_DETACH_WITH_IME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITextField::insertTextEvent()
|
void UITextField::insertTextEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_textFieldEventListener && _textFieldEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_INSERT_TEXT);
|
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_INSERT_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITextField::deleteBackwardEvent()
|
void UITextField::deleteBackwardEvent()
|
||||||
{
|
{
|
||||||
if (_eventListener && _eventSelector)
|
if (_textFieldEventListener && _textFieldEventSelector)
|
||||||
{
|
{
|
||||||
(_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DELETE_BACKWARD);
|
(_textFieldEventListener->*_textFieldEventSelector)(this, TEXTFIELD_EVENT_DELETE_BACKWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITextField::addEventListener(cocos2d::Object *target, SEL_TextFieldEvent selecor)
|
void UITextField::addEventListenerTextField(cocos2d::Object *target, SEL_TextFieldEvent selecor)
|
||||||
{
|
{
|
||||||
_eventListener = target;
|
_textFieldEventListener = target;
|
||||||
_eventSelector = selecor;
|
_textFieldEventSelector = selecor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITextField::setAnchorPoint(const cocos2d::Point &pt)
|
void UITextField::setAnchorPoint(const cocos2d::Point &pt)
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
void setInsertText(bool insertText);
|
void setInsertText(bool insertText);
|
||||||
bool getDeleteBackward();
|
bool getDeleteBackward();
|
||||||
void setDeleteBackward(bool deleteBackward);
|
void setDeleteBackward(bool deleteBackward);
|
||||||
void addEventListener(cocos2d::Object* target, SEL_TextFieldEvent selecor);
|
void addEventListenerTextField(cocos2d::Object* target, SEL_TextFieldEvent selecor);
|
||||||
|
|
||||||
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
virtual void setAnchorPoint(const cocos2d::Point &pt);
|
||||||
virtual void setColor(const cocos2d::Color3B &color);
|
virtual void setColor(const cocos2d::Color3B &color);
|
||||||
|
@ -163,8 +163,8 @@ protected:
|
||||||
float _touchHeight;
|
float _touchHeight;
|
||||||
bool _useTouchArea;
|
bool _useTouchArea;
|
||||||
|
|
||||||
cocos2d::Object* _eventListener;
|
cocos2d::Object* _textFieldEventListener;
|
||||||
SEL_TextFieldEvent _eventSelector;
|
SEL_TextFieldEvent _textFieldEventSelector;
|
||||||
|
|
||||||
std::string _passwordStyleText;
|
std::string _passwordStyleText;
|
||||||
};
|
};
|
||||||
|
|
|
@ -881,6 +881,8 @@ public:
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
virtual void onExit();
|
virtual void onExit();
|
||||||
|
|
||||||
|
void updateSizeAndPosition();
|
||||||
|
|
||||||
virtual Object* getUserObject() { return _userObject; }
|
virtual Object* getUserObject() { return _userObject; }
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
|
@ -926,7 +928,6 @@ protected:
|
||||||
void cancelUpEvent();
|
void cancelUpEvent();
|
||||||
void longClickEvent();
|
void longClickEvent();
|
||||||
void updateAnchorPoint();
|
void updateAnchorPoint();
|
||||||
void updateSizeAndPosition();
|
|
||||||
void copyProperties(UIWidget* model);
|
void copyProperties(UIWidget* model);
|
||||||
virtual UIWidget* createCloneInstance();
|
virtual UIWidget* createCloneInstance();
|
||||||
virtual void copySpecialProperties(UIWidget* model);
|
virtual void copySpecialProperties(UIWidget* model);
|
||||||
|
|
|
@ -54,7 +54,7 @@ bool UICheckBoxTest::init()
|
||||||
"cocosgui/check_box_active_disable.png");
|
"cocosgui/check_box_active_disable.png");
|
||||||
checkBox->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
checkBox->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
|
|
||||||
checkBox->addEventListener(this, checkboxselectedeventselector(UICheckBoxTest::selectedEvent));
|
checkBox->addEventListenerCheckBox(this, checkboxselectedeventselector(UICheckBoxTest::selectedEvent));
|
||||||
|
|
||||||
// checkBox->addSelectEvent(this, coco_selectselector(UICheckBoxTest::selectedEvent));
|
// checkBox->addSelectEvent(this, coco_selectselector(UICheckBoxTest::selectedEvent));
|
||||||
m_pUiLayer->addWidget(checkBox);
|
m_pUiLayer->addWidget(checkBox);
|
||||||
|
|
|
@ -79,7 +79,7 @@ bool UIPageViewTest::init()
|
||||||
|
|
||||||
pageView->addPage(layout);
|
pageView->addPage(layout);
|
||||||
}
|
}
|
||||||
pageView->addEventListener(this, pagevieweventselector(UIPageViewTest::pageViewEvent));
|
pageView->addEventListenerPageView(this, pagevieweventselector(UIPageViewTest::pageViewEvent));
|
||||||
|
|
||||||
m_pUiLayer->addWidget(pageView);
|
m_pUiLayer->addWidget(pageView);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ bool UIScene::init()
|
||||||
m_pUiLayer = UILayer::create();
|
m_pUiLayer = UILayer::create();
|
||||||
addChild(m_pUiLayer);
|
addChild(m_pUiLayer);
|
||||||
|
|
||||||
m_pWidget = dynamic_cast<UILayout*>(cocostudio::CCSGUIReader::shareReader()->widgetFromJsonFile("cocosgui/UITest/UITest.json"));
|
m_pWidget = dynamic_cast<UILayout*>(cocostudio::GUIReader::shareReader()->widgetFromJsonFile("cocosgui/UITest/UITest.json"));
|
||||||
m_pUiLayer->addWidget(m_pWidget);
|
m_pUiLayer->addWidget(m_pWidget);
|
||||||
|
|
||||||
m_pSceneTitle = dynamic_cast<UILabel*>(m_pUiLayer->getWidgetByName("UItest"));
|
m_pSceneTitle = dynamic_cast<UILabel*>(m_pUiLayer->getWidgetByName("UItest"));
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool UISliderTest::init()
|
||||||
slider->loadSlidBallTextures("cocosgui/sliderThumb.png", "cocosgui/sliderThumb.png", "");
|
slider->loadSlidBallTextures("cocosgui/sliderThumb.png", "cocosgui/sliderThumb.png", "");
|
||||||
slider->loadProgressBarTexture("cocosgui/sliderProgress.png");
|
slider->loadProgressBarTexture("cocosgui/sliderProgress.png");
|
||||||
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
slider->addEventListener(this, sliderpercentchangedselector(UISliderTest::percentChangedEvent));
|
slider->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest::percentChangedEvent));
|
||||||
m_pUiLayer->addWidget(slider);
|
m_pUiLayer->addWidget(slider);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -116,7 +116,7 @@ bool UISliderTest_Scale9::init()
|
||||||
slider->setCapInsets(Rect(0, 0, 0, 0));
|
slider->setCapInsets(Rect(0, 0, 0, 0));
|
||||||
slider->setSize(Size(250, 10));
|
slider->setSize(Size(250, 10));
|
||||||
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
slider->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
slider->addEventListener(this, sliderpercentchangedselector(UISliderTest_Scale9::percentChangedEvent));
|
slider->addEventListenerSlider(this, sliderpercentchangedselector(UISliderTest_Scale9::percentChangedEvent));
|
||||||
m_pUiLayer->addWidget(slider);
|
m_pUiLayer->addWidget(slider);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -51,7 +51,7 @@ bool UITextFieldTest::init()
|
||||||
textField->setFontSize(30);
|
textField->setFontSize(30);
|
||||||
textField->setPlaceHolder("input words here");
|
textField->setPlaceHolder("input words here");
|
||||||
textField->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
textField->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest::textFieldEvent));
|
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest::textFieldEvent));
|
||||||
m_pUiLayer->addWidget(textField);
|
m_pUiLayer->addWidget(textField);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,7 +139,7 @@ bool UITextFieldTest_MaxLength::init()
|
||||||
textField->setFontSize(30);
|
textField->setFontSize(30);
|
||||||
textField->setPlaceHolder("input words here");
|
textField->setPlaceHolder("input words here");
|
||||||
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest_MaxLength::textFieldEvent));
|
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest_MaxLength::textFieldEvent));
|
||||||
m_pUiLayer->addWidget(textField);
|
m_pUiLayer->addWidget(textField);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -233,7 +233,7 @@ bool UITextFieldTest_Password::init()
|
||||||
textField->setFontSize(30);
|
textField->setFontSize(30);
|
||||||
textField->setPlaceHolder("input password here");
|
textField->setPlaceHolder("input password here");
|
||||||
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
textField->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||||
textField->addEventListener(this, textfieldeventselector(UITextFieldTest_Password::textFieldEvent));
|
textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest_Password::textFieldEvent));
|
||||||
m_pUiLayer->addWidget(textField);
|
m_pUiLayer->addWidget(textField);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue