[poincarE] Fraction, Grid and Horizontal layouts

This commit is contained in:
Léa Saviot
2018-08-10 11:57:18 +02:00
parent 7b3ce0f53c
commit 74ca9a73b7
6 changed files with 15 additions and 6 deletions

View File

@@ -13,6 +13,9 @@ objs += $(addprefix poincare/src/,\
conjugate_layout_node.o\
empty_layout_node.o\
floor_layout_node.o\
fraction_layout_node.o\
grid_layout_node.o\
horizontal_layout_node.o\
matrix_layout_node.o\
)

View File

@@ -1,9 +1,9 @@
#ifndef POINCARE_HORIZONTAL_LAYOUT_NODE_H
#define POINCARE_HORIZONTAL_LAYOUT_NODE_H
#include "layout_reference.h"
#include "layout_node.h"
#include "layout_cursor.h"
#include <poincare/layout_reference.h>
#include <poincare/layout_node.h>
#include <poincare/layout_cursor.h>
namespace Poincare {

View File

@@ -9,6 +9,8 @@ namespace Poincare {
class LayoutCursor;
class LayoutReference : public TreeByReference {
friend class GridLayoutNode;
friend class HorizontalLayoutNode;
friend class LayoutCursor;
public:
using TreeByReference::operator==;

View File

@@ -1,7 +1,9 @@
#include <poincare/fraction_layout_node.h>
#include <poincare/allocation_failure_layout_node.h>
#include <poincare/empty_layout_node.h>
#include <poincare/horizontal_layout_node.h>
#include <poincare/layout_helper.h>
#include <poincare/serialization_helper.h>
#include <ion/charset.h>
#include <escher/metric.h>
#include <assert.h>

View File

@@ -130,7 +130,7 @@ void GridLayoutNode::deleteRowAtIndex(int index) {
assert(index >= 0 && index < m_numberOfRows);
LayoutRef thisRef = LayoutRef(this);
for (int i = 0; i < m_numberOfColumns; i++) {
thisRef.removeTreeChildAtIndex(index * m_numberOfColumns);
thisRef.removeChildAtIndexInPlace(index * m_numberOfColumns);
}
m_numberOfRows--;
}
@@ -139,7 +139,7 @@ void GridLayoutNode::deleteColumnAtIndex(int index) {
assert(index >= 0 && index < m_numberOfColumns);
LayoutRef thisRef = LayoutRef(this);
for (int i = (m_numberOfRows - 1) * m_numberOfColumns + index; i > -1; i-= m_numberOfColumns) {
thisRef.removeTreeChildAtIndex(i);
thisRef.removeChildAtIndexInPlace(i);
}
m_numberOfColumns--;
}

View File

@@ -1,6 +1,8 @@
#include <poincare/horizontal_layout_node.h>
#include <poincare/allocation_failure_layout_node.h>
#include <poincare/empty_layout_node.h>
#include <poincare/layout_helper.h>
#include <poincare/serialization_helper.h>
namespace Poincare {
@@ -238,7 +240,7 @@ bool HorizontalLayoutNode::willRemoveChild(LayoutNode * l, LayoutCursor * cursor
assert(childAtIndex(0) == l);
LayoutNode * p = parent();
if (p != nullptr) {
LayoutRef(p).removeChild(this, cursor);
LayoutRef(p).removeChild(HorizontalLayoutRef(this), cursor);
// WARNING: Do not call "this" afterwards
return false;
}