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