mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 23:30:37 +01:00
[escher] improve stack view drawing
Change-Id: I76ec35c21c9d877c209ee51a4c843dbed7b773b0
This commit is contained in:
@@ -1,22 +1,38 @@
|
||||
#include <escher/stack_view.h>
|
||||
#include <escher/palette.h>
|
||||
extern "C" {
|
||||
#include <assert.h>
|
||||
}
|
||||
|
||||
StackView::StackView() :
|
||||
View(),
|
||||
m_name(nullptr)
|
||||
m_textView(PointerTextView(nullptr, 0.5f, 0.5f, Palette::k_desactiveTextColor))
|
||||
{
|
||||
}
|
||||
|
||||
int StackView::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
View * StackView::subviewAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return &m_textView;
|
||||
}
|
||||
|
||||
void StackView::layoutSubviews() {
|
||||
m_textView.setFrame(bounds());
|
||||
}
|
||||
|
||||
void StackView::setName(const char * name) {
|
||||
m_name = name;
|
||||
markRectAsDirty(bounds());
|
||||
m_textView.setText(name);
|
||||
}
|
||||
|
||||
void StackView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, KDColor(0xFFCD50));
|
||||
ctx->drawString(m_name, KDPointZero);
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate width = bounds().width();
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::LineColor);
|
||||
ctx->fillRect(KDRect(0, 1, width, height-2), KDColorWhite);
|
||||
ctx->fillRect(KDRect(0, height-1, width, 1), Palette::LineColor);
|
||||
}
|
||||
|
||||
#if ESCHER_VIEW_LOGGING
|
||||
|
||||
Reference in New Issue
Block a user