Blame view

build1/epsilon-master/poincare/src/layout/binomial_coefficient_layout.h 1.5 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #ifndef POINCARE_BINOMIAL_COEFFICIENT_LAYOUT_H
  #define POINCARE_BINOMIAL_COEFFICIENT_LAYOUT_H
  
  #include <poincare/static_layout_hierarchy.h>
  #include <poincare/layout_engine.h>
  #include <poincare/print_float.h>
  
  namespace Poincare {
  
  class BinomialCoefficientLayout : public StaticLayoutHierarchy<2> {
  public:
    using StaticLayoutHierarchy::StaticLayoutHierarchy;
    ExpressionLayout * clone() const override;
  
    // Tree navigation
    ExpressionLayoutCursor cursorLeftOf(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout) override;
    ExpressionLayoutCursor cursorRightOf(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout) override;
    ExpressionLayoutCursor cursorAbove(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited = false) override;
    ExpressionLayoutCursor cursorUnder(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited = false) override;
  
    // Serialization
    int writeTextInBuffer(char * buffer, int bufferSize) const override {
      return LayoutEngine::writePrefixExpressionLayoutTextInBuffer(this, buffer, bufferSize, "binomial");
    }
  
  protected:
    void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
    KDSize computeSize() override;
    void computeBaseline() override;
    KDPoint positionOfChild(ExpressionLayout * child) override;
  private:
    ExpressionLayout * nLayout() { return editableChild(0); }
    ExpressionLayout * kLayout() { return editableChild(1); }
  };
  
  }
  
  #endif