Blame view

emulateur/epsilon-nofrendo/poincare/src/layout/integral_layout.h 2.09 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  #ifndef POINCARE_INTEGRAL_LAYOUT_H
  #define POINCARE_INTEGRAL_LAYOUT_H
  
  #include <poincare/static_layout_hierarchy.h>
  #include <poincare/layout_engine.h>
  #include <assert.h>
  
  namespace Poincare {
  
  class IntegralLayout : public StaticLayoutHierarchy<3> {
  public:
    constexpr static KDCoordinate k_symbolHeight = 4;
    constexpr static KDCoordinate k_symbolWidth = 4;
    using StaticLayoutHierarchy::StaticLayoutHierarchy;
    ExpressionLayout * clone() const override;
  
    // Dynamic Layout
    void deleteBeforeCursor(ExpressionLayoutCursor * cursor) 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;
  
    // Other
    ExpressionLayout * layoutToPointWhenInserting() override {
      assert(lowerBoundLayout() != nullptr);
      return lowerBoundLayout();
    }
    char XNTChar() const override { return 'x'; }
  protected:
    void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override;
    KDSize computeSize() override;
    void computeBaseline() override;
    KDPoint positionOfChild(ExpressionLayout * child) override;
  private:
    constexpr static KDCoordinate k_boundHeightMargin = 8;
    constexpr static KDCoordinate k_boundWidthMargin = 5;
    constexpr static KDCoordinate k_integrandWidthMargin = 2;
    constexpr static KDCoordinate k_integrandHeigthMargin = 2;
    constexpr static KDCoordinate k_lineThickness = 1;
    ExpressionLayout * integrandLayout() { return editableChild(0); }
    ExpressionLayout * lowerBoundLayout() { return editableChild(1); }
    ExpressionLayout * upperBoundLayout() { return editableChild(2); }
  };
  
  }
  
  #endif