[apps/calculation] Create a specific table view for calculation which

aligns to the bottom

Change-Id: I4fe9763b1d9ae2ae3e898046221b780c51515830
This commit is contained in:
Émilie Feral
2016-10-28 17:25:53 +02:00
parent 17fcccd31f
commit d83c101a33
6 changed files with 49 additions and 7 deletions

View File

@@ -0,0 +1,26 @@
#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));
}
}
}