Add getDescription method

This commit is contained in:
CaiWenzhi 2013-09-17 17:59:20 +08:00
parent 3fa539081f
commit 9d6d9dcd19
32 changed files with 158 additions and 53 deletions

View File

@ -56,4 +56,9 @@ bool UIRootWidget::init()
return false;
}
const char* UIRootWidget::getDescription() const
{
return "RootWidget";
}
NS_CC_EXT_END

View File

@ -46,6 +46,11 @@ public:
* Allocates and initializes a widget.
*/
static UIRootWidget* create();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
//initializes state of widget.
virtual bool init();

View File

@ -1158,6 +1158,11 @@ LayoutParameter* UIWidget::getLayoutParameter()
return _layoutParameter;
}
const char* UIWidget::getDescription() const
{
return "Widget";
}
/*temp action*/
void UIWidget::setActionTag(int tag)
{

View File

@ -875,6 +875,11 @@ public:
virtual void onEnter();
virtual void onExit();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
/*temp action*/
void setActionTag(int tag);
int getActionTag();

View File

@ -425,6 +425,11 @@ const Size& Layout::getContentSize() const
return _renderer->getContentSize();
}
const char* Layout::getDescription() const
{
return "Layout";
}
RectClippingNode::RectClippingNode():
m_pInnerStencil(NULL),
_enabled(true),

View File

@ -179,6 +179,10 @@ public:
*/
virtual const Size& getContentSize() const;
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
//override "init" method of widget.
virtual bool init();

View File

@ -1383,4 +1383,9 @@ Layout* UIDragPanel::getInnerContainer()
return m_pInnerContainer;
}
const char* UIDragPanel::getDescription() const
{
return "DragPanel";
}
NS_CC_EXT_END

View File

@ -226,6 +226,11 @@ public:
*/
Layout* getInnerContainer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool init();
virtual void initRenderer();

View File

@ -1457,4 +1457,10 @@ void UIListView::addUpdateChildEvent(Object *target, SEL_ListViewUpdateChildEven
_updateChildSelector = selector;
}
const char* UIListView::getDescription() const
{
return "ListView";
}
NS_CC_EXT_END

View File

@ -139,6 +139,10 @@ public:
/**/
virtual void update(float dt);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool init();

View File

@ -565,4 +565,9 @@ int UIPageView::getCurPageIndex() const
return _curPageIdx;
}
const char* UIPageView::getDescription() const
{
return "PageView";
}
NS_CC_EXT_END

View File

@ -134,6 +134,10 @@ public:
//override "update" method of widget.
virtual void update(float dt);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool addChild(UIWidget* widget);
virtual bool init();

View File

@ -698,4 +698,9 @@ LayoutExecutant* UIScrollView::getLayoutExecutant() const
return _innerContainer->getLayoutExecutant();
}
const char* UIScrollView::getDescription() const
{
return "ScrollView";
}
NS_CC_EXT_END

View File

@ -183,6 +183,11 @@ public:
virtual void onTouchLongClicked(const Point &touchPoint);
virtual void update(float dt);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool init();
virtual void initRenderer();

View File

@ -431,54 +431,6 @@ void UIButton::setAnchorPoint(const Point &pt)
_titleRenderer->setPosition(Point(_size.width*(0.5f-_anchorPoint.x), _size.height*(0.5f-_anchorPoint.y)));
}
void UIButton::setNormalSpriteFrame(SpriteFrame *frame)
{
if (!frame)
{
return;
}
if (_scale9Enabled)
{
dynamic_cast<Scale9Sprite*>(_buttonNormalRenderer)->setSpriteFrame(frame);
}
else
{
dynamic_cast<Sprite*>(_buttonNormalRenderer)->setDisplayFrame(frame);
}
}
void UIButton::setPressedSpriteFrame(SpriteFrame *frame)
{
if (!frame)
{
return;
}
if (_scale9Enabled)
{
dynamic_cast<Scale9Sprite*>(_buttonClickedRenderer)->setSpriteFrame(frame);
}
else
{
dynamic_cast<Sprite*>(_buttonClickedRenderer)->setDisplayFrame(frame);
}
}
void UIButton::setDisabledSpriteFrame(SpriteFrame *frame)
{
if (!frame)
{
return;
}
if (_scale9Enabled)
{
dynamic_cast<Scale9Sprite*>(_buttonDisableRenderer)->setSpriteFrame(frame);
}
else
{
dynamic_cast<Sprite*>(_buttonDisableRenderer)->setDisplayFrame(frame);
}
}
void UIButton::onSizeChanged()
{
normalTextureScaleChangedWithSize();
@ -657,4 +609,9 @@ void UIButton::setColor(const Color3B &color)
setTitleColor(_titleColor);
}
const char* UIButton::getDescription() const
{
return "Button";
}
NS_CC_EXT_END

View File

@ -171,9 +171,10 @@ public:
void setTitleFontName(const char* fontName);
const char* getTitleFontName() const;
virtual void setNormalSpriteFrame(SpriteFrame* frame);
virtual void setPressedSpriteFrame(SpriteFrame* frame);
virtual void setDisabledSpriteFrame(SpriteFrame* frame);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool init();
virtual void initRenderer();

View File

@ -456,4 +456,9 @@ void UICheckBox::frontCrossDisabledTextureScaleChangedWithSize()
}
}
const char* UICheckBox::getDescription() const
{
return "CheckBox";
}
NS_CC_EXT_END

View File

@ -157,6 +157,10 @@ public:
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual bool init();
virtual void initRenderer();

View File

@ -368,4 +368,9 @@ void UIImageView::imageTextureScaleChangedWithSize()
}
}
const char* UIImageView::getDescription() const
{
return "ImageView";
}
NS_CC_EXT_END

View File

@ -107,6 +107,11 @@ public:
void checkDoubleClick(float dt);
virtual const Size& getContentSize() const;
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual void initRenderer();
virtual void onSizeChanged();

View File

@ -221,7 +221,11 @@ void UILabel::labelScaleChangedWithSize()
_labelRenderer->setScaleX(scaleX);
_labelRenderer->setScaleY(scaleY);
}
}
const char* UILabel::getDescription() const
{
return "Label";
}
NS_CC_EXT_END

View File

@ -117,6 +117,11 @@ public:
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
void setTextAreaSize(const Size &size);
void setTextHorizontalAlignment(TextHAlignment alignment);
void setTextVerticalAlignment(TextVAlignment alignment);

View File

@ -167,4 +167,9 @@ void UILabelAtlas::labelAtlasScaleChangedWithSize()
}
}
const char* UILabelAtlas::getDescription() const
{
return "LabelAtlase";
}
NS_CC_EXT_END

View File

@ -87,6 +87,11 @@ public:
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual void initRenderer();
virtual void onSizeChanged();

View File

@ -126,4 +126,10 @@ void UILabelBMFont::labelBMFontScaleChangedWithSize()
}
}
const char* UILabelBMFont::getDescription() const
{
return "LabelBMFont";
}
NS_CC_EXT_END

View File

@ -58,6 +58,11 @@ public:
virtual void setAnchorPoint(const Point &pt);
virtual const Size& getContentSize() const;
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual void initRenderer();
virtual void onSizeChanged();

View File

@ -331,4 +331,9 @@ void UILoadingBar::setScale9Scale()
dynamic_cast<Scale9Sprite*>(_barRenderer)->setPreferredSize(Size(width, _barRendererTextureSize.height));
}
const char* UILoadingBar::getDescription() const
{
return "LoadingBar";
}
NS_CC_EXT_END

View File

@ -117,6 +117,10 @@ public:
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual void initRenderer();
virtual void onSizeChanged();

View File

@ -535,4 +535,10 @@ void UISlider::onPressStateChangedToDisabled()
_slidBallPressedRenderer->setVisible(false);
_slidBallDisabledRenderer->setVisible(true);
}
const char* UISlider::getDescription() const
{
return "Slider";
}
NS_CC_EXT_END

View File

@ -180,6 +180,11 @@ public:
//override "ignoreContentAdaptWithSize" method of widget.
virtual void ignoreContentAdaptWithSize(bool ignore);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
protected:
virtual void initRenderer();
float getPercentWithBallPos(float location);

View File

@ -584,4 +584,9 @@ Node* UITextField::getVirtualRenderer()
return _textFieldRenderer;
}
const char* UITextField::getDescription() const
{
return "TextField";
}
NS_CC_EXT_END

View File

@ -70,6 +70,8 @@ public:
bool getInsertText();
void setDeleteBackward(bool deleteBackward);
bool getDeleteBackward();
protected:
bool m_bMaxLengthEnabled;
int m_nMaxLength;
@ -131,7 +133,10 @@ public:
virtual void setAnchorPoint(const Point &pt);
virtual void setColor(const Color3B &color);
virtual void setOpacity(int opacity);
/**
* Returns the "class name" of widget.
*/
virtual const char* getDescription() const;
/*compatibel*/
/**
* These methods will be removed