mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[escher] Add a class even odd pointer text cell
Change-Id: I843ad6626fff17306ab288e532eba6273a034573
This commit is contained in:
@@ -12,6 +12,7 @@ objs += $(addprefix escher/src/,\
|
||||
editable_text_cell.o\
|
||||
even_odd_cell.o\
|
||||
even_odd_editable_text_cell.o\
|
||||
even_odd_pointer_text_cell.o\
|
||||
expression_view.o\
|
||||
header_view_controller.o\
|
||||
header_view_delegate.o\
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <escher/editable_text_cell.h>
|
||||
#include <escher/even_odd_cell.h>
|
||||
#include <escher/even_odd_editable_text_cell.h>
|
||||
#include <escher/even_odd_pointer_text_cell.h>
|
||||
#include <escher/expression_view.h>
|
||||
#include <escher/header_view_controller.h>
|
||||
#include <escher/header_view_delegate.h>
|
||||
|
||||
19
escher/include/escher/even_odd_pointer_text_cell.h
Normal file
19
escher/include/escher/even_odd_pointer_text_cell.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef ESCHER_EVEN_ODD_POINTER_TEXT_CELL_H
|
||||
#define ESCHER_EVEN_ODD_POINTER_TEXT_CELL_H
|
||||
|
||||
#include <escher/even_odd_cell.h>
|
||||
#include <escher/pointer_text_view.h>
|
||||
|
||||
class EvenOddPointerTextCell : public EvenOddCell {
|
||||
public:
|
||||
EvenOddPointerTextCell();
|
||||
void reloadCell() override;
|
||||
void setText(const char * textContent, KDColor textColor = KDColorBlack);
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews() override;
|
||||
protected:
|
||||
PointerTextView m_pointerTextView;
|
||||
};
|
||||
|
||||
#endif
|
||||
31
escher/src/even_odd_pointer_text_cell.cpp
Normal file
31
escher/src/even_odd_pointer_text_cell.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <escher/even_odd_pointer_text_cell.h>
|
||||
#include <assert.h>
|
||||
|
||||
EvenOddPointerTextCell::EvenOddPointerTextCell() :
|
||||
EvenOddCell(),
|
||||
m_pointerTextView(nullptr, 0.5f, 0.5f)
|
||||
{
|
||||
}
|
||||
|
||||
void EvenOddPointerTextCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void EvenOddPointerTextCell::setText(const char * title, KDColor textColor) {
|
||||
m_pointerTextView.setText(title);
|
||||
m_pointerTextView.setTextColor(textColor);
|
||||
}
|
||||
|
||||
int EvenOddPointerTextCell::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
View * EvenOddPointerTextCell::subviewAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return &m_pointerTextView;
|
||||
}
|
||||
|
||||
void EvenOddPointerTextCell::layoutSubviews() {
|
||||
m_pointerTextView.setFrame(bounds());
|
||||
}
|
||||
Reference in New Issue
Block a user