mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[poincarE] Fraction, Grid and Horizontal layouts
This commit is contained in:
@@ -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\
|
||||
)
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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==;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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--;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user