mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
Escher: Use a scrollview
Change-Id: I24c754a7ea860b79d1d660adfbf143ed0e42c8a5
This commit is contained in:
46
escher/src/scroll_view.cpp
Normal file
46
escher/src/scroll_view.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <escher/scroll_view.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
|
||||
ScrollView::ScrollView(View * contentView) :
|
||||
View(),
|
||||
m_offset(KDPointZero),
|
||||
m_contentView(contentView)
|
||||
{
|
||||
setSubview(m_contentView, 0);
|
||||
//setSubview(&m_verticalScrollIndicator, 1);
|
||||
}
|
||||
|
||||
int ScrollView::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const View * ScrollView::subview(int index) const {
|
||||
assert(index == 0);
|
||||
return m_contentView;
|
||||
}
|
||||
|
||||
void ScrollView::storeSubviewAtIndex(View * view, int index) {
|
||||
assert(index == 0);
|
||||
m_contentView = view;
|
||||
}
|
||||
|
||||
void ScrollView::layoutSubviews() {
|
||||
// Layout indicators
|
||||
// TODO
|
||||
// Layout contentview
|
||||
// FIXME: Use KDCoordinateMax
|
||||
m_contentView->setFrame({m_offset.x, m_offset.y, (KDCoordinate)9999, (KDCoordinate)9999});
|
||||
}
|
||||
|
||||
#if ESCHER_VIEW_LOGGING
|
||||
const char * ScrollView::className() const {
|
||||
return "ScrollView";
|
||||
}
|
||||
|
||||
void ScrollView::logAttributes(std::ostream &os) const {
|
||||
View::logAttributes(os);
|
||||
os << " offset=\"" << (int)m_offset.x << "," << (int)m_offset.y << "\"";
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user