mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 08:47:28 +01:00
[code] Created DoubleBufferTextView for functions/variables toolbox.
Change-Id: I8fb8d12463de44f244230eca36d4b0404343f57d
This commit is contained in:
53
apps/code/double_buffer_text_cell.cpp
Normal file
53
apps/code/double_buffer_text_cell.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "double_buffer_text_cell.h"
|
||||
#include <escher/palette.h>
|
||||
#include <assert.h>
|
||||
|
||||
DoubleBufferTextCell::DoubleBufferTextCell(KDText::FontSize size, float horizontalAlignment, float verticalAlignment) :
|
||||
TableCell(TableCell::Layout::Vertical),
|
||||
m_firstBufferTextView(size, horizontalAlignment, verticalAlignment),
|
||||
m_secondBufferTextView(size, horizontalAlignment, verticalAlignment)
|
||||
{
|
||||
}
|
||||
|
||||
const char * DoubleBufferTextCell::firstText() {
|
||||
return m_firstBufferTextView.text();
|
||||
}
|
||||
|
||||
const char * DoubleBufferTextCell::secondText() {
|
||||
return m_secondBufferTextView.text();
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::setFirstText(const char * textContent) {
|
||||
m_firstBufferTextView.setText(textContent);
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::setSecondText(const char * textContent) {
|
||||
m_secondBufferTextView.setText(textContent);
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::setFirstTextColor(KDColor textColor) {
|
||||
m_firstBufferTextView.setTextColor(textColor);
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::setSecondTextColor(KDColor textColor) {
|
||||
m_secondBufferTextView.setTextColor(textColor);
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::setHighlighted(bool highlight) {
|
||||
HighlightCell::setHighlighted(highlight);
|
||||
KDColor background = isHighlighted() ? Palette::Select : KDColorWhite;
|
||||
m_firstBufferTextView.setBackgroundColor(background);
|
||||
m_secondBufferTextView.setBackgroundColor(background);
|
||||
}
|
||||
|
||||
View * DoubleBufferTextCell::subviewAtIndex(int index) {
|
||||
assert(index >= 0 && index <= 1);
|
||||
if (index == 0) {
|
||||
return &m_firstBufferTextView;
|
||||
}
|
||||
return &m_secondBufferTextView;
|
||||
}
|
||||
|
||||
void DoubleBufferTextCell::layoutSubviews() {
|
||||
TableCell::layoutSubviews();
|
||||
}
|
||||
Reference in New Issue
Block a user