Files
Upsilon/escher/src/window.cpp
Émilie Feral 06de0dd9db [escher] Only one app is on the heap at one time
Change-Id: I6c77601cb0cc883083a4dd05370ca543fa7951cc
2017-05-18 14:16:41 +02:00

50 lines
878 B
C++

#include <escher/window.h>
#include <ion.h>
extern "C" {
#include <assert.h>
}
Window::Window() :
m_contentView(nullptr)
{
}
void Window::redraw(bool force) {
if (force) {
markRectAsDirty(bounds());
}
Ion::Display::waitForVBlank();
View::redraw(bounds());
}
void Window::setContentView(View * contentView) {
m_contentView = contentView;
markRectAsDirty(bounds());
layoutSubviews();
}
const Window * Window::window() const {
return this;
}
int Window::numberOfSubviews() const {
return (m_contentView == nullptr ? 0 : 1);
}
View * Window::subviewAtIndex(int index) {
assert(m_contentView != nullptr && index == 0);
return m_contentView;
}
void Window::layoutSubviews() {
if (m_contentView != nullptr) {
m_contentView->setFrame(bounds());
}
}
#if ESCHER_VIEW_LOGGING
const char * Window::className() const {
return "Window";
}
#endif