mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 11:39:58 +02:00
[escher] Uniformize methods in menu list cell and even odd cells
Change-Id: Idccb55bdfe0ff2010fd06bd5796b8c324469446b
This commit is contained in:
@@ -8,7 +8,7 @@ class ChevronMenuListCell : public MenuListCell {
|
||||
public:
|
||||
ChevronMenuListCell(char * label = nullptr, KDText::FontSize size = KDText::FontSize::Small);
|
||||
View * accessoryView() const override;
|
||||
void reloadCell() override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
private:
|
||||
ChevronView m_accessoryView;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
class ChevronTextMenuListCell : public ChevronMenuListCell {
|
||||
public:
|
||||
ChevronTextMenuListCell(KDText::FontSize size = KDText::FontSize::Small);
|
||||
void reloadCell() override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setSubtitle(const char * text);
|
||||
private:
|
||||
static constexpr KDCoordinate k_margin = 8;
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
EditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size = KDText::FontSize::Large,
|
||||
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite);
|
||||
TextField * textField();
|
||||
void reloadCell() override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
const char * text() const;
|
||||
void setText(const char * textContent);
|
||||
int numberOfSubviews() const override;
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
const char * editedText() const;
|
||||
void didBecomeFirstResponder() override;
|
||||
void setEditing(bool isEditing);
|
||||
void reloadCell() override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setAccessoryText(const char * text);
|
||||
void setTextColor(KDColor color) override;
|
||||
constexpr static int k_bufferLength = 255;
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
class EvenOddBufferTextCell : public EvenOddCell {
|
||||
public:
|
||||
EvenOddBufferTextCell(KDText::FontSize size = KDText::FontSize::Small, float horizontalAlignment = 1.0f, float verticalAlignment = 0.5f);
|
||||
void reloadCell() override;
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setText(const char * textContent);
|
||||
void setTextColor(KDColor textColor);
|
||||
int numberOfSubviews() const override;
|
||||
|
||||
@@ -9,7 +9,8 @@ class EvenOddEditableTextCell : public EvenOddCell, public Responder {
|
||||
public:
|
||||
EvenOddEditableTextCell(Responder * parentResponder, TextFieldDelegate * delegate, char * draftTextBuffer, KDText::FontSize size = KDText::FontSize::Large);
|
||||
EditableTextCell * editableTextCell();
|
||||
void reloadCell() override;
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
const char * text() const;
|
||||
void setText(const char * textContent);
|
||||
int numberOfSubviews() const override;
|
||||
|
||||
@@ -8,7 +8,8 @@ class EvenOddExpressionCell : public EvenOddCell {
|
||||
public:
|
||||
EvenOddExpressionCell(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
|
||||
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
|
||||
void reloadCell() override;
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setExpression(Poincare::ExpressionLayout * expressionLayout);
|
||||
void setBackgroundColor(KDColor backgroundColor);
|
||||
void setTextColor(KDColor textColor);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
class EvenOddPointerTextCell : public EvenOddCell {
|
||||
public:
|
||||
EvenOddPointerTextCell(KDText::FontSize size = KDText::FontSize::Large);
|
||||
void reloadCell() override;
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setText(const char * textContent, KDColor textColor = KDColorBlack);
|
||||
void setAlignment(float horizontalAlignment, float verticalAlignment);
|
||||
int numberOfSubviews() const override;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
void setText(const char * text);
|
||||
virtual void setTextColor(KDColor color);
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
void reloadCell() override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
protected:
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
class TextMenuListCell : public MenuListCell {
|
||||
public:
|
||||
TextMenuListCell(char * label = nullptr);
|
||||
void reloadCell() override;
|
||||
View * accessoryView() const override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setAccessoryText(const char * textBody);
|
||||
|
||||
@@ -10,7 +10,7 @@ View * ChevronMenuListCell::accessoryView() const {
|
||||
return (View *)&m_accessoryView;
|
||||
}
|
||||
|
||||
void ChevronMenuListCell::reloadCell() {
|
||||
MenuListCell::reloadCell();
|
||||
void ChevronMenuListCell::setHighlighted(bool highlight) {
|
||||
MenuListCell::setHighlighted(highlight);
|
||||
m_accessoryView.setHighlighted(isHighlighted());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ ChevronMenuListCell(nullptr, size),
|
||||
{
|
||||
}
|
||||
|
||||
void ChevronTextMenuListCell::reloadCell() {
|
||||
ChevronMenuListCell::reloadCell();
|
||||
void ChevronTextMenuListCell::setHighlighted(bool highlight) {
|
||||
ChevronMenuListCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
m_subtitleView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ TextField * EditableTextCell::textField() {
|
||||
return &m_textField;
|
||||
}
|
||||
|
||||
void EditableTextCell::reloadCell() {
|
||||
TableViewCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
void EditableTextCell::setHighlighted(bool highlight) {
|
||||
TableViewCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::Select : KDColorWhite;
|
||||
m_textField.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ void EditableTextMenuListCell::setEditing(bool isEditing) {
|
||||
m_textField.setEditing(isEditing);
|
||||
}
|
||||
|
||||
void EditableTextMenuListCell::reloadCell() {
|
||||
MenuListCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
void EditableTextMenuListCell::setHighlighted(bool highlight) {
|
||||
MenuListCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::Select : KDColorWhite;
|
||||
m_textField.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@ EvenOddBufferTextCell::EvenOddBufferTextCell(KDText::FontSize size, float horizo
|
||||
{
|
||||
}
|
||||
|
||||
void EvenOddBufferTextCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
void EvenOddBufferTextCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_bufferTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void EvenOddBufferTextCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_bufferTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,13 @@ EditableTextCell * EvenOddEditableTextCell::editableTextCell() {
|
||||
return &m_editableCell;
|
||||
}
|
||||
|
||||
void EvenOddEditableTextCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
void EvenOddEditableTextCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_editableCell.textField()->setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void EvenOddEditableTextCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_editableCell.textField()->setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,13 @@ EvenOddExpressionCell::EvenOddExpressionCell(float horizontalAlignment, float ve
|
||||
{
|
||||
}
|
||||
|
||||
void EvenOddExpressionCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
void EvenOddExpressionCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_expressionView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void EvenOddExpressionCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_expressionView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@ EvenOddPointerTextCell::EvenOddPointerTextCell(KDText::FontSize size) :
|
||||
{
|
||||
}
|
||||
|
||||
void EvenOddPointerTextCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
void EvenOddPointerTextCell::setHighlighted(bool highlight) {
|
||||
EvenOddCell::setHighlighted(highlight);
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void EvenOddPointerTextCell::setEven(bool even) {
|
||||
EvenOddCell::setEven(even);
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ void MenuListCell::layoutSubviews() {
|
||||
}
|
||||
}
|
||||
|
||||
void MenuListCell::reloadCell() {
|
||||
TableViewCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
void MenuListCell::setHighlighted(bool highlight) {
|
||||
TableViewCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::Select : KDColorWhite;
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,15 +19,9 @@ View * TextMenuListCell::accessoryView() const {
|
||||
return (View *)&m_accessoryView;
|
||||
}
|
||||
|
||||
void TextMenuListCell::reloadCell() {
|
||||
MenuListCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
void TextMenuListCell::setHighlighted(bool highlight) {
|
||||
MenuListCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::Select : KDColorWhite;
|
||||
KDColor backgroundColor = isHighlighted()? Palette::Select : KDColorWhite;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user