Files
Upsilon/apps/calculation/selectable_table_view.cpp
Émilie Feral d83c101a33 [apps/calculation] Create a specific table view for calculation which
aligns to the bottom

Change-Id: I4fe9763b1d9ae2ae3e898046221b780c51515830
2016-11-04 11:08:15 +01:00

26 lines
982 B
C++

#include "selectable_table_view.h"
namespace Calculation {
CalculationSelectableTableView::CalculationSelectableTableView(Responder * parentResponder, TableViewDataSource * dataSource,
SelectableTableViewDelegate * delegate) :
::SelectableTableView(parentResponder, dataSource, 0, 0, 0, 0, delegate)
{
}
void CalculationSelectableTableView::scrollToCell(int i, int j) {
::SelectableTableView::scrollToCell(i, j);
if (m_contentView.bounds().height() < bounds().height()) {
m_topMargin = bounds().height() - m_contentView.bounds().height();
} else {
m_topMargin = 0;
}
ScrollView::layoutSubviews();
if (m_contentView.bounds().height() - contentOffset().y() < bounds().height()) {
KDCoordinate contentOffsetX = contentOffset().x();
KDCoordinate contentOffsetY = dataSource()->cumulatedHeightFromIndex(dataSource()->numberOfRows()) - maxContentHeightDisplayableWithoutScrolling();
setContentOffset(KDPoint(contentOffsetX, contentOffsetY));
}
}
}