diff --git a/escher/Makefile b/escher/Makefile index ba62beca8..ce8d4bb07 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -21,6 +21,7 @@ objs += $(addprefix escher/src/,\ even_odd_message_text_cell.o\ expression_table_cell.o\ expression_table_cell_with_pointer.o\ + expression_table_cell_with_expression.o\ expression_view.o\ highlight_cell.o\ gauge_view.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index d340214cd..982717aba 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/escher/include/escher/expression_table_cell_with_expression.h b/escher/include/escher/expression_table_cell_with_expression.h new file mode 100644 index 000000000..1ae00f860 --- /dev/null +++ b/escher/include/escher/expression_table_cell_with_expression.h @@ -0,0 +1,17 @@ +#ifndef ESCHER_EXPRESSION_TABLE_CELL_WITH_EXPRESSION_H +#define ESCHER_EXPRESSION_TABLE_CELL_WITH_EXPRESSION_H + +#include +#include + +class ExpressionTableCellWithExpression : public ExpressionTableCell { +public: + ExpressionTableCellWithExpression(); + View * accessoryView() const override; + void setHighlighted(bool highlight) override; + void setAccessoryLayout(Poincare::Layout layoutR); +private: + ExpressionView m_accessoryExpressionView; +}; + +#endif diff --git a/escher/src/expression_table_cell_with_expression.cpp b/escher/src/expression_table_cell_with_expression.cpp new file mode 100644 index 000000000..8e9c204b9 --- /dev/null +++ b/escher/src/expression_table_cell_with_expression.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +ExpressionTableCellWithExpression::ExpressionTableCellWithExpression() : + ExpressionTableCell(Layout::Horizontal), + m_accessoryExpressionView(1.0f, 0.5f, KDColorBlack, KDColorWhite) +{} + +View * ExpressionTableCellWithExpression::accessoryView() const { + return (View *)&m_accessoryExpressionView; +} + +void ExpressionTableCellWithExpression::setHighlighted(bool highlight) { + ExpressionTableCell::setHighlighted(highlight); + KDColor backgroundColor = highlight? Palette::Select : KDColorWhite; + m_accessoryExpressionView.setBackgroundColor(backgroundColor); +} + +void ExpressionTableCellWithExpression::setAccessoryLayout(Poincare::Layout layoutR) { + m_accessoryExpressionView.setLayout(layoutR); + layoutSubviews(); +}