12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include "ui/UIRelativeBox.h"
- NS_CC_BEGIN
- namespace ui{
-
- RelativeBox::RelativeBox()
- {
- }
- RelativeBox::~RelativeBox()
- {
- }
- RelativeBox* RelativeBox::create()
- {
- RelativeBox* widget = new (std::nothrow) RelativeBox();
- if (widget && widget->init())
- {
- widget->autorelease();
- return widget;
- }
- CC_SAFE_DELETE(widget);
- return nullptr;
- }
- RelativeBox* RelativeBox::create(const cocos2d::Size &size)
- {
- RelativeBox* widget = new (std::nothrow) RelativeBox();
- if (widget && widget->initWithSize(size))
- {
- widget->autorelease();
- return widget;
- }
- CC_SAFE_DELETE(widget);
- return nullptr;
- }
- bool RelativeBox::init()
- {
- if (Layout::init())
- {
- setLayoutType(Layout::Type::RELATIVE);
- return true;
- }
- return false;
- }
- bool RelativeBox::initWithSize(const Size& size)
- {
- if (init())
- {
- setContentSize(size);
- return true;
- }
- return false;
- }
-
- }
- NS_CC_END
|