Modify member names

This commit is contained in:
CaiWenzhi 2013-09-16 15:32:52 +08:00 committed by James Chen
parent a6428824d5
commit 210af21615
19 changed files with 577 additions and 577 deletions

File diff suppressed because it is too large Load Diff

View File

@ -911,48 +911,48 @@ protected:
virtual void releaseResoures(); virtual void releaseResoures();
void updateSizeAndPosition(); void updateSizeAndPosition();
protected: protected:
bool m_bEnabled; ///< Highest control of widget bool _enabled; ///< Highest control of widget
bool m_bVisible; ///< is this widget visible bool _visible; ///< is this widget visible
bool m_bBright; ///< is this widget bright bool _bright; ///< is this widget bright
bool m_bTouchEnabled; ///< is this widget touch endabled bool _touchEnabled; ///< is this widget touch endabled
bool m_bTouchPassedEnabled; ///< is the touch event should be passed bool _touchPassedEnabled; ///< is the touch event should be passed
bool m_bFocus; ///< is the widget on focus bool _focus; ///< is the widget on focus
int m_nWidgetZOrder; ///< z-order value that affects the draw order and touch order int _widgetZOrder; ///< z-order value that affects the draw order and touch order
Point m_anchorPoint; ///< anchor point normalized Point _anchorPoint; ///< anchor point normalized
UIWidget* m_pWidgetParent; ///< parent of widget UIWidget* _widgetParent; ///< parent of widget
BrightStyle m_eBrightStyle; ///< bright style BrightStyle _brightStyle; ///< bright style
bool m_bUpdateEnabled; ///< is "update" method scheduled bool _updateEnabled; ///< is "update" method scheduled
Node* m_pRenderer; ///< base renderer Node* _renderer; ///< base renderer
Point m_touchStartPos; ///< touch began point Point _touchStartPos; ///< touch began point
Point m_touchMovePos; ///< touch moved point Point _touchMovePos; ///< touch moved point
Point m_touchEndPos; ///< touch ended point Point _touchEndPos; ///< touch ended point
Object* m_pTouchEventListener; Object* _touchEventListener;
SEL_TouchEvent m_pfnTouchEventSelector; SEL_TouchEvent _touchEventSelector;
int m_nWidgetTag; int _widgetTag;
std::string m_strName; std::string _name;
WidgetType m_WidgetType; WidgetType _widgetType;
int m_nActionTag; int _actionTag;
Size m_size; Size _size;
Size m_customSize; Size _customSize;
LayoutParameter* m_pLayoutParameter; LayoutParameter* _layoutParameter;
bool m_bIgnoreSize; bool _ignoreSize;
Array* m_children; Array* _children;
bool m_bAffectByClipping; bool _affectByClipping;
Scheduler* m_pScheduler; Scheduler* _scheduler;
SizeType m_eSizeType; SizeType _sizeType;
Point m_sizePercent; Point _sizePercent;
PositionType m_ePositionType; PositionType _positionType;
Point m_positionPercent; Point _positionPercent;
bool m_bIsRunning; bool _isRunning;
/*temp action*/ /*temp action*/
UIActionNode* m_pBindingAction; UIActionNode* _bindingAction;
}; };
class GUIRenderer : public NodeRGBA class GUIRenderer : public NodeRGBA
@ -965,7 +965,7 @@ public:
void setEnabled(bool enabled); void setEnabled(bool enabled);
bool isEnabled() const; bool isEnabled() const;
protected: protected:
bool m_bEnabled; bool _enabled;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -28,7 +28,7 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
#define DYNAMIC_CAST_CLIPPINGLAYER dynamic_cast<RectClippingNode*>(m_pRenderer) #define DYNAMIC_CAST_CLIPPINGLAYER dynamic_cast<RectClippingNode*>(_renderer)
Layout::Layout(): Layout::Layout():
m_bClippingEnabled(false), m_bClippingEnabled(false),
@ -48,7 +48,7 @@ m_AlongVector(Point(0.0f, -1.0f)),
m_nCOpacity(255), m_nCOpacity(255),
m_backGroundImageTextureSize(Size::ZERO) m_backGroundImageTextureSize(Size::ZERO)
{ {
m_WidgetType = WidgetTypeContainer; _widgetType = WidgetTypeContainer;
} }
Layout::~Layout() Layout::~Layout()
@ -70,12 +70,12 @@ Layout* Layout::create()
bool Layout::init() bool Layout::init()
{ {
m_children = CCArray::create(); _children = CCArray::create();
m_children->retain(); _children->retain();
initRenderer(); initRenderer();
m_pRenderer->retain(); _renderer->retain();
m_pRenderer->setZOrder(m_nWidgetZOrder); _renderer->setZOrder(_widgetZOrder);
RGBAProtocol* renderRGBA = dynamic_cast<RGBAProtocol*>(m_pRenderer); RGBAProtocol* renderRGBA = dynamic_cast<RGBAProtocol*>(_renderer);
if (renderRGBA) if (renderRGBA)
{ {
renderRGBA->setCascadeColorEnabled(false); renderRGBA->setCascadeColorEnabled(false);
@ -85,8 +85,8 @@ bool Layout::init()
setSize(Size::ZERO); setSize(Size::ZERO);
setBright(true); setBright(true);
setAnchorPoint(Point(0, 0)); setAnchorPoint(Point(0, 0));
m_pScheduler = Director::getInstance()->getScheduler(); _scheduler = Director::getInstance()->getScheduler();
CC_SAFE_RETAIN(m_pScheduler); CC_SAFE_RETAIN(_scheduler);
return true; return true;
} }
@ -108,7 +108,7 @@ LayoutExecutant* Layout::getLayoutExecutant() const
void Layout::initRenderer() void Layout::initRenderer()
{ {
m_pRenderer = RectClippingNode::create(); _renderer = RectClippingNode::create();
} }
bool Layout::isClippingEnabled() bool Layout::isClippingEnabled()
@ -118,8 +118,8 @@ bool Layout::isClippingEnabled()
bool Layout::hitTest(const Point &pt) bool Layout::hitTest(const Point &pt)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(pt); Point nsp = _renderer->convertToNodeSpace(pt);
Rect bb = Rect(0.0f, 0.0f, m_size.width, m_size.height); Rect bb = Rect(0.0f, 0.0f, _size.width, _size.height);
if (nsp.x >= bb.origin.x && nsp.x <= bb.origin.x + bb.size.width && nsp.y >= bb.origin.y && nsp.y <= bb.origin.y + bb.size.height) if (nsp.x >= bb.origin.x && nsp.x <= bb.origin.x + bb.size.width && nsp.y >= bb.origin.y && nsp.y <= bb.origin.y + bb.size.height)
{ {
return true; return true;
@ -135,26 +135,26 @@ void Layout::setClippingEnabled(bool able)
void Layout::onSizeChanged() void Layout::onSizeChanged()
{ {
DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(m_size); DYNAMIC_CAST_CLIPPINGLAYER->setClippingSize(_size);
if (m_pLayoutExecutant) if (m_pLayoutExecutant)
{ {
m_pLayoutExecutant->doLayout(); m_pLayoutExecutant->doLayout();
} }
if (m_pBackGroundImage) if (m_pBackGroundImage)
{ {
m_pBackGroundImage->setPosition(Point(m_size.width/2.0f, m_size.height/2.0f)); m_pBackGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
if (m_bBackGroundScale9Enable) if (m_bBackGroundScale9Enable)
{ {
dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(_size);
} }
} }
if (m_pColorRender) if (m_pColorRender)
{ {
m_pColorRender->setContentSize(m_size); m_pColorRender->setContentSize(_size);
} }
if (m_pGradientRender) if (m_pGradientRender)
{ {
m_pGradientRender->setContentSize(m_size); m_pGradientRender->setContentSize(_size);
} }
} }
@ -164,18 +164,18 @@ void Layout::setBackGroundImageScale9Enabled(bool able)
{ {
return; return;
} }
m_pRenderer->removeChild(m_pBackGroundImage, true); _renderer->removeChild(m_pBackGroundImage, true);
m_pBackGroundImage = NULL; m_pBackGroundImage = NULL;
m_bBackGroundScale9Enable = able; m_bBackGroundScale9Enable = able;
if (m_bBackGroundScale9Enable) if (m_bBackGroundScale9Enable)
{ {
m_pBackGroundImage = Scale9Sprite::create(); m_pBackGroundImage = Scale9Sprite::create();
m_pRenderer->addChild(m_pBackGroundImage); _renderer->addChild(m_pBackGroundImage);
} }
else else
{ {
m_pBackGroundImage = CCSprite::create(); m_pBackGroundImage = CCSprite::create();
m_pRenderer->addChild(m_pBackGroundImage); _renderer->addChild(m_pBackGroundImage);
} }
m_pBackGroundImage->setZOrder(-1); m_pBackGroundImage->setZOrder(-1);
setBackGroundImage(m_strBackGroundImageFileName.c_str(),m_eBGImageTexType); setBackGroundImage(m_strBackGroundImageFileName.c_str(),m_eBGImageTexType);
@ -207,7 +207,7 @@ void Layout::setBackGroundImage(const char* fileName,TextureResType texType)
default: default:
break; break;
} }
dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(_size);
} }
else else
{ {
@ -234,7 +234,7 @@ void Layout::setBackGroundImage(const char* fileName,TextureResType texType)
dynamic_cast<Sprite*>(m_pBackGroundImage)->setOpacity(getOpacity()); dynamic_cast<Sprite*>(m_pBackGroundImage)->setOpacity(getOpacity());
} }
m_backGroundImageTextureSize = m_pBackGroundImage->getContentSize(); m_backGroundImageTextureSize = m_pBackGroundImage->getContentSize();
m_pBackGroundImage->setPosition(Point(m_size.width/2.0f, m_size.height/2.0f)); m_pBackGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
} }
void Layout::setBackGroundImageCapInsets(const Rect &capInsets) void Layout::setBackGroundImageCapInsets(const Rect &capInsets)
@ -252,16 +252,16 @@ void Layout::addBackGroundImage()
{ {
m_pBackGroundImage = Scale9Sprite::create(); m_pBackGroundImage = Scale9Sprite::create();
m_pBackGroundImage->setZOrder(-1); m_pBackGroundImage->setZOrder(-1);
m_pRenderer->addChild(m_pBackGroundImage); _renderer->addChild(m_pBackGroundImage);
dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pBackGroundImage)->setPreferredSize(_size);
} }
else else
{ {
m_pBackGroundImage = CCSprite::create(); m_pBackGroundImage = CCSprite::create();
m_pBackGroundImage->setZOrder(-1); m_pBackGroundImage->setZOrder(-1);
m_pRenderer->addChild(m_pBackGroundImage); _renderer->addChild(m_pBackGroundImage);
} }
m_pBackGroundImage->setPosition(Point(m_size.width/2.0f, m_size.height/2.0f)); m_pBackGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
} }
void Layout::removeBackGroundImage() void Layout::removeBackGroundImage()
@ -270,7 +270,7 @@ void Layout::removeBackGroundImage()
{ {
return; return;
} }
m_pRenderer->removeChild(m_pBackGroundImage, true); _renderer->removeChild(m_pBackGroundImage, true);
m_pBackGroundImage = NULL; m_pBackGroundImage = NULL;
m_strBackGroundImageFileName = ""; m_strBackGroundImageFileName = "";
m_backGroundImageTextureSize = Size::ZERO; m_backGroundImageTextureSize = Size::ZERO;
@ -287,26 +287,26 @@ void Layout::setBackGroundColorType(LayoutBackGroundColorType type)
case LAYOUT_COLOR_NONE: case LAYOUT_COLOR_NONE:
if (m_pColorRender) if (m_pColorRender)
{ {
m_pRenderer->removeChild(m_pColorRender, true); _renderer->removeChild(m_pColorRender, true);
m_pColorRender = NULL; m_pColorRender = NULL;
} }
if (m_pGradientRender) if (m_pGradientRender)
{ {
m_pRenderer->removeChild(m_pGradientRender, true); _renderer->removeChild(m_pGradientRender, true);
m_pGradientRender = NULL; m_pGradientRender = NULL;
} }
break; break;
case LAYOUT_COLOR_SOLID: case LAYOUT_COLOR_SOLID:
if (m_pColorRender) if (m_pColorRender)
{ {
m_pRenderer->removeChild(m_pColorRender, true); _renderer->removeChild(m_pColorRender, true);
m_pColorRender = NULL; m_pColorRender = NULL;
} }
break; break;
case LAYOUT_COLOR_GRADIENT: case LAYOUT_COLOR_GRADIENT:
if (m_pGradientRender) if (m_pGradientRender)
{ {
m_pRenderer->removeChild(m_pGradientRender, true); _renderer->removeChild(m_pGradientRender, true);
m_pGradientRender = NULL; m_pGradientRender = NULL;
} }
break; break;
@ -320,19 +320,19 @@ void Layout::setBackGroundColorType(LayoutBackGroundColorType type)
break; break;
case LAYOUT_COLOR_SOLID: case LAYOUT_COLOR_SOLID:
m_pColorRender = CCLayerColor::create(); m_pColorRender = CCLayerColor::create();
m_pColorRender->setContentSize(m_size); m_pColorRender->setContentSize(_size);
m_pColorRender->setOpacity(m_nCOpacity); m_pColorRender->setOpacity(m_nCOpacity);
m_pColorRender->setColor(m_cColor); m_pColorRender->setColor(m_cColor);
m_pRenderer->addChild(m_pColorRender,-2); _renderer->addChild(m_pColorRender,-2);
break; break;
case LAYOUT_COLOR_GRADIENT: case LAYOUT_COLOR_GRADIENT:
m_pGradientRender = CCLayerGradient::create(); m_pGradientRender = CCLayerGradient::create();
m_pGradientRender->setContentSize(m_size); m_pGradientRender->setContentSize(_size);
m_pGradientRender->setOpacity(m_nCOpacity); m_pGradientRender->setOpacity(m_nCOpacity);
m_pGradientRender->setStartColor(m_gStartColor); m_pGradientRender->setStartColor(m_gStartColor);
m_pGradientRender->setEndColor(m_gEndColor); m_pGradientRender->setEndColor(m_gEndColor);
m_pGradientRender->setVector(m_AlongVector); m_pGradientRender->setVector(m_AlongVector);
m_pRenderer->addChild(m_pGradientRender,-2); _renderer->addChild(m_pGradientRender,-2);
break; break;
default: default:
break; break;
@ -422,7 +422,7 @@ const Size& Layout::getBackGroundImageTextureSize() const
const Size& Layout::getContentSize() const const Size& Layout::getContentSize() const
{ {
return m_pRenderer->getContentSize(); return _renderer->getContentSize();
} }
RectClippingNode::RectClippingNode(): RectClippingNode::RectClippingNode():

View File

@ -116,7 +116,7 @@ protected:
float m_fFileDesignWidth; float m_fFileDesignWidth;
float m_fFileDesignHeight; float m_fFileDesignHeight;
//texture //texture
CCArray* m_textureFiles; Array* m_textureFiles;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -135,13 +135,13 @@ void UIDragPanel::releaseResoures()
{ {
setUpdateEnabled(false); setUpdateEnabled(false);
removeAllChildren(); removeAllChildren();
m_pRenderer->removeAllChildrenWithCleanup(true); _renderer->removeAllChildrenWithCleanup(true);
m_pRenderer->removeFromParentAndCleanup(true); _renderer->removeFromParentAndCleanup(true);
m_pRenderer->release(); _renderer->release();
Layout::removeChild(m_pInnerContainer); Layout::removeChild(m_pInnerContainer);
m_children->release(); _children->release();
} }
bool UIDragPanel::onTouchBegan(const Point &touchPoint) bool UIDragPanel::onTouchBegan(const Point &touchPoint)
@ -225,8 +225,8 @@ void UIDragPanel::onSizeChanged()
Size innerSize = m_pInnerContainer->getSize(); Size innerSize = m_pInnerContainer->getSize();
float orginInnerSizeWidth = innerSize.width; float orginInnerSizeWidth = innerSize.width;
float orginInnerSizeHeight = innerSize.height; float orginInnerSizeHeight = innerSize.height;
float innerSizeWidth = MAX(orginInnerSizeWidth, m_size.width); float innerSizeWidth = MAX(orginInnerSizeWidth, _size.width);
float innerSizeHeight = MAX(orginInnerSizeHeight, m_size.height); float innerSizeHeight = MAX(orginInnerSizeHeight, _size.height);
m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight)); m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight));
} }
@ -237,9 +237,9 @@ const Size& UIDragPanel::getInnerContainerSize() const
void UIDragPanel::setInnerContainerSize(const cocos2d::Size &size) void UIDragPanel::setInnerContainerSize(const cocos2d::Size &size)
{ {
float innerSizeWidth = m_size.width; float innerSizeWidth = _size.width;
float innerSizeHeight = m_size.height; float innerSizeHeight = _size.height;
if (size.width < m_size.width) if (size.width < _size.width)
{ {
CCLOG("Inner width <= scrollview width, it will be force sized!"); CCLOG("Inner width <= scrollview width, it will be force sized!");
} }
@ -247,7 +247,7 @@ void UIDragPanel::setInnerContainerSize(const cocos2d::Size &size)
{ {
innerSizeWidth = size.width; innerSizeWidth = size.width;
} }
if (size.height < m_size.height) if (size.height < _size.height)
{ {
CCLOG("Inner height <= scrollview height, it will be force sized!"); CCLOG("Inner height <= scrollview height, it will be force sized!");
} }
@ -256,7 +256,7 @@ void UIDragPanel::setInnerContainerSize(const cocos2d::Size &size)
innerSizeHeight = size.height; innerSizeHeight = size.height;
} }
m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight)); m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight));
m_pInnerContainer->setPosition(Point(0, m_size.height - m_pInnerContainer->getSize().height)); m_pInnerContainer->setPosition(Point(0, _size.height - m_pInnerContainer->getSize().height));
} }
const Point& UIDragPanel::getInnerContainerPosition() const const Point& UIDragPanel::getInnerContainerPosition() const
@ -337,7 +337,7 @@ void UIDragPanel::handlePressLogic(const Point &touchPoint)
} }
} }
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
m_touchStartNodeSpace = nsp; m_touchStartNodeSpace = nsp;
m_touchStartWorldSpace = touchPoint; m_touchStartWorldSpace = touchPoint;
@ -358,7 +358,7 @@ void UIDragPanel::handleMoveLogic(const Point &touchPoint)
m_bTouchMoved = true; m_bTouchMoved = true;
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
Point delta = nsp - m_touchStartNodeSpace; Point delta = nsp - m_touchStartNodeSpace;
m_touchStartNodeSpace = nsp; m_touchStartNodeSpace = nsp;
@ -472,8 +472,8 @@ void UIDragPanel::recordSlidTime(float dt)
// check if dragpanel rect contain inner rect // check if dragpanel rect contain inner rect
bool UIDragPanel::checkContainInnerRect() bool UIDragPanel::checkContainInnerRect()
{ {
float width = m_size.width; float width = _size.width;
float height = m_size.height; float height = _size.height;
float innerWidth = m_pInnerContainer->getSize().width; float innerWidth = m_pInnerContainer->getSize().width;
float innerHeight = m_pInnerContainer->getSize().height; float innerHeight = m_pInnerContainer->getSize().height;
@ -566,8 +566,8 @@ bool UIDragPanel::checkToBoundaryWithDeltaPosition(const Point& delta)
float innerBottom = m_pInnerContainer->getBottomInParent(); float innerBottom = m_pInnerContainer->getBottomInParent();
float left = 0; float left = 0;
float top = m_size.height; float top = _size.height;
float right = m_size.width; float right = _size.width;
float bottom = 0; float bottom = 0;
bool toLeftBottom = false; bool toLeftBottom = false;
@ -629,8 +629,8 @@ Point UIDragPanel::calculateToBoundaryDeltaPosition(const Point& paramDelta)
float innerBottom = m_pInnerContainer->getBottomInParent(); float innerBottom = m_pInnerContainer->getBottomInParent();
float left = 0; float left = 0;
float top = m_size.height; float top = _size.height;
float right = m_size.width; float right = _size.width;
float bottom = 0; float bottom = 0;
Point delta = paramDelta; Point delta = paramDelta;
@ -689,8 +689,8 @@ bool UIDragPanel::checkBerth()
float innerBottom = m_pInnerContainer->getBottomInParent(); float innerBottom = m_pInnerContainer->getBottomInParent();
float left = 0; float left = 0;
float top = m_size.height; float top = _size.height;
float right = m_size.width; float right = _size.width;
float bottom = 0; float bottom = 0;
if (innerLeft == left && innerBottom == bottom) // left bottom if (innerLeft == left && innerBottom == bottom) // left bottom
@ -907,8 +907,8 @@ bool UIDragPanel::checkNeedBounce()
float innerBottom = m_pInnerContainer->getBottomInParent(); float innerBottom = m_pInnerContainer->getBottomInParent();
float left = 0; float left = 0;
float top = m_size.height; float top = _size.height;
float right = m_size.width; float right = _size.width;
float bottom = 0; float bottom = 0;
bool need = ((innerLeft > left && innerBottom > bottom) bool need = ((innerLeft > left && innerBottom > bottom)
@ -946,8 +946,8 @@ void UIDragPanel::bounceToCorner()
float innerRight = m_pInnerContainer->getRightInParent(); float innerRight = m_pInnerContainer->getRightInParent();
float innerBottom = m_pInnerContainer->getBottomInParent(); float innerBottom = m_pInnerContainer->getBottomInParent();
float width = m_size.width; float width = _size.width;
float height = m_size.height; float height = _size.height;
float left = 0; float left = 0;
float top = height; float top = height;
float right = width; float right = width;

View File

@ -115,8 +115,8 @@ bool UIListView::init()
void UIListView::onSizeChanged() void UIListView::onSizeChanged()
{ {
Layout::onSizeChanged(); Layout::onSizeChanged();
m_fTopBoundary = m_size.height; m_fTopBoundary = _size.height;
m_fRightBoundary = m_size.width; m_fRightBoundary = _size.width;
} }
bool UIListView::addChild(UIWidget* widget) bool UIListView::addChild(UIWidget* widget)
@ -196,7 +196,7 @@ ListViewDirection UIListView::getDirection()
void UIListView::resetProperty() void UIListView::resetProperty()
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
if (arrayChildren->num <= 0) if (arrayChildren->num <= 0)
{ {
@ -226,7 +226,7 @@ void UIListView::resetProperty()
float scroll_top = m_fTopBoundary; float scroll_top = m_fTopBoundary;
float scroll_left = m_fLeftBoundary; float scroll_left = m_fLeftBoundary;
switch (m_children->count()) switch (_children->count())
{ {
case 1: case 1:
{ {
@ -287,7 +287,7 @@ void UIListView::resetProperty()
void UIListView::handlePressLogic(const Point &touchPoint) void UIListView::handlePressLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
switch (m_eDirection) switch (m_eDirection)
{ {
@ -310,7 +310,7 @@ void UIListView::handlePressLogic(const Point &touchPoint)
void UIListView::handleMoveLogic(const Point &touchPoint) void UIListView::handleMoveLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
float offset = 0.0f; float offset = 0.0f;
switch (m_eDirection) switch (m_eDirection)
@ -357,7 +357,7 @@ void UIListView::handleMoveLogic(const Point &touchPoint)
void UIListView::handleReleaseLogic(const Point &touchPoint) void UIListView::handleReleaseLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
switch (m_eDirection) switch (m_eDirection)
{ {
@ -427,7 +427,7 @@ void UIListView::moveChildren(float offset)
{ {
case LISTVIEW_DIR_VERTICAL: // vertical case LISTVIEW_DIR_VERTICAL: // vertical
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int childrenCount = arrayChildren->num; int childrenCount = arrayChildren->num;
for (int i = 0; i < childrenCount; i++) for (int i = 0; i < childrenCount; i++)
{ {
@ -441,7 +441,7 @@ void UIListView::moveChildren(float offset)
case LISTVIEW_DIR_HORIZONTAL: // horizontal case LISTVIEW_DIR_HORIZONTAL: // horizontal
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int childrenCount = arrayChildren->num; int childrenCount = arrayChildren->num;
for (int i=0;i<childrenCount;i++) for (int i=0;i<childrenCount;i++)
{ {
@ -732,7 +732,7 @@ void UIListView::recordSlidTime(float dt)
void UIListView::startRecordSlidAction() void UIListView::startRecordSlidAction()
{ {
if (m_children->count() <= 0) if (_children->count() <= 0)
{ {
return; return;
} }
@ -746,7 +746,7 @@ void UIListView::startRecordSlidAction()
void UIListView::endRecordSlidAction() void UIListView::endRecordSlidAction()
{ {
if (m_children->count() <= 0) if (_children->count() <= 0)
{ {
return; return;
} }
@ -815,7 +815,7 @@ void UIListView::initChildWithDataLength(int length)
m_nEnd = 0; m_nEnd = 0;
// init child pool // init child pool
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int times = arrayChildren->num; int times = arrayChildren->num;
for (int i = 0; i < times; ++i) for (int i = 0; i < times; ++i)
{ {
@ -1080,7 +1080,7 @@ void UIListView::collectOverTopChild()
{ {
float scroll_top = m_fTopBoundary; float scroll_top = m_fTopBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int times = arrayChildren->num; int times = arrayChildren->num;
for (int i = 0; i < times; ++i) for (int i = 0; i < times; ++i)
{ {
@ -1098,7 +1098,7 @@ void UIListView::collectOverBottomChild()
{ {
float scroll_bottom = m_fBottomBoundary; float scroll_bottom = m_fBottomBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int times = arrayChildren->num; int times = arrayChildren->num;
for (int i = 0; i < times; ++i) for (int i = 0; i < times; ++i)
{ {
@ -1116,7 +1116,7 @@ void UIListView::collectOverLeftChild()
{ {
float scroll_left = m_fLeftBoundary; float scroll_left = m_fLeftBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int times = arrayChildren->num; int times = arrayChildren->num;
for (int i = 0; i < times; ++i) for (int i = 0; i < times; ++i)
{ {
@ -1134,7 +1134,7 @@ void UIListView::collectOverRightChild()
{ {
float scroll_right = m_fRightBoundary; float scroll_right = m_fRightBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int times = arrayChildren->num; int times = arrayChildren->num;
for (int i = 0; i < times; ++i) for (int i = 0; i < times; ++i)
{ {
@ -1156,7 +1156,7 @@ void UIListView::setLoopPosition()
{ {
case LISTVIEW_MOVE_DIR_UP: // up case LISTVIEW_MOVE_DIR_UP: // up
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
unsigned int childrenCount = arrayChildren->num; unsigned int childrenCount = arrayChildren->num;
if (m_overTopArray->count() == childrenCount) if (m_overTopArray->count() == childrenCount)
@ -1184,7 +1184,7 @@ void UIListView::setLoopPosition()
{ {
float scroll_top = m_fTopBoundary; float scroll_top = m_fTopBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int count = arrayChildren->num; int count = arrayChildren->num;
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
@ -1204,7 +1204,7 @@ void UIListView::setLoopPosition()
case LISTVIEW_MOVE_DIR_DOWN: // down case LISTVIEW_MOVE_DIR_DOWN: // down
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
unsigned int childrenCount = arrayChildren->num; unsigned int childrenCount = arrayChildren->num;
if (m_overBottomArray->count() == childrenCount) if (m_overBottomArray->count() == childrenCount)
@ -1230,7 +1230,7 @@ void UIListView::setLoopPosition()
{ {
float scroll_bottom = m_fBottomBoundary; float scroll_bottom = m_fBottomBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int count = arrayChildren->num; int count = arrayChildren->num;
for (int i = count - 1; i >= 0; --i) for (int i = count - 1; i >= 0; --i)
{ {
@ -1258,7 +1258,7 @@ void UIListView::setLoopPosition()
{ {
case LISTVIEW_MOVE_DIR_LEFT: // left case LISTVIEW_MOVE_DIR_LEFT: // left
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
unsigned int childrenCount = arrayChildren->num; unsigned int childrenCount = arrayChildren->num;
if (m_overLeftArray->count() == childrenCount) if (m_overLeftArray->count() == childrenCount)
@ -1286,7 +1286,7 @@ void UIListView::setLoopPosition()
{ {
float scroll_left = m_fLeftBoundary; float scroll_left = m_fLeftBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int count = arrayChildren->num; int count = arrayChildren->num;
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
@ -1306,7 +1306,7 @@ void UIListView::setLoopPosition()
case LISTVIEW_MOVE_DIR_RIGHT: // right case LISTVIEW_MOVE_DIR_RIGHT: // right
{ {
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
unsigned int childrenCount = arrayChildren->num; unsigned int childrenCount = arrayChildren->num;
if (m_overRightArray->count() == childrenCount) if (m_overRightArray->count() == childrenCount)
@ -1332,7 +1332,7 @@ void UIListView::setLoopPosition()
{ {
float scroll_right = m_fRightBoundary; float scroll_right = m_fRightBoundary;
ccArray* arrayChildren = m_children->data; ccArray* arrayChildren = _children->data;
int count = arrayChildren->num; int count = arrayChildren->num;
for (int i = count - 1; i >= 0; --i) for (int i = count - 1; i >= 0; --i)
{ {

View File

@ -371,12 +371,12 @@ bool UIPageView::onTouchBegan(const Point &touchPoint)
void UIPageView::onTouchMoved(const Point &touchPoint) void UIPageView::onTouchMoved(const Point &touchPoint)
{ {
m_touchMovePos.x = touchPoint.x; _touchMovePos.x = touchPoint.x;
m_touchMovePos.y = touchPoint.y; _touchMovePos.y = touchPoint.y;
handleMoveLogic(touchPoint); handleMoveLogic(touchPoint);
if (m_pWidgetParent) if (_widgetParent)
{ {
m_pWidgetParent->checkChildInfo(1,this,touchPoint); _widgetParent->checkChildInfo(1,this,touchPoint);
} }
moveEvent(); moveEvent();
if (!hitTest(touchPoint)) if (!hitTest(touchPoint))
@ -453,14 +453,14 @@ void UIPageView::onTouchCancelled(const Point &touchPoint)
void UIPageView::handlePressLogic(const Point &touchPoint) void UIPageView::handlePressLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
m_fTouchMoveStartLocation = nsp.x; m_fTouchMoveStartLocation = nsp.x;
m_fTouchStartLocation = nsp.x; m_fTouchStartLocation = nsp.x;
} }
void UIPageView::handleMoveLogic(const Point &touchPoint) void UIPageView::handleMoveLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
float offset = 0.0; float offset = 0.0;
float moveX = nsp.x; float moveX = nsp.x;
offset = moveX - m_fTouchMoveStartLocation; offset = moveX - m_fTouchMoveStartLocation;

View File

@ -83,13 +83,13 @@ void UIScrollView::releaseResoures()
{ {
setUpdateEnabled(false); setUpdateEnabled(false);
removeAllChildren(); removeAllChildren();
m_pRenderer->removeAllChildrenWithCleanup(true); _renderer->removeAllChildrenWithCleanup(true);
m_pRenderer->removeFromParentAndCleanup(true); _renderer->removeFromParentAndCleanup(true);
m_pRenderer->release(); _renderer->release();
Layout::removeChild(m_pInnerContainer); Layout::removeChild(m_pInnerContainer);
m_children->release(); _children->release();
} }
bool UIScrollView::init() bool UIScrollView::init()
@ -115,22 +115,22 @@ void UIScrollView::initRenderer()
void UIScrollView::onSizeChanged() void UIScrollView::onSizeChanged()
{ {
Layout::onSizeChanged(); Layout::onSizeChanged();
m_fTopBoundary = m_size.height; m_fTopBoundary = _size.height;
m_fRightBoundary = m_size.width; m_fRightBoundary = _size.width;
Size innerSize = m_pInnerContainer->getSize(); Size innerSize = m_pInnerContainer->getSize();
float orginInnerSizeWidth = innerSize.width; float orginInnerSizeWidth = innerSize.width;
float orginInnerSizeHeight = innerSize.height; float orginInnerSizeHeight = innerSize.height;
float innerSizeWidth = MAX(orginInnerSizeWidth, m_size.width); float innerSizeWidth = MAX(orginInnerSizeWidth, _size.width);
float innerSizeHeight = MAX(orginInnerSizeHeight, m_size.height); float innerSizeHeight = MAX(orginInnerSizeHeight, _size.height);
m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight)); m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight));
m_pInnerContainer->setPosition(Point(0, m_size.height - m_pInnerContainer->getSize().height)); m_pInnerContainer->setPosition(Point(0, _size.height - m_pInnerContainer->getSize().height));
} }
void UIScrollView::setInnerContainerSize(const Size &size) void UIScrollView::setInnerContainerSize(const Size &size)
{ {
float innerSizeWidth = m_size.width; float innerSizeWidth = _size.width;
float innerSizeHeight = m_size.height; float innerSizeHeight = _size.height;
if (size.width < m_size.width) if (size.width < _size.width)
{ {
CCLOG("Inner width <= scrollview width, it will be force sized!"); CCLOG("Inner width <= scrollview width, it will be force sized!");
} }
@ -138,7 +138,7 @@ void UIScrollView::setInnerContainerSize(const Size &size)
{ {
innerSizeWidth = size.width; innerSizeWidth = size.width;
} }
if (size.height < m_size.height) if (size.height < _size.height)
{ {
CCLOG("Inner height <= scrollview height, it will be force sized!"); CCLOG("Inner height <= scrollview height, it will be force sized!");
} }
@ -147,7 +147,7 @@ void UIScrollView::setInnerContainerSize(const Size &size)
innerSizeHeight = size.height; innerSizeHeight = size.height;
} }
m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight)); m_pInnerContainer->setSize(Size(innerSizeWidth, innerSizeHeight));
m_pInnerContainer->setPosition(Point(0, m_size.height - m_pInnerContainer->getSize().height)); m_pInnerContainer->setPosition(Point(0, _size.height - m_pInnerContainer->getSize().height));
} }
const Size& UIScrollView::getInnerContainerSize() const const Size& UIScrollView::getInnerContainerSize() const
@ -402,7 +402,7 @@ void UIScrollView::scrollToTop()
void UIScrollView::startRecordSlidAction() void UIScrollView::startRecordSlidAction()
{ {
if (m_children->count() <= 0) if (_children->count() <= 0)
{ {
return; return;
} }
@ -415,7 +415,7 @@ void UIScrollView::startRecordSlidAction()
void UIScrollView::endRecordSlidAction() void UIScrollView::endRecordSlidAction()
{ {
if (m_children->count() <= 0) if (_children->count() <= 0)
{ {
return; return;
} }
@ -434,7 +434,7 @@ void UIScrollView::endRecordSlidAction()
void UIScrollView::handlePressLogic(const Point &touchPoint) void UIScrollView::handlePressLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
switch (m_eDirection) switch (m_eDirection)
{ {
case SCROLLVIEW_DIR_VERTICAL: // vertical case SCROLLVIEW_DIR_VERTICAL: // vertical
@ -451,9 +451,9 @@ void UIScrollView::handlePressLogic(const Point &touchPoint)
startRecordSlidAction(); startRecordSlidAction();
} }
void UIScrollView::handleMoveLogic(const CCPoint &touchPoint) void UIScrollView::handleMoveLogic(const Point &touchPoint)
{ {
CCPoint nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
float offset = 0.0f; float offset = 0.0f;
switch (m_eDirection) switch (m_eDirection)
@ -500,7 +500,7 @@ void UIScrollView::handleMoveLogic(const CCPoint &touchPoint)
void UIScrollView::handleReleaseLogic(const Point &touchPoint) void UIScrollView::handleReleaseLogic(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
switch (m_eDirection) switch (m_eDirection)
{ {
case SCROLLVIEW_DIR_VERTICAL: // vertical case SCROLLVIEW_DIR_VERTICAL: // vertical

View File

@ -48,9 +48,9 @@ m_capInsetsDisabled(Rect::ZERO),
m_eNormalTexType(UI_TEX_TYPE_LOCAL), m_eNormalTexType(UI_TEX_TYPE_LOCAL),
m_ePressedTexType(UI_TEX_TYPE_LOCAL), m_ePressedTexType(UI_TEX_TYPE_LOCAL),
m_eDisabledTexType(UI_TEX_TYPE_LOCAL), m_eDisabledTexType(UI_TEX_TYPE_LOCAL),
m_normalTextureSize(m_size), m_normalTextureSize(_size),
m_pressedTextureSize(m_size), m_pressedTextureSize(_size),
m_disabledTextureSize(m_size), m_disabledTextureSize(_size),
m_bPressedActionEnabled(false), m_bPressedActionEnabled(false),
m_titleColor(Color3B::WHITE) m_titleColor(Color3B::WHITE)
{ {
@ -89,10 +89,10 @@ void UIButton::initRenderer()
m_pButtonClickedRenderer = CCSprite::create(); m_pButtonClickedRenderer = CCSprite::create();
m_pButtonDisableRenderer = CCSprite::create(); m_pButtonDisableRenderer = CCSprite::create();
m_pTitleRenderer = CCLabelTTF::create(); m_pTitleRenderer = CCLabelTTF::create();
m_pRenderer->addChild(m_pButtonNormalRenderer,NORMALRENDERERZ); _renderer->addChild(m_pButtonNormalRenderer,NORMALRENDERERZ);
m_pRenderer->addChild(m_pButtonClickedRenderer,PRESSEDRENDERERZ); _renderer->addChild(m_pButtonClickedRenderer,PRESSEDRENDERERZ);
m_pRenderer->addChild(m_pButtonDisableRenderer,DISABLEDRENDERERZ); _renderer->addChild(m_pButtonDisableRenderer,DISABLEDRENDERERZ);
m_pRenderer->addChild(m_pTitleRenderer,TITLERENDERERZ); _renderer->addChild(m_pTitleRenderer,TITLERENDERERZ);
} }
void UIButton::setScale9Enabled(bool able) void UIButton::setScale9Enabled(bool able)
@ -101,13 +101,13 @@ void UIButton::setScale9Enabled(bool able)
{ {
return; return;
} }
m_eBrightStyle = BRIGHT_NONE; _brightStyle = BRIGHT_NONE;
m_bScale9Enabled = able; m_bScale9Enabled = able;
m_pRenderer->removeChild(m_pButtonNormalRenderer, true); _renderer->removeChild(m_pButtonNormalRenderer, true);
m_pRenderer->removeChild(m_pButtonClickedRenderer, true); _renderer->removeChild(m_pButtonClickedRenderer, true);
m_pRenderer->removeChild(m_pButtonDisableRenderer, true); _renderer->removeChild(m_pButtonDisableRenderer, true);
m_pButtonNormalRenderer = NULL; m_pButtonNormalRenderer = NULL;
m_pButtonClickedRenderer = NULL; m_pButtonClickedRenderer = NULL;
@ -128,12 +128,12 @@ void UIButton::setScale9Enabled(bool able)
loadTextureNormal(m_strNormalFileName.c_str(), m_eNormalTexType); loadTextureNormal(m_strNormalFileName.c_str(), m_eNormalTexType);
loadTexturePressed(m_strClickedFileName.c_str(), m_ePressedTexType); loadTexturePressed(m_strClickedFileName.c_str(), m_ePressedTexType);
loadTextureDisabled(m_strDisabledFileName.c_str(), m_eDisabledTexType); loadTextureDisabled(m_strDisabledFileName.c_str(), m_eDisabledTexType);
m_pRenderer->addChild(m_pButtonNormalRenderer,NORMALRENDERERZ); _renderer->addChild(m_pButtonNormalRenderer,NORMALRENDERERZ);
m_pRenderer->addChild(m_pButtonClickedRenderer,PRESSEDRENDERERZ); _renderer->addChild(m_pButtonClickedRenderer,PRESSEDRENDERERZ);
m_pRenderer->addChild(m_pButtonDisableRenderer,DISABLEDRENDERERZ); _renderer->addChild(m_pButtonDisableRenderer,DISABLEDRENDERERZ);
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
bool ignoreBefore = m_bIgnoreSize; bool ignoreBefore = _ignoreSize;
ignoreContentAdaptWithSize(false); ignoreContentAdaptWithSize(false);
m_bPrevIgnoreSize = ignoreBefore; m_bPrevIgnoreSize = ignoreBefore;
} }
@ -144,7 +144,7 @@ void UIButton::setScale9Enabled(bool able)
setCapInsetsNormalRenderer(m_capInsetsNormal); setCapInsetsNormalRenderer(m_capInsetsNormal);
setCapInsetsPressedRenderer(m_capInsetsPressed); setCapInsetsPressedRenderer(m_capInsetsPressed);
setCapInsetsDisabledRenderer(m_capInsetsDisabled); setCapInsetsDisabledRenderer(m_capInsetsDisabled);
setBright(m_bBright); setBright(_bright);
} }
void UIButton::ignoreContentAdaptWithSize(bool ignore) void UIButton::ignoreContentAdaptWithSize(bool ignore)
@ -428,7 +428,7 @@ void UIButton::setAnchorPoint(const Point &pt)
m_pButtonNormalRenderer->setAnchorPoint(pt); m_pButtonNormalRenderer->setAnchorPoint(pt);
m_pButtonClickedRenderer->setAnchorPoint(pt); m_pButtonClickedRenderer->setAnchorPoint(pt);
m_pButtonDisableRenderer->setAnchorPoint(pt); m_pButtonDisableRenderer->setAnchorPoint(pt);
m_pTitleRenderer->setPosition(Point(m_size.width*(0.5f-m_anchorPoint.x), m_size.height*(0.5f-m_anchorPoint.y))); m_pTitleRenderer->setPosition(Point(_size.width*(0.5f-_anchorPoint.x), _size.height*(0.5f-_anchorPoint.y)));
} }
void UIButton::setNormalSpriteFrame(SpriteFrame *frame) void UIButton::setNormalSpriteFrame(SpriteFrame *frame)
@ -493,9 +493,9 @@ const Size& UIButton::getContentSize() const
Node* UIButton::getVirtualRenderer() Node* UIButton::getVirtualRenderer()
{ {
if (m_bBright) if (_bright)
{ {
switch (m_eBrightStyle) switch (_brightStyle)
{ {
case BRIGHT_NORMAL: case BRIGHT_NORMAL:
return m_pButtonNormalRenderer; return m_pButtonNormalRenderer;
@ -513,19 +513,19 @@ Node* UIButton::getVirtualRenderer()
void UIButton::normalTextureScaleChangedWithSize() void UIButton::normalTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
m_pButtonNormalRenderer->setScale(1.0f); m_pButtonNormalRenderer->setScale(1.0f);
m_size = m_normalTextureSize; _size = m_normalTextureSize;
} }
} }
else else
{ {
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pButtonNormalRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pButtonNormalRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -535,8 +535,8 @@ void UIButton::normalTextureScaleChangedWithSize()
m_pButtonNormalRenderer->setScale(1.0f); m_pButtonNormalRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pButtonNormalRenderer->setScaleX(scaleX); m_pButtonNormalRenderer->setScaleX(scaleX);
m_pButtonNormalRenderer->setScaleY(scaleY); m_pButtonNormalRenderer->setScaleY(scaleY);
} }
@ -545,7 +545,7 @@ void UIButton::normalTextureScaleChangedWithSize()
void UIButton::pressedTextureScaleChangedWithSize() void UIButton::pressedTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
@ -556,7 +556,7 @@ void UIButton::pressedTextureScaleChangedWithSize()
{ {
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pButtonClickedRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pButtonClickedRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -566,8 +566,8 @@ void UIButton::pressedTextureScaleChangedWithSize()
m_pButtonClickedRenderer->setScale(1.0f); m_pButtonClickedRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / m_pressedTextureSize.width; float scaleX = _size.width / m_pressedTextureSize.width;
float scaleY = m_size.height / m_pressedTextureSize.height; float scaleY = _size.height / m_pressedTextureSize.height;
m_pButtonClickedRenderer->setScaleX(scaleX); m_pButtonClickedRenderer->setScaleX(scaleX);
m_pButtonClickedRenderer->setScaleY(scaleY); m_pButtonClickedRenderer->setScaleY(scaleY);
} }
@ -576,7 +576,7 @@ void UIButton::pressedTextureScaleChangedWithSize()
void UIButton::disabledTextureScaleChangedWithSize() void UIButton::disabledTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
@ -587,7 +587,7 @@ void UIButton::disabledTextureScaleChangedWithSize()
{ {
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pButtonDisableRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pButtonDisableRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -597,8 +597,8 @@ void UIButton::disabledTextureScaleChangedWithSize()
m_pButtonDisableRenderer->setScale(1.0f); m_pButtonDisableRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / m_disabledTextureSize.width; float scaleX = _size.width / m_disabledTextureSize.width;
float scaleY = m_size.height / m_disabledTextureSize.height; float scaleY = _size.height / m_disabledTextureSize.height;
m_pButtonDisableRenderer->setScaleX(scaleX); m_pButtonDisableRenderer->setScaleX(scaleX);
m_pButtonDisableRenderer->setScaleY(scaleY); m_pButtonDisableRenderer->setScaleY(scaleY);
} }

View File

@ -78,11 +78,11 @@ void UICheckBox::initRenderer()
m_pFrontCrossRenderer = CCSprite::create(); m_pFrontCrossRenderer = CCSprite::create();
m_pBackGroundBoxDisabledRenderer = CCSprite::create(); m_pBackGroundBoxDisabledRenderer = CCSprite::create();
m_pFrontCrossDisabledRenderer = CCSprite::create(); m_pFrontCrossDisabledRenderer = CCSprite::create();
m_pRenderer->addChild(m_pBackGroundBoxRenderer); _renderer->addChild(m_pBackGroundBoxRenderer);
m_pRenderer->addChild(m_pBackGroundSelectedBoxRenderer); _renderer->addChild(m_pBackGroundSelectedBoxRenderer);
m_pRenderer->addChild(m_pFrontCrossRenderer); _renderer->addChild(m_pFrontCrossRenderer);
m_pRenderer->addChild(m_pBackGroundBoxDisabledRenderer); _renderer->addChild(m_pBackGroundBoxDisabledRenderer);
m_pRenderer->addChild(m_pFrontCrossDisabledRenderer); _renderer->addChild(m_pFrontCrossDisabledRenderer);
} }
void UICheckBox::loadTextures(const char *backGround, const char *backGroundSelected, const char *cross,const char* backGroundDisabled,const char* frontCrossDisabled,TextureResType texType) void UICheckBox::loadTextures(const char *backGround, const char *backGroundSelected, const char *cross,const char* backGroundDisabled,const char* frontCrossDisabled,TextureResType texType)
@ -211,7 +211,7 @@ void UICheckBox::loadTextureFrontCrossDisabled(const char *frontCrossDisabled,Te
void UICheckBox::onTouchEnded(const Point &touchPoint) void UICheckBox::onTouchEnded(const Point &touchPoint)
{ {
if (m_bFocus) if (_focus)
{ {
releaseUpEvent(); releaseUpEvent();
if (m_bIsSelected){ if (m_bIsSelected){
@ -225,7 +225,7 @@ void UICheckBox::onTouchEnded(const Point &touchPoint)
} }
} }
setFocused(false); setFocused(false);
m_pWidgetParent->checkChildInfo(2,this,touchPoint); _widgetParent->checkChildInfo(2,this,touchPoint);
} }
void UICheckBox::onPressStateChangedToNormal() void UICheckBox::onPressStateChangedToNormal()
@ -352,10 +352,10 @@ Node* UICheckBox::getVirtualRenderer()
void UICheckBox::backGroundTextureScaleChangedWithSize() void UICheckBox::backGroundTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pBackGroundBoxRenderer->setScale(1.0f); m_pBackGroundBoxRenderer->setScale(1.0f);
m_size = m_pBackGroundBoxRenderer->getContentSize(); _size = m_pBackGroundBoxRenderer->getContentSize();
} }
else else
{ {
@ -365,8 +365,8 @@ void UICheckBox::backGroundTextureScaleChangedWithSize()
m_pBackGroundBoxRenderer->setScale(1.0f); m_pBackGroundBoxRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pBackGroundBoxRenderer->setScaleX(scaleX); m_pBackGroundBoxRenderer->setScaleX(scaleX);
m_pBackGroundBoxRenderer->setScaleY(scaleY); m_pBackGroundBoxRenderer->setScaleY(scaleY);
} }
@ -374,7 +374,7 @@ void UICheckBox::backGroundTextureScaleChangedWithSize()
void UICheckBox::backGroundSelectedTextureScaleChangedWithSize() void UICheckBox::backGroundSelectedTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pBackGroundSelectedBoxRenderer->setScale(1.0f); m_pBackGroundSelectedBoxRenderer->setScale(1.0f);
} }
@ -386,8 +386,8 @@ void UICheckBox::backGroundSelectedTextureScaleChangedWithSize()
m_pBackGroundSelectedBoxRenderer->setScale(1.0f); m_pBackGroundSelectedBoxRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pBackGroundSelectedBoxRenderer->setScaleX(scaleX); m_pBackGroundSelectedBoxRenderer->setScaleX(scaleX);
m_pBackGroundSelectedBoxRenderer->setScaleY(scaleY); m_pBackGroundSelectedBoxRenderer->setScaleY(scaleY);
} }
@ -395,7 +395,7 @@ void UICheckBox::backGroundSelectedTextureScaleChangedWithSize()
void UICheckBox::frontCrossTextureScaleChangedWithSize() void UICheckBox::frontCrossTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pFrontCrossRenderer->setScale(1.0f); m_pFrontCrossRenderer->setScale(1.0f);
} }
@ -407,8 +407,8 @@ void UICheckBox::frontCrossTextureScaleChangedWithSize()
m_pFrontCrossRenderer->setScale(1.0f); m_pFrontCrossRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pFrontCrossRenderer->setScaleX(scaleX); m_pFrontCrossRenderer->setScaleX(scaleX);
m_pFrontCrossRenderer->setScaleY(scaleY); m_pFrontCrossRenderer->setScaleY(scaleY);
} }
@ -416,7 +416,7 @@ void UICheckBox::frontCrossTextureScaleChangedWithSize()
void UICheckBox::backGroundDisabledTextureScaleChangedWithSize() void UICheckBox::backGroundDisabledTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pBackGroundBoxDisabledRenderer->setScale(1.0f); m_pBackGroundBoxDisabledRenderer->setScale(1.0f);
} }
@ -428,8 +428,8 @@ void UICheckBox::backGroundDisabledTextureScaleChangedWithSize()
m_pBackGroundBoxDisabledRenderer->setScale(1.0f); m_pBackGroundBoxDisabledRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pBackGroundBoxDisabledRenderer->setScaleX(scaleX); m_pBackGroundBoxDisabledRenderer->setScaleX(scaleX);
m_pBackGroundBoxDisabledRenderer->setScaleY(scaleY); m_pBackGroundBoxDisabledRenderer->setScaleY(scaleY);
} }
@ -437,7 +437,7 @@ void UICheckBox::backGroundDisabledTextureScaleChangedWithSize()
void UICheckBox::frontCrossDisabledTextureScaleChangedWithSize() void UICheckBox::frontCrossDisabledTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pFrontCrossDisabledRenderer->setScale(1.0f); m_pFrontCrossDisabledRenderer->setScale(1.0f);
} }
@ -449,8 +449,8 @@ void UICheckBox::frontCrossDisabledTextureScaleChangedWithSize()
m_pFrontCrossDisabledRenderer->setScale(1.0f); m_pFrontCrossDisabledRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pFrontCrossDisabledRenderer->setScaleX(scaleX); m_pFrontCrossDisabledRenderer->setScaleX(scaleX);
m_pFrontCrossDisabledRenderer->setScaleY(scaleY); m_pFrontCrossDisabledRenderer->setScaleY(scaleY);
} }

View File

@ -43,7 +43,7 @@ m_capInsets(Rect::ZERO),
m_pImageRenderer(NULL), m_pImageRenderer(NULL),
m_strTextureFile(""), m_strTextureFile(""),
m_eImageTexType(UI_TEX_TYPE_LOCAL), m_eImageTexType(UI_TEX_TYPE_LOCAL),
m_imageTextureSize(m_size) m_imageTextureSize(_size)
{ {
} }
@ -69,7 +69,7 @@ void UIImageView::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pImageRenderer = CCSprite::create(); m_pImageRenderer = CCSprite::create();
m_pRenderer->addChild(m_pImageRenderer); _renderer->addChild(m_pImageRenderer);
} }
void UIImageView::loadTexture(const char *fileName, TextureResType texType) void UIImageView::loadTexture(const char *fileName, TextureResType texType)
@ -132,9 +132,9 @@ void UIImageView::setTextureRect(const Rect &rect)
bool UIImageView::onTouchBegan(const Point &touchPoint) bool UIImageView::onTouchBegan(const Point &touchPoint)
{ {
setFocused(true); setFocused(true);
m_touchStartPos.x = touchPoint.x; _touchStartPos.x = touchPoint.x;
m_touchStartPos.y = touchPoint.y; _touchStartPos.y = touchPoint.y;
m_pWidgetParent->checkChildInfo(0,this,touchPoint); _widgetParent->checkChildInfo(0,this,touchPoint);
pushDownEvent(); pushDownEvent();
if (m_bDoubleClickEnabled) if (m_bDoubleClickEnabled)
@ -144,7 +144,7 @@ bool UIImageView::onTouchBegan(const Point &touchPoint)
m_nClickCount++; m_nClickCount++;
m_touchRelease = false; m_touchRelease = false;
} }
return m_bTouchPassedEnabled; return _touchPassedEnabled;
} }
void UIImageView::onTouchEnded(const Point &touchPoint) void UIImageView::onTouchEnded(const Point &touchPoint)
@ -272,7 +272,7 @@ void UIImageView::setScale9Enabled(bool able)
m_bScale9Enabled = able; m_bScale9Enabled = able;
m_pRenderer->removeChild(m_pImageRenderer, true); _renderer->removeChild(m_pImageRenderer, true);
m_pImageRenderer = NULL; m_pImageRenderer = NULL;
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
@ -283,10 +283,10 @@ void UIImageView::setScale9Enabled(bool able)
m_pImageRenderer = CCSprite::create(); m_pImageRenderer = CCSprite::create();
} }
loadTexture(m_strTextureFile.c_str(),m_eImageTexType); loadTexture(m_strTextureFile.c_str(),m_eImageTexType);
m_pRenderer->addChild(m_pImageRenderer); _renderer->addChild(m_pImageRenderer);
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
bool ignoreBefore = m_bIgnoreSize; bool ignoreBefore = _ignoreSize;
ignoreContentAdaptWithSize(false); ignoreContentAdaptWithSize(false);
m_bPrevIgnoreSize = ignoreBefore; m_bPrevIgnoreSize = ignoreBefore;
} }
@ -339,19 +339,19 @@ Node* UIImageView::getVirtualRenderer()
void UIImageView::imageTextureScaleChangedWithSize() void UIImageView::imageTextureScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
m_pImageRenderer->setScale(1.0f); m_pImageRenderer->setScale(1.0f);
m_size = m_imageTextureSize; _size = m_imageTextureSize;
} }
} }
else else
{ {
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pImageRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pImageRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -361,8 +361,8 @@ void UIImageView::imageTextureScaleChangedWithSize()
m_pImageRenderer->setScale(1.0f); m_pImageRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pImageRenderer->setScaleX(scaleX); m_pImageRenderer->setScaleX(scaleX);
m_pImageRenderer->setScaleY(scaleY); m_pImageRenderer->setScaleY(scaleY);
} }

View File

@ -66,7 +66,7 @@ void UILabel::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pLabelRenderer = CCLabelTTF::create(); m_pLabelRenderer = CCLabelTTF::create();
m_pRenderer->addChild(m_pLabelRenderer); _renderer->addChild(m_pLabelRenderer);
} }
void UILabel::setText(const char* text) void UILabel::setText(const char* text)
@ -157,7 +157,7 @@ void UILabel::onPressStateChangedToDisabled()
void UILabel::clickScale(float scale) void UILabel::clickScale(float scale)
{ {
m_pRenderer->setScale(scale); _renderer->setScale(scale);
} }
void UILabel::setFlipX(bool flipX) void UILabel::setFlipX(bool flipX)
@ -203,10 +203,10 @@ Node* UILabel::getVirtualRenderer()
void UILabel::labelScaleChangedWithSize() void UILabel::labelScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pLabelRenderer->setScale(1.0f); m_pLabelRenderer->setScale(1.0f);
m_size = m_pLabelRenderer->getContentSize(); _size = m_pLabelRenderer->getContentSize();
} }
else else
{ {
@ -216,8 +216,8 @@ void UILabel::labelScaleChangedWithSize()
m_pLabelRenderer->setScale(1.0f); m_pLabelRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pLabelRenderer->setScaleX(scaleX); m_pLabelRenderer->setScaleX(scaleX);
m_pLabelRenderer->setScaleY(scaleY); m_pLabelRenderer->setScaleY(scaleY);
} }

View File

@ -103,7 +103,7 @@ void UILabelAtlas::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pLaberAtlasRenderer = UICCLabelAtlas::create(); m_pLaberAtlasRenderer = UICCLabelAtlas::create();
m_pRenderer->addChild(m_pLaberAtlasRenderer); _renderer->addChild(m_pLaberAtlasRenderer);
} }
void UILabelAtlas::setProperty(const char *stringValue, const char *charMapFile, int itemWidth, int itemHeight, const char *startCharMap,bool useSpriteFrame) void UILabelAtlas::setProperty(const char *stringValue, const char *charMapFile, int itemWidth, int itemHeight, const char *startCharMap,bool useSpriteFrame)
@ -147,10 +147,10 @@ Node* UILabelAtlas::getVirtualRenderer()
void UILabelAtlas::labelAtlasScaleChangedWithSize() void UILabelAtlas::labelAtlasScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pLaberAtlasRenderer->setScale(1.0f); m_pLaberAtlasRenderer->setScale(1.0f);
m_size = m_pLaberAtlasRenderer->getContentSize(); _size = m_pLaberAtlasRenderer->getContentSize();
} }
else else
{ {
@ -160,8 +160,8 @@ void UILabelAtlas::labelAtlasScaleChangedWithSize()
m_pLaberAtlasRenderer->setScale(1.0f); m_pLaberAtlasRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pLaberAtlasRenderer->setScaleX(scaleX); m_pLaberAtlasRenderer->setScaleX(scaleX);
m_pLaberAtlasRenderer->setScaleY(scaleY); m_pLaberAtlasRenderer->setScaleY(scaleY);
} }

View File

@ -53,7 +53,7 @@ void UILabelBMFont::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pLabelBMFontRenderer = CCLabelBMFont::create(); m_pLabelBMFontRenderer = CCLabelBMFont::create();
m_pRenderer->addChild(m_pLabelBMFontRenderer); _renderer->addChild(m_pLabelBMFontRenderer);
} }
void UILabelBMFont::setFntFile(const char *fileName) void UILabelBMFont::setFntFile(const char *fileName)
@ -106,10 +106,10 @@ Node* UILabelBMFont::getVirtualRenderer()
void UILabelBMFont::labelBMFontScaleChangedWithSize() void UILabelBMFont::labelBMFontScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pLabelBMFontRenderer->setScale(1.0f); m_pLabelBMFontRenderer->setScale(1.0f);
m_size = m_pLabelBMFontRenderer->getContentSize(); _size = m_pLabelBMFontRenderer->getContentSize();
} }
else else
{ {
@ -119,8 +119,8 @@ void UILabelBMFont::labelBMFontScaleChangedWithSize()
m_pLabelBMFontRenderer->setScale(1.0f); m_pLabelBMFontRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pLabelBMFontRenderer->setScaleX(scaleX); m_pLabelBMFontRenderer->setScaleX(scaleX);
m_pLabelBMFontRenderer->setScaleY(scaleY); m_pLabelBMFontRenderer->setScaleY(scaleY);
} }

View File

@ -64,7 +64,7 @@ void UILoadingBar::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pBarRenderer = CCSprite::create(); m_pBarRenderer = CCSprite::create();
m_pRenderer->addChild(m_pBarRenderer); _renderer->addChild(m_pBarRenderer);
m_pBarRenderer->setAnchorPoint(Point(0.0f,0.5f)); m_pBarRenderer->setAnchorPoint(Point(0.0f,0.5f));
} }
@ -175,7 +175,7 @@ void UILoadingBar::setScale9Enabled(bool enabled)
return; return;
} }
m_bScale9Enabled = enabled; m_bScale9Enabled = enabled;
m_pRenderer->removeChild(m_pBarRenderer, true); _renderer->removeChild(m_pBarRenderer, true);
m_pBarRenderer = NULL; m_pBarRenderer = NULL;
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
@ -186,10 +186,10 @@ void UILoadingBar::setScale9Enabled(bool enabled)
m_pBarRenderer = CCSprite::create(); m_pBarRenderer = CCSprite::create();
} }
loadTexture(m_strTextureFile.c_str(),m_eRenderBarTexType); loadTexture(m_strTextureFile.c_str(),m_eRenderBarTexType);
m_pRenderer->addChild(m_pBarRenderer); _renderer->addChild(m_pBarRenderer);
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
bool ignoreBefore = m_bIgnoreSize; bool ignoreBefore = _ignoreSize;
ignoreContentAdaptWithSize(false); ignoreContentAdaptWithSize(false);
m_bPrevIgnoreSize = ignoreBefore; m_bPrevIgnoreSize = ignoreBefore;
} }
@ -281,18 +281,18 @@ Node* UILoadingBar::getVirtualRenderer()
void UILoadingBar::barRendererScaleChangedWithSize() void UILoadingBar::barRendererScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
m_fTotalLength = m_barRendererTextureSize.width; m_fTotalLength = m_barRendererTextureSize.width;
m_pBarRenderer->setScale(1.0f); m_pBarRenderer->setScale(1.0f);
m_size = m_barRendererTextureSize; _size = m_barRendererTextureSize;
} }
} }
else else
{ {
m_fTotalLength = m_size.width; m_fTotalLength = _size.width;
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
setScale9Scale(); setScale9Scale();
@ -306,8 +306,8 @@ void UILoadingBar::barRendererScaleChangedWithSize()
m_pBarRenderer->setScale(1.0f); m_pBarRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pBarRenderer->setScaleX(scaleX); m_pBarRenderer->setScaleX(scaleX);
m_pBarRenderer->setScaleY(scaleY); m_pBarRenderer->setScaleY(scaleY);
} }

View File

@ -81,8 +81,8 @@ void UISlider::initRenderer()
m_pBarRenderer = CCSprite::create(); m_pBarRenderer = CCSprite::create();
m_pProgressBarRenderer = CCSprite::create(); m_pProgressBarRenderer = CCSprite::create();
m_pProgressBarRenderer->setAnchorPoint(Point(0.0f, 0.5f)); m_pProgressBarRenderer->setAnchorPoint(Point(0.0f, 0.5f));
m_pRenderer->addChild(m_pBarRenderer, -1); _renderer->addChild(m_pBarRenderer, -1);
m_pRenderer->addChild(m_pProgressBarRenderer, -1); _renderer->addChild(m_pProgressBarRenderer, -1);
m_pSlidBallNormalRenderer = CCSprite::create(); m_pSlidBallNormalRenderer = CCSprite::create();
m_pSlidBallPressedRenderer = CCSprite::create(); m_pSlidBallPressedRenderer = CCSprite::create();
m_pSlidBallPressedRenderer->setVisible(false); m_pSlidBallPressedRenderer->setVisible(false);
@ -92,7 +92,7 @@ void UISlider::initRenderer()
m_pSlidBallRenderer->addChild(m_pSlidBallNormalRenderer); m_pSlidBallRenderer->addChild(m_pSlidBallNormalRenderer);
m_pSlidBallRenderer->addChild(m_pSlidBallPressedRenderer); m_pSlidBallRenderer->addChild(m_pSlidBallPressedRenderer);
m_pSlidBallRenderer->addChild(m_pSlidBallDisabledRenderer); m_pSlidBallRenderer->addChild(m_pSlidBallDisabledRenderer);
m_pRenderer->addChild(m_pSlidBallRenderer); _renderer->addChild(m_pSlidBallRenderer);
} }
void UISlider::loadBarTexture(const char* fileName, TextureResType texType) void UISlider::loadBarTexture(const char* fileName, TextureResType texType)
@ -197,8 +197,8 @@ void UISlider::setScale9Enabled(bool able)
} }
m_bScale9Enabled = able; m_bScale9Enabled = able;
m_pRenderer->removeChild(m_pBarRenderer, true); _renderer->removeChild(m_pBarRenderer, true);
m_pRenderer->removeChild(m_pProgressBarRenderer, true); _renderer->removeChild(m_pProgressBarRenderer, true);
m_pBarRenderer = NULL; m_pBarRenderer = NULL;
m_pProgressBarRenderer = NULL; m_pProgressBarRenderer = NULL;
if (m_bScale9Enabled) if (m_bScale9Enabled)
@ -213,11 +213,11 @@ void UISlider::setScale9Enabled(bool able)
} }
loadBarTexture(m_strTextureFile.c_str(), m_eBarTexType); loadBarTexture(m_strTextureFile.c_str(), m_eBarTexType);
loadProgressBarTexture(m_strProgressBarTextureFile.c_str(), m_eProgressBarTexType); loadProgressBarTexture(m_strProgressBarTextureFile.c_str(), m_eProgressBarTexType);
m_pRenderer->addChild(m_pBarRenderer, -1); _renderer->addChild(m_pBarRenderer, -1);
m_pRenderer->addChild(m_pProgressBarRenderer, -1); _renderer->addChild(m_pProgressBarRenderer, -1);
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
bool ignoreBefore = m_bIgnoreSize; bool ignoreBefore = _ignoreSize;
ignoreContentAdaptWithSize(false); ignoreContentAdaptWithSize(false);
m_bPrevIgnoreSize = ignoreBefore; m_bPrevIgnoreSize = ignoreBefore;
} }
@ -383,7 +383,7 @@ void UISlider::setPercent(int percent)
bool UISlider::onTouchBegan(const Point &touchPoint) bool UISlider::onTouchBegan(const Point &touchPoint)
{ {
bool pass = UIWidget::onTouchBegan(touchPoint); bool pass = UIWidget::onTouchBegan(touchPoint);
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
setPercent(getPercentWithBallPos(nsp.x)); setPercent(getPercentWithBallPos(nsp.x));
percentChangedEvent(); percentChangedEvent();
return pass; return pass;
@ -391,7 +391,7 @@ bool UISlider::onTouchBegan(const Point &touchPoint)
void UISlider::onTouchMoved(const Point &touchPoint) void UISlider::onTouchMoved(const Point &touchPoint)
{ {
Point nsp = m_pRenderer->convertToNodeSpace(touchPoint); Point nsp = _renderer->convertToNodeSpace(touchPoint);
m_pSlidBallRenderer->setPosition(Point(nsp.x,0)); m_pSlidBallRenderer->setPosition(Point(nsp.x,0));
setPercent(getPercentWithBallPos(nsp.x)); setPercent(getPercentWithBallPos(nsp.x));
percentChangedEvent(); percentChangedEvent();
@ -449,19 +449,19 @@ Node* UISlider::getVirtualRenderer()
void UISlider::barRendererScaleChangedWithSize() void UISlider::barRendererScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pBarRenderer->setScale(1.0f); m_pBarRenderer->setScale(1.0f);
m_size = m_pBarRenderer->getContentSize(); _size = m_pBarRenderer->getContentSize();
m_fBarLength = m_size.width; m_fBarLength = _size.width;
} }
else else
{ {
m_fBarLength = m_size.width; m_fBarLength = _size.width;
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pBarRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pBarRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -471,8 +471,8 @@ void UISlider::barRendererScaleChangedWithSize()
m_pBarRenderer->setScale(1.0f); m_pBarRenderer->setScale(1.0f);
return; return;
} }
float bscaleX = m_size.width / btextureSize.width; float bscaleX = _size.width / btextureSize.width;
float bscaleY = m_size.height / btextureSize.height; float bscaleY = _size.height / btextureSize.height;
m_pBarRenderer->setScaleX(bscaleX); m_pBarRenderer->setScaleX(bscaleX);
m_pBarRenderer->setScaleY(bscaleY); m_pBarRenderer->setScaleY(bscaleY);
} }
@ -482,13 +482,13 @@ void UISlider::barRendererScaleChangedWithSize()
void UISlider::progressBarRendererScaleChangedWithSize() void UISlider::progressBarRendererScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
if (!m_bScale9Enabled) if (!m_bScale9Enabled)
{ {
Size ptextureSize = m_ProgressBarTextureSize; Size ptextureSize = m_ProgressBarTextureSize;
float pscaleX = m_size.width / ptextureSize.width; float pscaleX = _size.width / ptextureSize.width;
float pscaleY = m_size.height / ptextureSize.height; float pscaleY = _size.height / ptextureSize.height;
m_pProgressBarRenderer->setScaleX(pscaleX); m_pProgressBarRenderer->setScaleX(pscaleX);
m_pProgressBarRenderer->setScaleY(pscaleY); m_pProgressBarRenderer->setScaleY(pscaleY);
} }
@ -497,7 +497,7 @@ void UISlider::progressBarRendererScaleChangedWithSize()
{ {
if (m_bScale9Enabled) if (m_bScale9Enabled)
{ {
dynamic_cast<Scale9Sprite*>(m_pProgressBarRenderer)->setPreferredSize(m_size); dynamic_cast<Scale9Sprite*>(m_pProgressBarRenderer)->setPreferredSize(_size);
} }
else else
{ {
@ -507,8 +507,8 @@ void UISlider::progressBarRendererScaleChangedWithSize()
m_pProgressBarRenderer->setScale(1.0f); m_pProgressBarRenderer->setScale(1.0f);
return; return;
} }
float pscaleX = m_size.width / ptextureSize.width; float pscaleX = _size.width / ptextureSize.width;
float pscaleY = m_size.height / ptextureSize.height; float pscaleY = _size.height / ptextureSize.height;
m_pProgressBarRenderer->setScaleX(pscaleX); m_pProgressBarRenderer->setScaleX(pscaleX);
m_pProgressBarRenderer->setScaleY(pscaleY); m_pProgressBarRenderer->setScaleY(pscaleY);
} }

View File

@ -66,13 +66,13 @@ void UICCTextField::onEnter()
} }
bool UICCTextField::onTextFieldAttachWithIME(CCTextFieldTTF *pSender) bool UICCTextField::onTextFieldAttachWithIME(TextFieldTTF *pSender)
{ {
setAttachWithIME(true); setAttachWithIME(true);
return false; return false;
} }
bool UICCTextField::onTextFieldInsertText(CCTextFieldTTF *pSender, const char *text, int nLen) bool UICCTextField::onTextFieldInsertText(TextFieldTTF *pSender, const char *text, int nLen)
{ {
if (nLen == 1 && strcmp(text, "\n") == 0) if (nLen == 1 && strcmp(text, "\n") == 0)
{ {
@ -90,13 +90,13 @@ bool UICCTextField::onTextFieldInsertText(CCTextFieldTTF *pSender, const char *t
return false; return false;
} }
bool UICCTextField::onTextFieldDeleteBackward(CCTextFieldTTF *pSender, const char *delText, int nLen) bool UICCTextField::onTextFieldDeleteBackward(TextFieldTTF *pSender, const char *delText, int nLen)
{ {
setDeleteBackward(true); setDeleteBackward(true);
return false; return false;
} }
bool UICCTextField::onTextFieldDetachWithIME(CCTextFieldTTF *pSender) bool UICCTextField::onTextFieldDetachWithIME(TextFieldTTF *pSender)
{ {
setDetachWithIME(true); setDetachWithIME(true);
return false; return false;
@ -316,10 +316,10 @@ void UITextField::initRenderer()
{ {
UIWidget::initRenderer(); UIWidget::initRenderer();
m_pTextFieldRenderer = UICCTextField::create("input words here", "Thonburi", 20); m_pTextFieldRenderer = UICCTextField::create("input words here", "Thonburi", 20);
m_pRenderer->addChild(m_pTextFieldRenderer); _renderer->addChild(m_pTextFieldRenderer);
} }
void UITextField::setTouchSize(const CCSize &size) void UITextField::setTouchSize(const Size &size)
{ {
m_bUseTouchArea = true; m_bUseTouchArea = true;
m_fTouchWidth = size.width; m_fTouchWidth = size.width;
@ -365,7 +365,7 @@ const char* UITextField::getStringValue()
return m_pTextFieldRenderer->getString(); return m_pTextFieldRenderer->getString();
} }
bool UITextField::onTouchBegan(const CCPoint &touchPoint) bool UITextField::onTouchBegan(const Point &touchPoint)
{ {
bool pass = UIWidget::onTouchBegan(touchPoint); bool pass = UIWidget::onTouchBegan(touchPoint);
m_pTextFieldRenderer->attachWithIME(); m_pTextFieldRenderer->attachWithIME();
@ -505,37 +505,37 @@ void UITextField::deleteBackwardEvent()
} }
} }
void UITextField::addAttachWithIMEEvent(CCObject *target, SEL_TextFieldAttachWithIMEEvent selecor) void UITextField::addAttachWithIMEEvent(Object *target, SEL_TextFieldAttachWithIMEEvent selecor)
{ {
m_pAttachWithIMEListener = target; m_pAttachWithIMEListener = target;
m_pfnAttachWithIMESelector = selecor; m_pfnAttachWithIMESelector = selecor;
} }
void UITextField::addDetachWithIMEEvent(CCObject *target, SEL_TextFieldDetachWithIMEEvent selecor) void UITextField::addDetachWithIMEEvent(Object *target, SEL_TextFieldDetachWithIMEEvent selecor)
{ {
m_pDetachWithIMEListener = target; m_pDetachWithIMEListener = target;
m_pfnDetachWithIMESelector = selecor; m_pfnDetachWithIMESelector = selecor;
} }
void UITextField::addInsertTextEvent(CCObject *target, SEL_TextFieldInsertTextEvent selecor) void UITextField::addInsertTextEvent(Object *target, SEL_TextFieldInsertTextEvent selecor)
{ {
m_pInsertTextListener = target; m_pInsertTextListener = target;
m_pfnInsertTextSelector = selecor; m_pfnInsertTextSelector = selecor;
} }
void UITextField::addDeleteBackwardEvent(CCObject *target, SEL_TextFieldDeleteBackwardEvent selecor) void UITextField::addDeleteBackwardEvent(Object *target, SEL_TextFieldDeleteBackwardEvent selecor)
{ {
m_pDeleteBackwardListener = target; m_pDeleteBackwardListener = target;
m_pfnDeleteBackwardSelector = selecor; m_pfnDeleteBackwardSelector = selecor;
} }
void UITextField::setAnchorPoint(const CCPoint &pt) void UITextField::setAnchorPoint(const Point &pt)
{ {
UIWidget::setAnchorPoint(pt); UIWidget::setAnchorPoint(pt);
m_pTextFieldRenderer->setAnchorPoint(pt); m_pTextFieldRenderer->setAnchorPoint(pt);
} }
void UITextField::setColor(const ccColor3B &color) void UITextField::setColor(const Color3B &color)
{ {
UIWidget::setColor(color); UIWidget::setColor(color);
m_pTextFieldRenderer->setColor(color); m_pTextFieldRenderer->setColor(color);
@ -554,32 +554,32 @@ void UITextField::onSizeChanged()
void UITextField::textfieldRendererScaleChangedWithSize() void UITextField::textfieldRendererScaleChangedWithSize()
{ {
if (m_bIgnoreSize) if (_ignoreSize)
{ {
m_pTextFieldRenderer->setScale(1.0f); m_pTextFieldRenderer->setScale(1.0f);
m_size = getContentSize(); _size = getContentSize();
} }
else else
{ {
CCSize textureSize = getContentSize(); Size textureSize = getContentSize();
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f) if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
{ {
m_pTextFieldRenderer->setScale(1.0f); m_pTextFieldRenderer->setScale(1.0f);
return; return;
} }
float scaleX = m_size.width / textureSize.width; float scaleX = _size.width / textureSize.width;
float scaleY = m_size.height / textureSize.height; float scaleY = _size.height / textureSize.height;
m_pTextFieldRenderer->setScaleX(scaleX); m_pTextFieldRenderer->setScaleX(scaleX);
m_pTextFieldRenderer->setScaleY(scaleY); m_pTextFieldRenderer->setScaleY(scaleY);
} }
} }
const CCSize& UITextField::getContentSize() const const Size& UITextField::getContentSize() const
{ {
return m_pTextFieldRenderer->getContentSize(); return m_pTextFieldRenderer->getContentSize();
} }
CCNode* UITextField::getVirtualRenderer() Node* UITextField::getVirtualRenderer()
{ {
return m_pTextFieldRenderer; return m_pTextFieldRenderer;
} }

View File

@ -202,10 +202,10 @@ UIWidget* CCSGUIReader::widgetFromJsonFile(const char *fileName)
const char *des = NULL; const char *des = NULL;
std::string jsonpath; std::string jsonpath;
cs::JsonDictionary *jsonDict = NULL; cs::JsonDictionary *jsonDict = NULL;
jsonpath = CCFileUtils::sharedFileUtils()->fullPathForFilename(fileName); jsonpath = FileUtils::getInstance()->fullPathForFilename(fileName);
unsigned long size = 0; unsigned long size = 0;
des = (char*)(CCFileUtils::sharedFileUtils()->getFileData(jsonpath.c_str(),"r" , &size)); des = (char*)(FileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size));
if(NULL == des || strcmp(des, "") == 0) if(NULL == des || strcmp(des, "") == 0)
{ {
printf("read json file[%s] error!\n", fileName); printf("read json file[%s] error!\n", fileName);
@ -235,7 +235,7 @@ UIWidget* CCSGUIReader::widgetFromJsonFile(const char *fileName)
float fileDesignHeight = DICTOOL->getFloatValue_json(jsonDict, "designHeight"); float fileDesignHeight = DICTOOL->getFloatValue_json(jsonDict, "designHeight");
if (fileDesignWidth <= 0 || fileDesignHeight <= 0) { if (fileDesignWidth <= 0 || fileDesignHeight <= 0) {
printf("Read design size error!\n"); printf("Read design size error!\n");
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); Size winSize = Director::getInstance()->getWinSize();
CCUIHELPER->setFileDesignWidth(winSize.width); CCUIHELPER->setFileDesignWidth(winSize.width);
CCUIHELPER->setFileDesignHeight(winSize.height); CCUIHELPER->setFileDesignHeight(winSize.height);
} }
@ -248,10 +248,10 @@ UIWidget* CCSGUIReader::widgetFromJsonFile(const char *fileName)
UIWidget* widget = widgetFromJsonDictionary(widgetTree); UIWidget* widget = widgetFromJsonDictionary(widgetTree);
/* *********temp********* */ /* *********temp********* */
if (widget->getContentSize().equals(CCSizeZero)) if (widget->getContentSize().equals(Size::ZERO))
{ {
Layout* rootWidget = dynamic_cast<Layout*>(widget); Layout* rootWidget = dynamic_cast<Layout*>(widget);
rootWidget->setSize(CCSizeMake(fileDesignWidth, fileDesignHeight)); rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight));
} }
/* ********************** */ /* ********************** */
@ -280,7 +280,7 @@ void CCSGUIReader::setPropsForWidgetFromJsonDictionary(UIWidget*widget,cs::JsonD
float w = DICTOOL->getFloatValue_json(options, "width"); float w = DICTOOL->getFloatValue_json(options, "width");
float h = DICTOOL->getFloatValue_json(options, "height"); float h = DICTOOL->getFloatValue_json(options, "height");
widget->setSize(CCSizeMake(w, h)); widget->setSize(Size(w, h));
widget->setTag(DICTOOL->getIntValue_json(options, "tag")); widget->setTag(DICTOOL->getIntValue_json(options, "tag"));
widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag")); widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag"));
@ -290,7 +290,7 @@ void CCSGUIReader::setPropsForWidgetFromJsonDictionary(UIWidget*widget,cs::JsonD
widget->setName(widgetName); widget->setName(widgetName);
float x = DICTOOL->getFloatValue_json(options, "x"); float x = DICTOOL->getFloatValue_json(options, "x");
float y = DICTOOL->getFloatValue_json(options, "y"); float y = DICTOOL->getFloatValue_json(options, "y");
widget->setPosition(ccp(x,y)); widget->setPosition(Point(x,y));
bool sx = DICTOOL->checkObjectExist_json(options, "scaleX"); bool sx = DICTOOL->checkObjectExist_json(options, "scaleX");
if (sx) if (sx)
{ {
@ -329,12 +329,12 @@ void CCSGUIReader::setColorPropsForWidgetFromJsonDictionary(UIWidget *widget, cs
int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255; int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255;
int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255; int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255;
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255; int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
widget->setColor(ccc3(colorR, colorG, colorB)); widget->setColor(Color3B(colorR, colorG, colorB));
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX"); bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : 0.5f; float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : 0.5f;
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY"); bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : 0.5f; float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : 0.5f;
widget->setAnchorPoint(ccp(apxf, apyf)); widget->setAnchorPoint(Point(apxf, apyf));
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX"); bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY"); bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
widget->setFlipX(flipX); widget->setFlipX(flipX);
@ -377,14 +377,14 @@ void CCSGUIReader::setPropsForButtonFromJsonDictionary(UIWidget*widget,cs::JsonD
{ {
button->loadTextures(normalFileName_tp, pressedFileName_tp, disabledFileName_tp); button->loadTextures(normalFileName_tp, pressedFileName_tp, disabledFileName_tp);
} }
button->setCapInsets(CCRectMake(cx, cy, cw, ch)); button->setCapInsets(Rect(cx, cy, cw, ch));
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width"); bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height"); bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
if (sw && sh) if (sw && sh)
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
button->setSize(CCSizeMake(swf, shf)); button->setSize(Size(swf, shf));
} }
} }
else else
@ -480,14 +480,14 @@ void CCSGUIReader::setPropsForButtonFromJsonDictionary(UIWidget*widget,cs::JsonD
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
button->setCapInsets(CCRectMake(cx, cy, cw, ch)); button->setCapInsets(Rect(cx, cy, cw, ch));
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width"); bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height"); bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
if (sw && sh) if (sw && sh)
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
button->setSize(CCSizeMake(swf, shf)); button->setSize(Size(swf, shf));
} }
} }
setColorPropsForWidgetFromJsonDictionary(widget,options); setColorPropsForWidgetFromJsonDictionary(widget,options);
@ -696,14 +696,14 @@ void CCSGUIReader::setPropsForImageViewFromJsonDictionary(UIWidget*widget,cs::Js
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
imageView->setSize(CCSizeMake(swf, shf)); imageView->setSize(Size(swf, shf));
} }
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
imageView->setCapInsets(CCRectMake(cx, cy, cw, ch)); imageView->setCapInsets(Rect(cx, cy, cw, ch));
} }
else else
@ -769,7 +769,7 @@ void CCSGUIReader::setPropsForImageViewFromJsonDictionary(UIWidget*widget,cs::Js
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
imageView->setSize(CCSizeMake(swf, shf)); imageView->setSize(Size(swf, shf));
} }
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
@ -777,7 +777,7 @@ void CCSGUIReader::setPropsForImageViewFromJsonDictionary(UIWidget*widget,cs::Js
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
imageView->setCapInsets(CCRectMake(cx, cy, cw, ch)); imageView->setCapInsets(Rect(cx, cy, cw, ch));
} }
setColorPropsForWidgetFromJsonDictionary(widget,options); setColorPropsForWidgetFromJsonDictionary(widget,options);
@ -808,7 +808,7 @@ void CCSGUIReader::setPropsForLabelFromJsonDictionary(UIWidget*widget,cs::JsonDi
int cr = cro?DICTOOL->getIntValue_json(options, "colorR"):255; int cr = cro?DICTOOL->getIntValue_json(options, "colorR"):255;
int cg = cgo?DICTOOL->getIntValue_json(options, "colorG"):255; int cg = cgo?DICTOOL->getIntValue_json(options, "colorG"):255;
int cb = cbo?DICTOOL->getIntValue_json(options, "colorB"):255; int cb = cbo?DICTOOL->getIntValue_json(options, "colorB"):255;
ccColor3B tc = ccc3(cr, cg, cb); Color3B tc = Color3B(cr, cg, cb);
label->setColor(tc); label->setColor(tc);
setColorPropsForWidgetFromJsonDictionary(widget,options); setColorPropsForWidgetFromJsonDictionary(widget,options);
} }
@ -906,7 +906,7 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX"); float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY"); float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
panel->setBackGroundColorVector(ccp(bgcv1, bgcv2)); panel->setBackGroundColorVector(Point(bgcv1, bgcv2));
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity"); int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
@ -914,8 +914,8 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
panel->setBackGroundColorType(LayoutBackGroundColorType(colorType)); panel->setBackGroundColorType(LayoutBackGroundColorType(colorType));
// float w = DICTOOL->getFloatValue_json(options, "width"); // float w = DICTOOL->getFloatValue_json(options, "width");
// float h = DICTOOL->getFloatValue_json(options, "height"); // float h = DICTOOL->getFloatValue_json(options, "height");
panel->setBackGroundColor(ccc3(scr, scg, scb),ccc3(ecr, ecg, ecb)); panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
panel->setBackGroundColor(ccc3(cr, cg, cb)); panel->setBackGroundColor(Color3B(cr, cg, cb));
panel->setBackGroundColorOpacity(co); panel->setBackGroundColorOpacity(co);
// panel->setSize(CCSizeMake(w, h)); // panel->setSize(CCSizeMake(w, h));
@ -937,7 +937,7 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
{ {
panel->setBackGroundImage(imageFileName_tp); panel->setBackGroundImage(imageFileName_tp);
} }
panel->setBackGroundImageCapInsets(CCRectMake(cx, cy, cw, ch)); panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
} }
else else
{ {
@ -973,7 +973,7 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX"); float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY"); float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
panel->setBackGroundColorVector(ccp(bgcv1, bgcv2)); panel->setBackGroundColorVector(Point(bgcv1, bgcv2));
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity"); int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
@ -981,8 +981,8 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
panel->setBackGroundColorType(LayoutBackGroundColorType(colorType)); panel->setBackGroundColorType(LayoutBackGroundColorType(colorType));
// float w = DICTOOL->getFloatValue_json(options, "width"); // float w = DICTOOL->getFloatValue_json(options, "width");
// float h = DICTOOL->getFloatValue_json(options, "height"); // float h = DICTOOL->getFloatValue_json(options, "height");
panel->setBackGroundColor(ccc3(scr, scg, scb),ccc3(ecr, ecg, ecb)); panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
panel->setBackGroundColor(ccc3(cr, cg, cb)); panel->setBackGroundColor(Color3B(cr, cg, cb));
panel->setBackGroundColorOpacity(co); panel->setBackGroundColorOpacity(co);
// panel->setSize(CCSizeMake(w, h)); // panel->setSize(CCSizeMake(w, h));
@ -1016,7 +1016,7 @@ void CCSGUIReader::setPropsForPanelFromJsonDictionary(UIWidget*widget,cs::JsonDi
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY"); float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
panel->setBackGroundImageCapInsets(CCRectMake(cx, cy, cw, ch)); panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
} }
setColorPropsForWidgetFromJsonDictionary(widget,options); setColorPropsForWidgetFromJsonDictionary(widget,options);
} }
@ -1028,7 +1028,7 @@ void CCSGUIReader::setPropsForScrollViewFromJsonDictionary(UIWidget*widget,cs::J
UIScrollView* scrollView = (UIScrollView*)widget; UIScrollView* scrollView = (UIScrollView*)widget;
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth"); float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight"); float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
scrollView->setInnerContainerSize(CCSizeMake(innerWidth, innerHeight)); scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
/* gui mark */ /* gui mark */
int direction = DICTOOL->getFloatValue_json(options, "direction"); int direction = DICTOOL->getFloatValue_json(options, "direction");
scrollView->setDirection((SCROLLVIEW_DIR)direction); scrollView->setDirection((SCROLLVIEW_DIR)direction);
@ -1063,7 +1063,7 @@ void CCSGUIReader::setPropsForSliderFromJsonDictionary(UIWidget*widget,cs::JsonD
{ {
slider->loadBarTexture(imageFileName_tp); slider->loadBarTexture(imageFileName_tp);
} }
slider->setSize(CCSizeMake(barLength, slider->getContentSize().height)); slider->setSize(Size(barLength, slider->getContentSize().height));
} }
else else
{ {
@ -1150,7 +1150,7 @@ void CCSGUIReader::setPropsForSliderFromJsonDictionary(UIWidget*widget,cs::JsonD
break; break;
} }
slider->setSize(CCSizeMake(barLength, slider->getContentSize().height)); slider->setSize(Size(barLength, slider->getContentSize().height));
CC_SAFE_DELETE(imageFileNameDic); CC_SAFE_DELETE(imageFileNameDic);
} }
else else
@ -1308,24 +1308,24 @@ void CCSGUIReader::setPropsForTextAreaFromJsonDictionary(UIWidget*widget,cs::Jso
int cr = DICTOOL->getIntValue_json(options, "colorR"); int cr = DICTOOL->getIntValue_json(options, "colorR");
int cg = DICTOOL->getIntValue_json(options, "colorG"); int cg = DICTOOL->getIntValue_json(options, "colorG");
int cb = DICTOOL->getIntValue_json(options, "colorB"); int cb = DICTOOL->getIntValue_json(options, "colorB");
textArea->setColor(ccc3(cr, cg, cb)); textArea->setColor(Color3B(cr, cg, cb));
textArea->setFontName(DICTOOL->getStringValue_json(options, "fontName")); textArea->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth"); bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth");
bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight"); bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight");
if (aw && ah) if (aw && ah)
{ {
CCSize size = CCSize(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight")); Size size = Size(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight"));
textArea->setTextAreaSize(size); textArea->setTextAreaSize(size);
} }
bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment"); bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment");
if (ha) if (ha)
{ {
textArea->setTextHorizontalAlignment((CCTextAlignment)DICTOOL->getIntValue_json(options, "hAlignment")); textArea->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, "hAlignment"));
} }
bool va = DICTOOL->checkObjectExist_json(options, "vAlignment"); bool va = DICTOOL->checkObjectExist_json(options, "vAlignment");
if (va) if (va)
{ {
textArea->setTextVerticalAlignment((CCVerticalTextAlignment)DICTOOL->getIntValue_json(options, "vAlignment")); textArea->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, "vAlignment"));
} }
setColorPropsForWidgetFromJsonDictionary(widget,options); setColorPropsForWidgetFromJsonDictionary(widget,options);
} }
@ -1343,7 +1343,7 @@ void CCSGUIReader::setPropsForTextButtonFromJsonDictionary(UIWidget*widget,cs::J
int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255; int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255;
int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255; int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255;
int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255; int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255;
textButton->setTitleColor(ccc3(cri,cgi,cbi)); textButton->setTitleColor(Color3B(cri,cgi,cbi));
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize"); bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
if (fs) if (fs)
{ {
@ -1381,7 +1381,7 @@ void CCSGUIReader::setPropsForTextFieldFromJsonDictionary(UIWidget*widget,cs::Js
bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight"); bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight");
if (tsw && tsh) if (tsw && tsh)
{ {
textField->setTouchSize(CCSizeMake(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight"))); textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight")));
} }
float dw = DICTOOL->getFloatValue_json(options, "width"); float dw = DICTOOL->getFloatValue_json(options, "width");
@ -1472,11 +1472,11 @@ void CCSGUIReader::setPropsForLoadingBarFromJsonDictionary(UIWidget *widget, cs:
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth"); float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight"); float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
loadingBar->setCapInsets(CCRectMake(cx, cy, cw, ch)); loadingBar->setCapInsets(Rect(cx, cy, cw, ch));
float width = DICTOOL->getFloatValue_json(options, "width"); float width = DICTOOL->getFloatValue_json(options, "width");
float height = DICTOOL->getFloatValue_json(options, "height"); float height = DICTOOL->getFloatValue_json(options, "height");
loadingBar->setSize(CCSizeMake(width, height)); loadingBar->setSize(Size(width, height));
} }
/**/ /**/
@ -1561,7 +1561,7 @@ void CCSGUIReader::setPropsForDragPanelFromJsonDictionary(UIWidget *widget, cs::
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth"); float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight"); float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
dragPanel->setInnerContainerSize(CCSizeMake(innerWidth, innerHeight)); dragPanel->setInnerContainerSize(Size(innerWidth, innerHeight));
setColorPropsForWidgetFromJsonDictionary(widget, options); setColorPropsForWidgetFromJsonDictionary(widget, options);
} }

View File

@ -31,7 +31,7 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
#define kCCSVersion 1.0 #define kCCSVersion 1.0
class CCSGUIReader : CCObject class CCSGUIReader : Object
{ {
public: public:
CCSGUIReader(); CCSGUIReader();