Blame view

emulateur/epsilon-nofrendo/poincare/src/layout/conjugate_layout.h 1.6 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
  #ifndef POINCARE_CONJUGATE_LAYOUT_H
  #define POINCARE_CONJUGATE_LAYOUT_H
  
  #include <poincare/static_layout_hierarchy.h>
  #include <poincare/layout_engine.h>
  
  namespace Poincare {
  
  class ConjugateLayout : public StaticLayoutHierarchy<1> {
  public:
    using StaticLayoutHierarchy::StaticLayoutHierarchy;
    ExpressionLayout * clone() const override;
  
    // Collapse
    void collapseSiblingsAndMoveCursor(ExpressionLayoutCursor * cursor) override;
    // Replace
    void replaceChildAndMoveCursor(const ExpressionLayout * oldChild, ExpressionLayout * newChild, bool deleteOldChild, ExpressionLayoutCursor * cursor) override;
    // Remove
    void removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) override;
  
    // Tree navigation
    ExpressionLayoutCursor cursorLeftOf(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout) override;
    ExpressionLayoutCursor cursorRightOf(ExpressionLayoutCursor cursor, bool * shouldRecomputeLayout) override;
  
    // Serialization
    int writeTextInBuffer(char * buffer, int bufferSize) const override {
      return LayoutEngine::writePrefixExpressionLayoutTextInBuffer(this, buffer, bufferSize, "conj");
    }
  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_overlineWidth = 1;
    constexpr static KDCoordinate k_overlineVerticalMargin = 1;
    ExpressionLayout * operandLayout() { return editableChild(0); }
  };
  
  }
  
  #endif