| 460 | } |
| 461 | |
| 462 | void CANavigationController::createWithContainer(CAViewController* viewController, const DLayout& layout) |
| 463 | { |
| 464 | CAView* container = new CAView(); |
| 465 | container->setLayout(layout); |
| 466 | this->getView()->addSubview(container); |
| 467 | m_pContainers.pushBack(container); |
| 468 | container->release(); |
| 469 | |
| 470 | DLayout navLayout; |
| 471 | navLayout.horizontal = DHorizontalLayoutFill; |
| 472 | navLayout.vertical.height = m_iNavigationBarHeight; |
| 473 | |
| 474 | if (m_bNavigationBarHidden |
| 475 | || |
| 476 | (viewController->getNavigationBarItem() && viewController->getNavigationBarItem()->isNagigationBarHidden())) |
| 477 | { |
| 478 | navLayout.vertical.top = -m_iNavigationBarHeight; |
| 479 | } |
| 480 | else |
| 481 | { |
| 482 | navLayout.vertical.top = 0; |
| 483 | } |
| 484 | |
| 485 | CANavigationBar* navigationBar = CANavigationBar::createWithLayout(navLayout, m_bClearance); |
| 486 | if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0) |
| 487 | { |
| 488 | viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle())); |
| 489 | } |
| 490 | if (m_pViewControllers.empty()) |
| 491 | { |
| 492 | viewController->getNavigationBarItem()->setShowGoBackButton(false); |
| 493 | } |
| 494 | navigationBar->setItem(viewController->getNavigationBarItem()); |
| 495 | |
| 496 | if (m_pNavigationBarBackgroundImage) |
| 497 | { |
| 498 | navigationBar->setBackgroundView(CAScale9ImageView::createWithImage(m_pNavigationBarBackgroundImage)); |
| 499 | } |
| 500 | else |
| 501 | { |
| 502 | navigationBar->setBackgroundView(CAView::create()); |
| 503 | } |
| 504 | navigationBar->getBackgroundView()->setColor(m_sNavigationBarBackgroundColor); |
| 505 | navigationBar->setTitleColor(m_sNavigationBarTitleColor); |
| 506 | navigationBar->setTitleColor(m_sNavigationBarTitleColor); |
| 507 | container->insertSubview(navigationBar, 1); |
| 508 | navigationBar->setDelegate(this); |
| 509 | m_pNavigationBars.pushBack(navigationBar); |
| 510 | |
| 511 | DLayout secondLayout; |
| 512 | secondLayout.horizontal = DHorizontalLayoutFill; |
| 513 | secondLayout.vertical = DVerticalLayout_T_B(navLayout.vertical.top + navLayout.vertical.height, 0); |
| 514 | |
| 515 | CAView* secondContainer = new CAView(); |
| 516 | secondContainer->setLayout(secondLayout); |
| 517 | container->addSubview(secondContainer); |
| 518 | secondContainer->release(); |
| 519 | m_pSecondContainers.pushBack(secondContainer); |
no test coverage detected