mirror of https://github.com/axmolengine/axmol.git
issue #5057, convert const char* to std::string&
This commit is contained in:
parent
56f417c520
commit
da3e794631
|
@ -55,13 +55,13 @@ Widget* Helper::seekWidgetByTag(Widget* root, int tag)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Helper::seekWidgetByName(Widget* root, const char *name)
|
Widget* Helper::seekWidgetByName(Widget* root, const std::string& name)
|
||||||
{
|
{
|
||||||
if (!root)
|
if (!root)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (strcmp(root->getName(), name) == 0)
|
if (root->getName() == name)
|
||||||
{
|
{
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return finded result.
|
* @return finded result.
|
||||||
*/
|
*/
|
||||||
static Widget* seekWidgetByName(Widget* root, const char* name);
|
static Widget* seekWidgetByName(Widget* root, const std::string& name);
|
||||||
|
|
||||||
/*temp action*/
|
/*temp action*/
|
||||||
static Widget* seekActionWidgetByActionTag(Widget* root, int tag);
|
static Widget* seekActionWidgetByActionTag(Widget* root, int tag);
|
||||||
|
|
|
@ -234,19 +234,19 @@ void RelativeLayoutExecutant::doLayout(const cocos2d::Size &layoutSize, Vector<c
|
||||||
Vector2 ap = child->getAnchorPoint();
|
Vector2 ap = child->getAnchorPoint();
|
||||||
Size cs = child->getSize();
|
Size cs = child->getSize();
|
||||||
RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign();
|
RelativeLayoutParameter::RelativeAlign align = layoutParameter->getAlign();
|
||||||
const char* relativeName = layoutParameter->getRelativeToWidgetName();
|
const std::string relativeName = layoutParameter->getRelativeToWidgetName();
|
||||||
Widget* relativeWidget = nullptr;
|
Widget* relativeWidget = nullptr;
|
||||||
RelativeLayoutParameter* relativeWidgetLP = nullptr;
|
RelativeLayoutParameter* relativeWidgetLP = nullptr;
|
||||||
float finalPosX = 0.0f;
|
float finalPosX = 0.0f;
|
||||||
float finalPosY = 0.0f;
|
float finalPosY = 0.0f;
|
||||||
if (relativeName && strcmp(relativeName, ""))
|
if (!relativeName.empty())
|
||||||
{
|
{
|
||||||
for (auto& sWidget : widgetChildren)
|
for (auto& sWidget : widgetChildren)
|
||||||
{
|
{
|
||||||
if (sWidget)
|
if (sWidget)
|
||||||
{
|
{
|
||||||
RelativeLayoutParameter* rlayoutParameter = dynamic_cast<RelativeLayoutParameter*>(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE));
|
RelativeLayoutParameter* rlayoutParameter = dynamic_cast<RelativeLayoutParameter*>(sWidget->getLayoutParameter(LayoutParameter::Type::RELATIVE));
|
||||||
if (rlayoutParameter && strcmp(rlayoutParameter->getRelativeName(), relativeName) == 0)
|
if (rlayoutParameter && rlayoutParameter->getRelativeName() == relativeName)
|
||||||
{
|
{
|
||||||
relativeWidget = sWidget;
|
relativeWidget = sWidget;
|
||||||
relativeWidgetLP = rlayoutParameter;
|
relativeWidgetLP = rlayoutParameter;
|
||||||
|
|
|
@ -164,24 +164,24 @@ RelativeLayoutParameter::RelativeAlign RelativeLayoutParameter::getAlign() const
|
||||||
return _relativeAlign;
|
return _relativeAlign;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RelativeLayoutParameter::setRelativeToWidgetName(const char *name)
|
void RelativeLayoutParameter::setRelativeToWidgetName(const std::string& name)
|
||||||
{
|
{
|
||||||
_relativeWidgetName = name;
|
_relativeWidgetName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* RelativeLayoutParameter::getRelativeToWidgetName() const
|
const std::string& RelativeLayoutParameter::getRelativeToWidgetName() const
|
||||||
{
|
{
|
||||||
return _relativeWidgetName.c_str();
|
return _relativeWidgetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RelativeLayoutParameter::setRelativeName(const char* name)
|
void RelativeLayoutParameter::setRelativeName(const std::string& name)
|
||||||
{
|
{
|
||||||
_relativeLayoutName = name;
|
_relativeLayoutName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* RelativeLayoutParameter::getRelativeName() const
|
const std::string& RelativeLayoutParameter::getRelativeName() const
|
||||||
{
|
{
|
||||||
return _relativeLayoutName.c_str();
|
return _relativeLayoutName;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutParameter* RelativeLayoutParameter::createCloneInstance()
|
LayoutParameter* RelativeLayoutParameter::createCloneInstance()
|
||||||
|
@ -196,8 +196,8 @@ void RelativeLayoutParameter::copyProperties(LayoutParameter *model)
|
||||||
if (parameter)
|
if (parameter)
|
||||||
{
|
{
|
||||||
setAlign(parameter->_relativeAlign);
|
setAlign(parameter->_relativeAlign);
|
||||||
setRelativeName(parameter->_relativeLayoutName.c_str());
|
setRelativeName(parameter->_relativeLayoutName);
|
||||||
setRelativeToWidgetName(parameter->_relativeWidgetName.c_str());
|
setRelativeToWidgetName(parameter->_relativeWidgetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,28 +268,28 @@ public:
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
void setRelativeToWidgetName(const char* name);
|
void setRelativeToWidgetName(const std::string& name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the key of LayoutParameter. Witch widget named this is relative to.
|
* Gets the key of LayoutParameter. Witch widget named this is relative to.
|
||||||
*
|
*
|
||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
const char* getRelativeToWidgetName() const;
|
const std::string& getRelativeToWidgetName() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a name in Relative Layout for LayoutParameter.
|
* Sets a name in Relative Layout for LayoutParameter.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
void setRelativeName(const char* name);
|
void setRelativeName(const std::string& name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a name in Relative Layout of LayoutParameter.
|
* Gets a name in Relative Layout of LayoutParameter.
|
||||||
*
|
*
|
||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
const char* getRelativeName() const;
|
const std::string& getRelativeName() const;
|
||||||
|
|
||||||
virtual LayoutParameter* createCloneInstance() override;
|
virtual LayoutParameter* createCloneInstance() override;
|
||||||
virtual void copyProperties(LayoutParameter* model) override;
|
virtual void copyProperties(LayoutParameter* model) override;
|
||||||
|
|
|
@ -197,7 +197,7 @@ protected:
|
||||||
virtual const Vector<Node*>& getChildren() const override{return ScrollView::getChildren();};
|
virtual const Vector<Node*>& getChildren() const override{return ScrollView::getChildren();};
|
||||||
virtual ssize_t getChildrenCount() const override {return ScrollView::getChildrenCount();};
|
virtual ssize_t getChildrenCount() const override {return ScrollView::getChildrenCount();};
|
||||||
virtual Node * getChildByTag(int tag) override {return ScrollView::getChildByTag(tag);};
|
virtual Node * getChildByTag(int tag) override {return ScrollView::getChildByTag(tag);};
|
||||||
virtual Widget* getChildByName(const char* name) override {return ScrollView::getChildByName(name);};
|
virtual Widget* getChildByName(const std::string& name) override {return ScrollView::getChildByName(name);};
|
||||||
void updateInnerContainerSize();
|
void updateInnerContainerSize();
|
||||||
void remedyLayoutParameter(Widget* item);
|
void remedyLayoutParameter(Widget* item);
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
|
|
|
@ -184,7 +184,7 @@ protected:
|
||||||
virtual const Vector<Node*>& getChildren() const override{return Widget::getChildren();};
|
virtual const Vector<Node*>& getChildren() const override{return Widget::getChildren();};
|
||||||
virtual ssize_t getChildrenCount() const override {return Widget::getChildrenCount();};
|
virtual ssize_t getChildrenCount() const override {return Widget::getChildrenCount();};
|
||||||
virtual Node * getChildByTag(int tag) override {return Widget::getChildByTag(tag);};
|
virtual Node * getChildByTag(int tag) override {return Widget::getChildByTag(tag);};
|
||||||
virtual Widget* getChildByName(const char* name) override {return Widget::getChildByName(name);};
|
virtual Widget* getChildByName(const std::string& name) override {return Widget::getChildByName(name);};
|
||||||
|
|
||||||
Layout* createPage();
|
Layout* createPage();
|
||||||
float getPositionXByIndex(ssize_t idx);
|
float getPositionXByIndex(ssize_t idx);
|
||||||
|
|
|
@ -55,7 +55,7 @@ bool RichElement::init(int tag, const Color3B &color, GLubyte opacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RichElementText* RichElementText::create(int tag, const Color3B &color, GLubyte opacity, const char *text, const char *fontName, float fontSize)
|
RichElementText* RichElementText::create(int tag, const Color3B &color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize)
|
||||||
{
|
{
|
||||||
RichElementText* element = new RichElementText();
|
RichElementText* element = new RichElementText();
|
||||||
if (element && element->init(tag, color, opacity, text, fontName, fontSize))
|
if (element && element->init(tag, color, opacity, text, fontName, fontSize))
|
||||||
|
@ -67,7 +67,7 @@ RichElementText* RichElementText::create(int tag, const Color3B &color, GLubyte
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const char *text, const char *fontName, float fontSize)
|
bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize)
|
||||||
{
|
{
|
||||||
if (RichElement::init(tag, color, opacity))
|
if (RichElement::init(tag, color, opacity))
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RichElementImage* RichElementImage::create(int tag, const Color3B &color, GLubyte opacity, const char *filePath)
|
RichElementImage* RichElementImage::create(int tag, const Color3B &color, GLubyte opacity, const std::string& filePath)
|
||||||
{
|
{
|
||||||
RichElementImage* element = new RichElementImage();
|
RichElementImage* element = new RichElementImage();
|
||||||
if (element && element->init(tag, color, opacity, filePath))
|
if (element && element->init(tag, color, opacity, filePath))
|
||||||
|
@ -91,7 +91,7 @@ RichElementImage* RichElementImage::create(int tag, const Color3B &color, GLubyt
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RichElementImage::init(int tag, const Color3B &color, GLubyte opacity, const char *filePath)
|
bool RichElementImage::init(int tag, const Color3B &color, GLubyte opacity, const std::string& filePath)
|
||||||
{
|
{
|
||||||
if (RichElement::init(tag, color, opacity))
|
if (RichElement::init(tag, color, opacity))
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ void RichText::formatText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RichText::handleTextRenderer(const char *text, const char *fontName, float fontSize, const Color3B &color, GLubyte opacity)
|
void RichText::handleTextRenderer(const std::string& text, const std::string& fontName, float fontSize, const Color3B &color, GLubyte opacity)
|
||||||
{
|
{
|
||||||
auto fileExist = FileUtils::getInstance()->isFileExist(fontName);
|
auto fileExist = FileUtils::getInstance()->isFileExist(fontName);
|
||||||
Label* textRenderer = nullptr;
|
Label* textRenderer = nullptr;
|
||||||
|
@ -293,7 +293,7 @@ void RichText::handleTextRenderer(const char *text, const char *fontName, float
|
||||||
{
|
{
|
||||||
float overstepPercent = (-_leftSpaceWidth) / textRendererWidth;
|
float overstepPercent = (-_leftSpaceWidth) / textRendererWidth;
|
||||||
std::string curText = text;
|
std::string curText = text;
|
||||||
size_t stringLength = _calcCharCount(text);
|
size_t stringLength = _calcCharCount(text.c_str());
|
||||||
int leftLength = stringLength * (1.0f - overstepPercent);
|
int leftLength = stringLength * (1.0f - overstepPercent);
|
||||||
std::string leftWords = curText.substr(0, leftLength);
|
std::string leftWords = curText.substr(0, leftLength);
|
||||||
std::string cutWords = curText.substr(leftLength, curText.length()-1);
|
std::string cutWords = curText.substr(leftLength, curText.length()-1);
|
||||||
|
@ -327,7 +327,7 @@ void RichText::handleTextRenderer(const char *text, const char *fontName, float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RichText::handleImageRenderer(const char *fileParh, const Color3B &color, GLubyte opacity)
|
void RichText::handleImageRenderer(const std::string& fileParh, const Color3B &color, GLubyte opacity)
|
||||||
{
|
{
|
||||||
Sprite* imageRenderer = Sprite::create(fileParh);
|
Sprite* imageRenderer = Sprite::create(fileParh);
|
||||||
handleCustomRenderer(imageRenderer);
|
handleCustomRenderer(imageRenderer);
|
||||||
|
|
|
@ -56,8 +56,8 @@ class RichElementText : public RichElement
|
||||||
public:
|
public:
|
||||||
RichElementText(){_type = Type::TEXT;};
|
RichElementText(){_type = Type::TEXT;};
|
||||||
virtual ~RichElementText(){};
|
virtual ~RichElementText(){};
|
||||||
bool init(int tag, const Color3B& color, GLubyte opacity, const char* text, const char* fontName, float fontSize);
|
bool init(int tag, const Color3B& color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize);
|
||||||
static RichElementText* create(int tag, const Color3B& color, GLubyte opacity, const char* text, const char* fontName, float fontSize);
|
static RichElementText* create(int tag, const Color3B& color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize);
|
||||||
protected:
|
protected:
|
||||||
std::string _text;
|
std::string _text;
|
||||||
std::string _fontName;
|
std::string _fontName;
|
||||||
|
@ -71,8 +71,8 @@ class RichElementImage : public RichElement
|
||||||
public:
|
public:
|
||||||
RichElementImage(){_type = Type::IMAGE;};
|
RichElementImage(){_type = Type::IMAGE;};
|
||||||
virtual ~RichElementImage(){};
|
virtual ~RichElementImage(){};
|
||||||
bool init(int tag, const Color3B& color, GLubyte opacity, const char* filePath);
|
bool init(int tag, const Color3B& color, GLubyte opacity, const std::string& filePath);
|
||||||
static RichElementImage* create(int tag, const Color3B& color, GLubyte opacity, const char* filePath);
|
static RichElementImage* create(int tag, const Color3B& color, GLubyte opacity, const std::string& filePath);
|
||||||
protected:
|
protected:
|
||||||
std::string _filePath;
|
std::string _filePath;
|
||||||
Rect _textureRect;
|
Rect _textureRect;
|
||||||
|
@ -116,8 +116,8 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer();
|
virtual void initRenderer();
|
||||||
void pushToContainer(Node* renderer);
|
void pushToContainer(Node* renderer);
|
||||||
void handleTextRenderer(const char* text, const char* fontName, float fontSize, const Color3B& color, GLubyte opacity);
|
void handleTextRenderer(const std::string& text, const std::string& fontName, float fontSize, const Color3B& color, GLubyte opacity);
|
||||||
void handleImageRenderer(const char* fileParh, const Color3B& color, GLubyte opacity);
|
void handleImageRenderer(const std::string& fileParh, const Color3B& color, GLubyte opacity);
|
||||||
void handleCustomRenderer(Node* renderer);
|
void handleCustomRenderer(Node* renderer);
|
||||||
void formarRenderers();
|
void formarRenderers();
|
||||||
void addNewLine();
|
void addNewLine();
|
||||||
|
|
|
@ -307,7 +307,7 @@ Node* ScrollView::getChildByTag(int tag)
|
||||||
return _innerContainer->getChildByTag(tag);
|
return _innerContainer->getChildByTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* ScrollView::getChildByName(const char *name)
|
Widget* ScrollView::getChildByName(const std::string& name)
|
||||||
{
|
{
|
||||||
return _innerContainer->getChildByName(name);
|
return _innerContainer->getChildByName(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ public:
|
||||||
|
|
||||||
virtual Node * getChildByTag(int tag) override;
|
virtual Node * getChildByTag(int tag) override;
|
||||||
|
|
||||||
virtual Widget* getChildByName(const char* name) override;
|
virtual Widget* getChildByName(const std::string& name) override;
|
||||||
|
|
||||||
virtual bool onTouchBegan(Touch *touch, Event *unusedEvent) override;
|
virtual bool onTouchBegan(Touch *touch, Event *unusedEvent) override;
|
||||||
virtual void onTouchMoved(Touch *touch, Event *unusedEvent) override;
|
virtual void onTouchMoved(Touch *touch, Event *unusedEvent) override;
|
||||||
|
|
|
@ -61,14 +61,14 @@ UICCTextField::~UICCTextField()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UICCTextField * UICCTextField::create(const char *placeholder, const char *fontName, float fontSize)
|
UICCTextField * UICCTextField::create(const std::string& placeholder, const std::string& fontName, float fontSize)
|
||||||
{
|
{
|
||||||
UICCTextField *pRet = new UICCTextField();
|
UICCTextField *pRet = new UICCTextField();
|
||||||
|
|
||||||
if(pRet && pRet->initWithPlaceHolder("", fontName, fontSize))
|
if(pRet && pRet->initWithPlaceHolder("", fontName, fontSize))
|
||||||
{
|
{
|
||||||
pRet->autorelease();
|
pRet->autorelease();
|
||||||
if (placeholder)
|
if (!placeholder.empty())
|
||||||
{
|
{
|
||||||
pRet->setPlaceHolder(placeholder);
|
pRet->setPlaceHolder(placeholder);
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,9 @@ bool UICCTextField::isPasswordEnabled()
|
||||||
return _passwordEnabled;
|
return _passwordEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UICCTextField::setPasswordStyleText(const char* styleText)
|
void UICCTextField::setPasswordStyleText(const std::string& styleText)
|
||||||
{
|
{
|
||||||
if (strlen(styleText) > 1)
|
if (styleText.length() > 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -290,10 +290,10 @@ void UICCTextField::setPasswordStyleText(const char* styleText)
|
||||||
_passwordStyleText = styleText;
|
_passwordStyleText = styleText;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UICCTextField::setPasswordText(const char *text)
|
void UICCTextField::setPasswordText(const std::string& text)
|
||||||
{
|
{
|
||||||
std::string tempStr = "";
|
std::string tempStr = "";
|
||||||
int text_count = _calcCharCount(text);
|
int text_count = _calcCharCount(text.c_str());
|
||||||
int max = text_count;
|
int max = text_count;
|
||||||
|
|
||||||
if (_maxLengthEnabled)
|
if (_maxLengthEnabled)
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
// static
|
// static
|
||||||
static UICCTextField* create(const char *placeholder, const char *fontName, float fontSize);
|
static UICCTextField* create(const std::string& placeholder, const std::string& fontName, float fontSize);
|
||||||
|
|
||||||
// CCTextFieldDelegate
|
// CCTextFieldDelegate
|
||||||
virtual bool onTextFieldAttachWithIME(TextFieldTTF *pSender) override;
|
virtual bool onTextFieldAttachWithIME(TextFieldTTF *pSender) override;
|
||||||
|
@ -65,8 +65,8 @@ public:
|
||||||
int getCharCount();
|
int getCharCount();
|
||||||
void setPasswordEnabled(bool enable);
|
void setPasswordEnabled(bool enable);
|
||||||
bool isPasswordEnabled();
|
bool isPasswordEnabled();
|
||||||
void setPasswordStyleText(const char* styleText);
|
void setPasswordStyleText(const std::string& styleText);
|
||||||
void setPasswordText(const char* text);
|
void setPasswordText(const std::string& text);
|
||||||
void setAttachWithIME(bool attach);
|
void setAttachWithIME(bool attach);
|
||||||
bool getAttachWithIME();
|
bool getAttachWithIME();
|
||||||
void setDetachWithIME(bool detach);
|
void setDetachWithIME(bool detach);
|
||||||
|
|
|
@ -162,7 +162,7 @@ void Widget::setEnabled(bool enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Widget::getChildByName(const char *name)
|
Widget* Widget::getChildByName(const std::string& name)
|
||||||
{
|
{
|
||||||
for (auto& child : _children)
|
for (auto& child : _children)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +171,7 @@ Widget* Widget::getChildByName(const char *name)
|
||||||
Widget* widgetChild = dynamic_cast<Widget*>(child);
|
Widget* widgetChild = dynamic_cast<Widget*>(child);
|
||||||
if (widgetChild)
|
if (widgetChild)
|
||||||
{
|
{
|
||||||
if (strcmp(widgetChild->getName(), name) == 0)
|
if (widgetChild->getName() == name)
|
||||||
{
|
{
|
||||||
return widgetChild;
|
return widgetChild;
|
||||||
}
|
}
|
||||||
|
@ -824,14 +824,14 @@ const Vector2& Widget::getTouchEndPos()
|
||||||
return _touchEndPos;
|
return _touchEndPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setName(const char* name)
|
void Widget::setName(const std::string& name)
|
||||||
{
|
{
|
||||||
_name = name;
|
_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Widget::getName() const
|
const std::string& Widget::getName() const
|
||||||
{
|
{
|
||||||
return _name.c_str();
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::Type Widget::getWidgetType() const
|
Widget::Type Widget::getWidgetType() const
|
||||||
|
|
|
@ -227,7 +227,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return a Widget object whose name equals to the input parameter
|
* @return a Widget object whose name equals to the input parameter
|
||||||
*/
|
*/
|
||||||
virtual Widget* getChildByName(const char* name);
|
virtual Widget* getChildByName(const std::string& name);
|
||||||
|
|
||||||
virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
|
virtual void visit(cocos2d::Renderer *renderer, const Matrix &parentTransform, bool parentTransformUpdated) override;
|
||||||
|
|
||||||
|
@ -384,18 +384,18 @@ public:
|
||||||
/**
|
/**
|
||||||
* Changes the name that is used to identify the widget easily.
|
* Changes the name that is used to identify the widget easily.
|
||||||
*
|
*
|
||||||
* @param A const char* that indentifies the widget.
|
* @param A const std::string that indentifies the widget.
|
||||||
*/
|
*/
|
||||||
void setName(const char* name);
|
void setName(const std::string& name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a name that is used to identify the widget easily.
|
* Returns a name that is used to identify the widget easily.
|
||||||
*
|
*
|
||||||
* You can set tags to widget then identify them easily.
|
* You can set tags to widget then identify them easily.
|
||||||
*
|
*
|
||||||
* @return A const char* that identifies the widget.
|
* @return A const std::string that identifies the widget.
|
||||||
*/
|
*/
|
||||||
const char* getName() const;
|
const std::string& getName() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a type that is widget's type
|
* Returns a type that is widget's type
|
||||||
|
|
Loading…
Reference in New Issue