| 81 | } |
| 82 | |
| 83 | void TabControl::initAfterInsert(int index) |
| 84 | { |
| 85 | auto cellSize = _tabItems.size(); |
| 86 | auto tabItem = _tabItems.at(index); |
| 87 | auto headerCell = tabItem->header; |
| 88 | auto container = tabItem->container; |
| 89 | |
| 90 | if (cellSize == 1) |
| 91 | { |
| 92 | setSelectTab(0); |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | deactiveTabItem(tabItem); |
| 97 | } |
| 98 | |
| 99 | headerCell->setContentSize(Vec2(_headerWidth, _headerHeight)); |
| 100 | headerCell->setAnchorPoint(getHeaderAnchorWithDock()); |
| 101 | if (headerCell->isIgnoreContentAdaptWithSize() == _ignoreHeaderTextureSize) |
| 102 | { |
| 103 | headerCell->ignoreContentAdaptWithSize(!_ignoreHeaderTextureSize); |
| 104 | if (_ignoreHeaderTextureSize) |
| 105 | headerCell->setContentSize(Vec2(_headerWidth, _headerHeight)); |
| 106 | headerCell->backGroundDisabledTextureScaleChangedWithSize(); |
| 107 | headerCell->backGroundSelectedTextureScaleChangedWithSize(); |
| 108 | headerCell->backGroundDisabledTextureScaleChangedWithSize(); |
| 109 | headerCell->frontCrossTextureScaleChangedWithSize(); |
| 110 | headerCell->frontCrossDisabledTextureScaleChangedWithSize(); |
| 111 | } |
| 112 | |
| 113 | initTabHeadersPos(index); |
| 114 | if (_containerSize.equals(Vec2::ZERO)) |
| 115 | initContainers(); |
| 116 | else |
| 117 | { |
| 118 | container->setPosition(_containerPosition); |
| 119 | container->setContentSize(_containerSize); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | void TabControl::removeTab(int index) |
| 124 | { |
nothing calls this directly
no test coverage detected