| 228 | |
| 229 | protected: |
| 230 | void updateSize() |
| 231 | { |
| 232 | ISubWidgetText* text = nullptr; |
| 233 | if (mWidgetText != nullptr) |
| 234 | text = mWidgetText->getSubWidgetText(); |
| 235 | IntSize size = text == nullptr ? IntSize() : text->getTextSize(); |
| 236 | // минимум высота иконки |
| 237 | if ((nullptr != mIcon) && (mIcon->getImageIndex() != ITEM_NONE)) |
| 238 | { |
| 239 | if (size.height < mIcon->getHeight()) |
| 240 | size.height = mIcon->getHeight(); |
| 241 | size.width += mIcon->getSize().width; |
| 242 | } |
| 243 | size += mOffsetText; |
| 244 | size.width += 3; |
| 245 | |
| 246 | int width = ((int)mVectorButton.size() * mButtonSize.width) + |
| 247 | (((int)mVectorButton.size() + 1) * mButtonOffset.width); |
| 248 | if (size.width < width) |
| 249 | size.width = width; |
| 250 | |
| 251 | int offset = (size.width - width) / 2; |
| 252 | offset += mButtonOffset.width; |
| 253 | |
| 254 | size.width += mMainWidget->getWidth() - mMainWidget->getClientCoord().width; |
| 255 | size.height += mMainWidget->getHeight() - mMainWidget->getClientCoord().height; |
| 256 | |
| 257 | const IntSize& view = RenderManager::getInstance().getViewSize(); |
| 258 | mMainWidget |
| 259 | ->setCoord((view.width - size.width) / 2, (view.height - size.height) / 2, size.width, size.height); |
| 260 | |
| 261 | if (nullptr != mIcon) |
| 262 | { |
| 263 | if (mWidgetText != nullptr) |
| 264 | { |
| 265 | if (mIcon->getImageIndex() != ITEM_NONE) |
| 266 | mWidgetText->setCoord( |
| 267 | mLeftOffset2, |
| 268 | mWidgetText->getTop(), |
| 269 | mWidgetText->getWidth(), |
| 270 | mWidgetText->getHeight()); |
| 271 | else |
| 272 | mWidgetText->setCoord( |
| 273 | mLeftOffset1, |
| 274 | mWidgetText->getTop(), |
| 275 | mWidgetText->getWidth(), |
| 276 | mWidgetText->getHeight()); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | for (auto& iter : mVectorButton) |
| 281 | { |
| 282 | iter->setCoord( |
| 283 | offset, |
| 284 | mMainWidget->getClientCoord().height - mButtonOffset.height, |
| 285 | mButtonSize.width, |
| 286 | mButtonSize.height); |
| 287 | offset += mButtonOffset.width + mButtonSize.width; |
nothing calls this directly
no test coverage detected