| 394 | } |
| 395 | |
| 396 | void CAPickerView::selectRow(unsigned int row, unsigned int component, bool animated) |
| 397 | { |
| 398 | if ( m_tableViews.empty() || !m_dataSource) |
| 399 | { |
| 400 | return; |
| 401 | } |
| 402 | |
| 403 | CATableView* tableView = m_tableViews.at(component); |
| 404 | if (tableView) |
| 405 | { |
| 406 | int maxRow = m_dataSource->numberOfRowsInComponent(this, component); |
| 407 | float height = m_dataSource->rowHeightForComponent(this, component); |
| 408 | if (row < maxRow) |
| 409 | { |
| 410 | //DPoint offset = DPointZero; |
| 411 | DPoint offset; |
| 412 | if (maxRow <= m_displayRow[component]) |
| 413 | { |
| 414 | m_selected[component] = row + m_displayRow[component]/2; |
| 415 | offset.y = row * height; |
| 416 | tableView->setContentOffset(offset, false); |
| 417 | } |
| 418 | else |
| 419 | { |
| 420 | m_selected[component] = maxRow + row; |
| 421 | offset.y = m_selected[component] * height + height/2 - tableView->getBounds().size.height/2; |
| 422 | tableView->setContentOffset(offset, false); |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | int CAPickerView::selectedRowInComponent(unsigned int component) |
| 429 | { |
no test coverage detected