Files
Upsilon/escher/src/window.cpp
Émilie Feral a4df89d2f5 [escher] [apps] Add a title bar in all apps
Change-Id: If545e9b6cd96aa1189d83120f047ac7746a5a9d6
2017-01-27 11:20:20 +01:00

47 lines
816 B
C++

#include <escher/window.h>
extern "C" {
#include <assert.h>
}
Window::Window() :
m_contentView(nullptr)
{
}
void Window::redraw() {
View::redraw(bounds());
}
void Window::setContentView(View * contentView) {
if (m_contentView != 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