mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher] [apps] Add a title bar in all apps
Change-Id: If545e9b6cd96aa1189d83120f047ac7746a5a9d6
This commit is contained in:
43
apps/apps_window.cpp
Normal file
43
apps/apps_window.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "apps_window.h"
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
|
||||
/* Title Bar View */
|
||||
|
||||
void AppsWindow::TitleBarView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), KDColorBlack);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
|
||||
AppsWindow::AppsWindow() :
|
||||
Window(),
|
||||
m_titleBarView(TitleBarView())
|
||||
{
|
||||
}
|
||||
|
||||
int AppsWindow::numberOfSubviews() const {
|
||||
return (m_contentView == nullptr ? 1 : 2);
|
||||
}
|
||||
|
||||
View * AppsWindow::subviewAtIndex(int index) {
|
||||
if (index == 0) {
|
||||
return &m_titleBarView;
|
||||
}
|
||||
assert(m_contentView != nullptr && index == 1);
|
||||
return m_contentView;
|
||||
}
|
||||
|
||||
void AppsWindow::layoutSubviews() {
|
||||
m_titleBarView.setFrame(KDRect(0, 0, bounds().width(), k_titleBarHeight));
|
||||
if (m_contentView != nullptr) {
|
||||
m_contentView->setFrame(KDRect(0, k_titleBarHeight, bounds().width(), bounds().height()-k_titleBarHeight));
|
||||
}
|
||||
}
|
||||
|
||||
#if ESCHER_VIEW_LOGGING
|
||||
const char * AppsWindow::className() const {
|
||||
return "Window";
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user