mirror of https://github.com/axmolengine/axmol.git
Modify for editor
This commit is contained in:
parent
b02ed6fb1e
commit
03f5be47da
|
@ -81,7 +81,9 @@ _currentStencilPassDepthPass(GL_KEEP),
|
||||||
_currentDepthWriteMask(GL_TRUE),
|
_currentDepthWriteMask(GL_TRUE),
|
||||||
_currentAlphaTestEnabled(GL_FALSE),
|
_currentAlphaTestEnabled(GL_FALSE),
|
||||||
_currentAlphaTestFunc(GL_ALWAYS),
|
_currentAlphaTestFunc(GL_ALWAYS),
|
||||||
_currentAlphaTestRef(1)
|
_currentAlphaTestRef(1),
|
||||||
|
_backGroundImageColor(Color3B::WHITE),
|
||||||
|
_backGroundImageOpacity(255)
|
||||||
{
|
{
|
||||||
_widgetType = WidgetTypeContainer;
|
_widgetType = WidgetTypeContainer;
|
||||||
}
|
}
|
||||||
|
@ -628,20 +630,9 @@ void Layout::setBackGroundImage(const char* fileName,TextureResType texType)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_backGroundScale9Enabled)
|
|
||||||
{
|
|
||||||
extension::Scale9Sprite* bgiScale9 = static_cast<extension::Scale9Sprite*>(_backGroundImage);
|
|
||||||
bgiScale9->setColor(getColor());
|
|
||||||
bgiScale9->setOpacity(getOpacity());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Sprite* bgiScale9 = static_cast<Sprite*>(_backGroundImage);
|
|
||||||
bgiScale9->setColor(getColor());
|
|
||||||
bgiScale9->setOpacity(getOpacity());
|
|
||||||
}
|
|
||||||
_backGroundImageTextureSize = _backGroundImage->getContentSize();
|
_backGroundImageTextureSize = _backGroundImage->getContentSize();
|
||||||
_backGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
|
_backGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
|
||||||
|
updateBackGroundImageRGBA();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layout::setBackGroundImageCapInsets(const Rect &capInsets)
|
void Layout::setBackGroundImageCapInsets(const Rect &capInsets)
|
||||||
|
@ -828,7 +819,7 @@ const Color3B& Layout::getBackGroundEndColor()
|
||||||
return _gEndColor;
|
return _gEndColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layout::setBackGroundColorOpacity(int opacity)
|
void Layout::setBackGroundColorOpacity(GLubyte opacity)
|
||||||
{
|
{
|
||||||
_cOpacity = opacity;
|
_cOpacity = opacity;
|
||||||
switch (_colorType)
|
switch (_colorType)
|
||||||
|
@ -846,7 +837,7 @@ void Layout::setBackGroundColorOpacity(int opacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Layout::getBackGroundColorOpacity()
|
GLubyte Layout::getBackGroundColorOpacity()
|
||||||
{
|
{
|
||||||
return _cOpacity;
|
return _cOpacity;
|
||||||
}
|
}
|
||||||
|
@ -865,6 +856,53 @@ const Point& Layout::getBackGroundColorVector()
|
||||||
return _alongVector;
|
return _alongVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Layout::setBackGroundImageColor(const Color3B &color)
|
||||||
|
{
|
||||||
|
_backGroundImageColor = color;
|
||||||
|
updateBackGroundImageColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layout::setBackGroundImageOpacity(GLubyte opacity)
|
||||||
|
{
|
||||||
|
_backGroundImageOpacity = opacity;
|
||||||
|
updateBackGroundImageOpacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Color3B& Layout::getBackGroundImageColor()
|
||||||
|
{
|
||||||
|
return _backGroundImageColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLubyte Layout::getBackGroundImageOpacity()
|
||||||
|
{
|
||||||
|
return _backGroundImageOpacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layout::updateBackGroundImageColor()
|
||||||
|
{
|
||||||
|
if (_backGroundImage)
|
||||||
|
{
|
||||||
|
_backGroundImage->setColor(_backGroundImageColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layout::updateBackGroundImageOpacity()
|
||||||
|
{
|
||||||
|
if (_backGroundImage)
|
||||||
|
{
|
||||||
|
_backGroundImage->setOpacity(_backGroundImageOpacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layout::updateBackGroundImageRGBA()
|
||||||
|
{
|
||||||
|
if (_backGroundImage)
|
||||||
|
{
|
||||||
|
_backGroundImage->setColor(_backGroundImageColor);
|
||||||
|
_backGroundImage->setOpacity(_backGroundImageOpacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Size& Layout::getBackGroundImageTextureSize() const
|
const Size& Layout::getBackGroundImageTextureSize() const
|
||||||
{
|
{
|
||||||
return _backGroundImageTextureSize;
|
return _backGroundImageTextureSize;
|
||||||
|
|
|
@ -141,9 +141,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param opacity
|
* @param opacity
|
||||||
*/
|
*/
|
||||||
void setBackGroundColorOpacity(int opacity);
|
void setBackGroundColorOpacity(GLubyte opacity);
|
||||||
|
|
||||||
int getBackGroundColorOpacity();
|
GLubyte getBackGroundColorOpacity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -154,6 +154,14 @@ public:
|
||||||
|
|
||||||
const Point& getBackGroundColorVector();
|
const Point& getBackGroundColorVector();
|
||||||
|
|
||||||
|
void setBackGroundImageColor(const ccColor3B& color);
|
||||||
|
|
||||||
|
void setBackGroundImageOpacity(GLubyte opacity);
|
||||||
|
|
||||||
|
const ccColor3B& getBackGroundImageColor();
|
||||||
|
|
||||||
|
GLubyte getBackGroundImageOpacity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the background image of layout.
|
* Remove the background image of layout.
|
||||||
*/
|
*/
|
||||||
|
@ -286,6 +294,9 @@ protected:
|
||||||
|
|
||||||
void onBeforeVisitScissor();
|
void onBeforeVisitScissor();
|
||||||
void onAfterVisitScissor();
|
void onAfterVisitScissor();
|
||||||
|
void updateBackGroundImageColor();
|
||||||
|
void updateBackGroundImageOpacity();
|
||||||
|
void updateBackGroundImageRGBA();
|
||||||
protected:
|
protected:
|
||||||
bool _clippingEnabled;
|
bool _clippingEnabled;
|
||||||
|
|
||||||
|
@ -302,7 +313,7 @@ protected:
|
||||||
Color3B _gStartColor;
|
Color3B _gStartColor;
|
||||||
Color3B _gEndColor;
|
Color3B _gEndColor;
|
||||||
Point _alongVector;
|
Point _alongVector;
|
||||||
int _cOpacity;
|
GLubyte _cOpacity;
|
||||||
Size _backGroundImageTextureSize;
|
Size _backGroundImageTextureSize;
|
||||||
LayoutType _layoutType;
|
LayoutType _layoutType;
|
||||||
LayoutClippingType _clippingType;
|
LayoutClippingType _clippingType;
|
||||||
|
@ -329,8 +340,11 @@ protected:
|
||||||
GLenum _currentAlphaTestFunc;
|
GLenum _currentAlphaTestFunc;
|
||||||
GLclampf _currentAlphaTestRef;
|
GLclampf _currentAlphaTestRef;
|
||||||
|
|
||||||
GLint _mask_layer_le;
|
|
||||||
|
|
||||||
|
Color3B _backGroundImageColor;
|
||||||
|
GLubyte _backGroundImageOpacity;
|
||||||
|
|
||||||
|
GLint _mask_layer_le;
|
||||||
GroupCommand _groupCommand;
|
GroupCommand _groupCommand;
|
||||||
CustomCommand _beforeVisitCmdStencil;
|
CustomCommand _beforeVisitCmdStencil;
|
||||||
CustomCommand _afterDrawStencilCmd;
|
CustomCommand _afterDrawStencilCmd;
|
||||||
|
|
|
@ -172,7 +172,7 @@ public:
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
void requestRefreshView();
|
void requestRefreshView();
|
||||||
|
void refreshView();
|
||||||
protected:
|
protected:
|
||||||
virtual void addChild(Node* child) override{ScrollView::addChild(child);};
|
virtual void addChild(Node* child) override{ScrollView::addChild(child);};
|
||||||
virtual void addChild(Node * child, int zOrder) override{ScrollView::addChild(child, zOrder);};
|
virtual void addChild(Node * child, int zOrder) override{ScrollView::addChild(child, zOrder);};
|
||||||
|
@ -195,7 +195,6 @@ protected:
|
||||||
virtual void copyClonedWidgetChildren(Widget* model) override;
|
virtual void copyClonedWidgetChildren(Widget* model) override;
|
||||||
void selectedItemEvent();
|
void selectedItemEvent();
|
||||||
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
|
virtual void interceptTouchEvent(int handleState,Widget* sender,const Point &touchPoint) override;
|
||||||
void refreshView();
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Widget* _model;
|
Widget* _model;
|
||||||
|
|
|
@ -569,6 +569,11 @@ const Size& Widget::getSize() const
|
||||||
return _size;
|
return _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Size& Widget::getCustomSize() const
|
||||||
|
{
|
||||||
|
return _customSize;
|
||||||
|
}
|
||||||
|
|
||||||
const Point& Widget::getSizePercent() const
|
const Point& Widget::getSizePercent() const
|
||||||
{
|
{
|
||||||
return _sizePercent;
|
return _sizePercent;
|
||||||
|
|
|
@ -548,6 +548,8 @@ public:
|
||||||
*/
|
*/
|
||||||
const Size& getSize() const;
|
const Size& getSize() const;
|
||||||
|
|
||||||
|
const Size& getCustomSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns size percent of widget
|
* Returns size percent of widget
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue