add const to UILayout

This commit is contained in:
andyque 2014-05-27 10:36:33 +08:00
parent e32a637bf5
commit b17de0cdcb
2 changed files with 38 additions and 38 deletions

View File

@ -178,7 +178,7 @@ void Layout::removeAllChildrenWithCleanup(bool cleanup)
_doLayoutDirty = true; _doLayoutDirty = true;
} }
bool Layout::isClippingEnabled() bool Layout::isClippingEnabled()const
{ {
return _clippingEnabled; return _clippingEnabled;
} }
@ -445,7 +445,7 @@ void Layout::setClippingType(ClippingType type)
setClippingEnabled(clippingEnabled); setClippingEnabled(clippingEnabled);
} }
Layout::ClippingType Layout::getClippingType() Layout::ClippingType Layout::getClippingType()const
{ {
return _clippingType; return _clippingType;
} }
@ -582,7 +582,7 @@ void Layout::setBackGroundImageScale9Enabled(bool able)
setBackGroundImageCapInsets(_backGroundImageCapInsets); setBackGroundImageCapInsets(_backGroundImageCapInsets);
} }
bool Layout::isBackGroundImageScale9Enabled() bool Layout::isBackGroundImageScale9Enabled()const
{ {
return _backGroundScale9Enabled; return _backGroundScale9Enabled;
} }
@ -643,7 +643,7 @@ void Layout::setBackGroundImageCapInsets(const Rect &capInsets)
} }
} }
const Rect& Layout::getBackGroundImageCapInsets() const Rect& Layout::getBackGroundImageCapInsets()const
{ {
return _backGroundImageCapInsets; return _backGroundImageCapInsets;
} }
@ -773,7 +773,7 @@ void Layout::setBackGroundColorType(BackGroundColorType type)
} }
} }
Layout::BackGroundColorType Layout::getBackGroundColorType() Layout::BackGroundColorType Layout::getBackGroundColorType()const
{ {
return _colorType; return _colorType;
} }
@ -787,7 +787,7 @@ void Layout::setBackGroundColor(const Color3B &color)
} }
} }
const Color3B& Layout::getBackGroundColor() const Color3B& Layout::getBackGroundColor()const
{ {
return _cColor; return _cColor;
} }
@ -806,12 +806,12 @@ void Layout::setBackGroundColor(const Color3B &startColor, const Color3B &endCol
} }
} }
const Color3B& Layout::getBackGroundStartColor() const Color3B& Layout::getBackGroundStartColor()const
{ {
return _gStartColor; return _gStartColor;
} }
const Color3B& Layout::getBackGroundEndColor() const Color3B& Layout::getBackGroundEndColor()const
{ {
return _gEndColor; return _gEndColor;
} }
@ -834,7 +834,7 @@ void Layout::setBackGroundColorOpacity(GLubyte opacity)
} }
} }
GLubyte Layout::getBackGroundColorOpacity() GLubyte Layout::getBackGroundColorOpacity()const
{ {
return _cOpacity; return _cOpacity;
} }
@ -848,7 +848,7 @@ void Layout::setBackGroundColorVector(const Vec2 &vector)
} }
} }
const Vec2& Layout::getBackGroundColorVector() const Vec2& Layout::getBackGroundColorVector()const
{ {
return _alongVector; return _alongVector;
} }
@ -865,12 +865,12 @@ void Layout::setBackGroundImageOpacity(GLubyte opacity)
updateBackGroundImageOpacity(); updateBackGroundImageOpacity();
} }
const Color3B& Layout::getBackGroundImageColor() const Color3B& Layout::getBackGroundImageColor()const
{ {
return _backGroundImageColor; return _backGroundImageColor;
} }
GLubyte Layout::getBackGroundImageOpacity() GLubyte Layout::getBackGroundImageOpacity()const
{ {
return _backGroundImageOpacity; return _backGroundImageOpacity;
} }
@ -1020,7 +1020,7 @@ void Layout::setLoopFocus(bool loop)
_loopFocus = loop; _loopFocus = loop;
} }
bool Layout::isLoopFocus() bool Layout::isLoopFocus()const
{ {
return _loopFocus; return _loopFocus;
} }
@ -1031,7 +1031,7 @@ void Layout::setPassFocusToChild(bool pass)
_passFocusToChild = pass; _passFocusToChild = pass;
} }
bool Layout::isPassFocusToChild() bool Layout::isPassFocusToChild()const
{ {
return _passFocusToChild; return _passFocusToChild;
} }
@ -1073,7 +1073,7 @@ Size Layout::getLayoutAccumulatedSize()const
return layoutSize; return layoutSize;
} }
Vec2 Layout::getWorldCenterPoint(Widget* widget) Vec2 Layout::getWorldCenterPoint(Widget* widget)const
{ {
Layout *layout = dynamic_cast<Layout*>(widget); Layout *layout = dynamic_cast<Layout*>(widget);
//FIXEDME: we don't need to calculate the content size of layout anymore //FIXEDME: we don't need to calculate the content size of layout anymore
@ -1433,7 +1433,7 @@ Widget* Layout::passFocusToChild(FocusDirection dir, cocos2d::ui::Widget *curren
} }
bool Layout::checkFocusEnabledChild() bool Layout::checkFocusEnabledChild()const
{ {
bool ret = false; bool ret = false;
for(Node* node : _children) for(Node* node : _children)
@ -1448,7 +1448,7 @@ bool Layout::checkFocusEnabledChild()
return ret; return ret;
} }
Widget* Layout::getChildWidgetByIndex(ssize_t index) Widget* Layout::getChildWidgetByIndex(ssize_t index)const
{ {
ssize_t size = _children.size(); ssize_t size = _children.size();
int count = 0; int count = 0;
@ -1671,7 +1671,7 @@ Widget* Layout::getNextFocusedWidget(FocusDirection direction, Widget *current)
} }
} }
bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction) bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)const
{ {
Layout* parent = dynamic_cast<Layout*>(widget->getParent()); Layout* parent = dynamic_cast<Layout*>(widget->getParent());
if (parent == nullptr) if (parent == nullptr)
@ -1757,7 +1757,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
return false; return false;
} }
bool Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction) bool Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction)const
{ {
Layout* parent = dynamic_cast<Layout*>(widget->getParent()); Layout* parent = dynamic_cast<Layout*>(widget->getParent());
if (parent == nullptr) if (parent == nullptr)

View File

@ -110,7 +110,7 @@ public:
*/ */
void setBackGroundImageCapInsets(const Rect& capInsets); void setBackGroundImageCapInsets(const Rect& capInsets);
const Rect& getBackGroundImageCapInsets(); const Rect& getBackGroundImageCapInsets()const;
/** /**
* Sets Color Type for layout. * Sets Color Type for layout.
@ -119,7 +119,7 @@ public:
*/ */
void setBackGroundColorType(BackGroundColorType type); void setBackGroundColorType(BackGroundColorType type);
BackGroundColorType getBackGroundColorType(); BackGroundColorType getBackGroundColorType()const;
/** /**
* Sets background iamge use scale9 renderer. * Sets background iamge use scale9 renderer.
@ -128,7 +128,7 @@ public:
*/ */
void setBackGroundImageScale9Enabled(bool enabled); void setBackGroundImageScale9Enabled(bool enabled);
bool isBackGroundImageScale9Enabled(); bool isBackGroundImageScale9Enabled()const;
/** /**
* Sets background color for layout, if color type is LAYOUT_COLOR_SOLID * Sets background color for layout, if color type is LAYOUT_COLOR_SOLID
@ -137,7 +137,7 @@ public:
*/ */
void setBackGroundColor(const Color3B &color); void setBackGroundColor(const Color3B &color);
const Color3B& getBackGroundColor(); const Color3B& getBackGroundColor()const;
/** /**
* Sets background color for layout, if color type is LAYOUT_COLOR_GRADIENT * Sets background color for layout, if color type is LAYOUT_COLOR_GRADIENT
@ -148,9 +148,9 @@ public:
*/ */
void setBackGroundColor(const Color3B &startColor, const Color3B &endColor); void setBackGroundColor(const Color3B &startColor, const Color3B &endColor);
const Color3B& getBackGroundStartColor(); const Color3B& getBackGroundStartColor()const;
const Color3B& getBackGroundEndColor(); const Color3B& getBackGroundEndColor()const;
/** /**
* Sets background opacity layout. * Sets background opacity layout.
@ -159,7 +159,7 @@ public:
*/ */
void setBackGroundColorOpacity(GLubyte opacity); void setBackGroundColorOpacity(GLubyte opacity);
GLubyte getBackGroundColorOpacity(); GLubyte getBackGroundColorOpacity()const;
/** /**
* Sets background color vector for layout, if color type is LAYOUT_COLOR_GRADIENT * Sets background color vector for layout, if color type is LAYOUT_COLOR_GRADIENT
@ -168,15 +168,15 @@ public:
*/ */
void setBackGroundColorVector(const Vec2 &vector); void setBackGroundColorVector(const Vec2 &vector);
const Vec2& getBackGroundColorVector(); const Vec2& getBackGroundColorVector()const;
void setBackGroundImageColor(const Color3B& color); void setBackGroundImageColor(const Color3B& color);
void setBackGroundImageOpacity(GLubyte opacity); void setBackGroundImageOpacity(GLubyte opacity);
const Color3B& getBackGroundImageColor(); const Color3B& getBackGroundImageColor()const;
GLubyte getBackGroundImageOpacity(); GLubyte getBackGroundImageOpacity()const;
/** /**
* Remove the background image of layout. * Remove the background image of layout.
@ -201,14 +201,14 @@ public:
void setClippingType(ClippingType type); void setClippingType(ClippingType type);
ClippingType getClippingType(); ClippingType getClippingType()const;
/** /**
* Gets if layout is clipping enabled. * Gets if layout is clipping enabled.
* *
* @return if layout is clipping enabled. * @return if layout is clipping enabled.
*/ */
virtual bool isClippingEnabled(); virtual bool isClippingEnabled()const;
/** /**
* Returns the "class name" of widget. * Returns the "class name" of widget.
@ -276,7 +276,7 @@ public:
/** /**
*@return If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false. *@return If focus loop is enabled, then it will return true, otherwise it returns false. The default value is false.
*/ */
bool isLoopFocus(); bool isLoopFocus()const;
/** /**
*@param pass To specify whether the layout pass its focus to its child *@param pass To specify whether the layout pass its focus to its child
@ -286,7 +286,7 @@ public:
/** /**
* @return To query whether the layout will pass the focus to its children or not. The default value is true * @return To query whether the layout will pass the focus to its children or not. The default value is true
*/ */
bool isPassFocusToChild(); bool isPassFocusToChild()const;
/** /**
* When a widget is in a layout, you could call this method to get the next focused widget within a specified direction. * When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
@ -402,7 +402,7 @@ protected:
/** /**
* get the center point of a widget in world space * get the center point of a widget in world space
*/ */
Vec2 getWorldCenterPoint(Widget* node); Vec2 getWorldCenterPoint(Widget* node)const;
/** /**
* this method is called internally by nextFocusedWidget. When the dir is Right/Down, then this method will be called * this method is called internally by nextFocusedWidget. When the dir is Right/Down, then this method will be called
@ -424,17 +424,17 @@ protected:
* find the nth elment in the _children array. Only the Widget descendant object will be returned * find the nth elment in the _children array. Only the Widget descendant object will be returned
*@param index The index of a element in the _children array *@param index The index of a element in the _children array
*/ */
Widget* getChildWidgetByIndex(ssize_t index); Widget* getChildWidgetByIndex(ssize_t index)const;
/** /**
* whether it is the last element according to all their parents * whether it is the last element according to all their parents
*/ */
bool isLastWidgetInContainer(Widget* widget, FocusDirection direction); bool isLastWidgetInContainer(Widget* widget, FocusDirection direction)const;
/**Lookup any parent widget with a layout type as the direction, /**Lookup any parent widget with a layout type as the direction,
* if the layout is loop focused, then return true, otherwise * if the layout is loop focused, then return true, otherwise
* It returns false * It returns false
*/ */
bool isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction); bool isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction)const;
/** /**
* pass the focus to the layout's next focus enabled child * pass the focus to the layout's next focus enabled child
@ -444,7 +444,7 @@ protected:
/** /**
* If there are no focus enabled child in the layout, it will return false, otherwise it returns true * If there are no focus enabled child in the layout, it will return false, otherwise it returns true
*/ */
bool checkFocusEnabledChild(); bool checkFocusEnabledChild()const;
protected: protected:
bool _clippingEnabled; bool _clippingEnabled;