[poincare] LayoutCursor::addEmptyTenPowerLayout

This commit is contained in:
Léa Saviot
2018-07-13 11:13:35 +02:00
parent 2bb5c3d831
commit 9b7987c0bb
3 changed files with 24 additions and 1 deletions

View File

@@ -75,6 +75,13 @@ public:
addChildTreeAtIndex(l2, 1);
}
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3, LayoutRef l4) : LayoutReference<HorizontalLayoutNode>() {
addChildTreeAtIndex(l1, 0);
addChildTreeAtIndex(l2, 1);
addChildTreeAtIndex(l3, 2);
addChildTreeAtIndex(l4, 3);
}
void addOrMergeChildAtIndex(LayoutRef l, int index, bool removeEmptyChildren, LayoutCursor * cursor = nullptr);
void mergeChildrenAtIndex(HorizontalLayoutRef h, int index, bool removeEmptyChildren, LayoutCursor * cursor = nullptr);
private:

View File

@@ -112,7 +112,7 @@ public:
void addEmptyPowerLayout();
void addEmptySquareRootLayout() {} //TODO
void addEmptySquarePowerLayout();
void addEmptyTenPowerLayout() {} //TODO
void addEmptyTenPowerLayout();
void addFractionLayoutAndCollapseSiblings() {} //TODO
void addXNTCharLayout();
void insertText(const char * text);

View File

@@ -90,6 +90,22 @@ void LayoutCursor::addEmptySquarePowerLayout() {
privateAddEmptyPowerLayout(offsetLayout);
}
void LayoutCursor::addEmptyTenPowerLayout() {
EmptyLayoutRef emptyLayout;
HorizontalLayoutRef sibling = HorizontalLayoutRef(
CharLayoutRef(Ion::Charset::MiddleDot),
CharLayoutRef('1'),
CharLayoutRef('0'),
VerticalOffsetLayoutRef(
emptyLayout,
VerticalOffsetLayoutNode::Type::Superscript));
LayoutRef rootRef = m_layoutRef.root();
m_layoutRef.addSibling(this, sibling, false);
if (emptyLayout.hasAncestor(rootRef, false) && !emptyLayout.isAllocationFailure()) {
m_layoutRef = emptyLayout;
}
}
void LayoutCursor::addXNTCharLayout() {
m_layoutRef.addSibling(this, CharLayoutRef(m_layoutRef.XNTChar()), true);
}