Files
Upsilon/apps/sequence/sequence_title_cell.h
Gabriel Ozouf 43fc937469 [apps/sequence] SequenceTitleCell reload
SequenceTitleCell::reloadCell now triggers a layoutSubviews, causing the
vertical alignment to be recomputed. This solves issues regarding the
alignment of a sequence's name and definition, such as :
  - typing u_n = v_n ; v_n would be displayed above u_n
  - typing u_n = (1/3)/2 then changing to u_n = 1/(2/3) without erasing
    the formula first. u_n would no longer be aligned with the = sign.

Change-Id: I4a771d96ea79e42e2f4822e93f9f1cbbcf867610
2020-11-04 14:45:34 +01:00

37 lines
1.2 KiB
C++

#ifndef SEQUENCE_SEQUENCE_TITLE_CELL_H
#define SEQUENCE_SEQUENCE_TITLE_CELL_H
#include "../shared/function_title_cell.h"
#include <poincare_layouts.h>
namespace Sequence {
class SequenceTitleCell : public Shared::FunctionTitleCell {
public:
SequenceTitleCell();
void setLayout(Poincare::Layout layout);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setColor(KDColor color) override;
void setOrientation(Orientation orientation) override;
const KDFont * font() const override {
return Poincare::CodePointLayoutNode::k_defaultFont;
}
Poincare::Layout layout() const override {
return m_titleTextView.layout();
}
void reloadCell() override;
private:
static constexpr float k_horizontalOrientationAlignment = 0.5f;
static constexpr float k_verticalOrientationHorizontalAlignment = 0.9f;
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews(bool force = false) override;
float verticalAlignmentGivenExpressionBaselineAndRowHeight(KDCoordinate expressionBaseline, KDCoordinate rowHeight) const override;
EvenOddExpressionCell m_titleTextView;
};
}
#endif