mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 04:00:02 +02:00
[poincare] Un)iline some layotu constructors
This commit is contained in:
@@ -66,32 +66,12 @@ class HorizontalLayoutRef : public LayoutReference {
|
||||
friend class HorizontalLayoutNode;
|
||||
public:
|
||||
HorizontalLayoutRef(HorizontalLayoutNode * n) : LayoutReference(n) {}
|
||||
HorizontalLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<HorizontalLayoutNode>()) {}
|
||||
|
||||
HorizontalLayoutRef(LayoutRef l) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l, 0, 0);
|
||||
}
|
||||
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
}
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
addChildAtIndexInPlace(l3, 2, 2);
|
||||
}
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3, LayoutRef l4) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
addChildAtIndexInPlace(l3, 2, 2);
|
||||
addChildAtIndexInPlace(l4, 3, 3);
|
||||
}
|
||||
HorizontalLayoutRef(const LayoutRef * children, size_t numberOfChildren) : HorizontalLayoutRef() {
|
||||
for (size_t i = 0; i < numberOfChildren; i++) {
|
||||
addChildAtIndexInPlace(children[i], i, i);
|
||||
}
|
||||
}
|
||||
HorizontalLayoutRef();
|
||||
HorizontalLayoutRef(LayoutRef l);
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2);
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3);
|
||||
HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3, LayoutRef l4);
|
||||
HorizontalLayoutRef(const LayoutRef * children, size_t numberOfChildren);
|
||||
void addChildAtIndex(LayoutReference l, int index, int currentNumberOfChildren, LayoutCursor * cursor) override {
|
||||
LayoutReference::addChildAtIndex(l, index, currentNumberOfChildren, cursor);
|
||||
}
|
||||
|
||||
@@ -68,18 +68,10 @@ private:
|
||||
|
||||
class NthRootLayoutRef : public LayoutReference {
|
||||
public:
|
||||
NthRootLayoutRef(LayoutRef radicand) : NthRootLayoutRef() {
|
||||
replaceChildAtIndexInPlace(0, radicand);
|
||||
}
|
||||
|
||||
NthRootLayoutRef(LayoutRef radicand, LayoutRef index) : NthRootLayoutRef() {
|
||||
replaceChildAtIndexInPlace(0, radicand);
|
||||
addChildAtIndexInPlace(index, 1, 1);
|
||||
static_cast<NthRootLayoutNode *>(node())->setNumberOfChildren(2);
|
||||
}
|
||||
|
||||
NthRootLayoutRef(LayoutRef radicand);
|
||||
NthRootLayoutRef(LayoutRef radicand, LayoutRef index);
|
||||
private:
|
||||
NthRootLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<NthRootLayoutNode>()) {}
|
||||
NthRootLayoutRef();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
|
||||
class RightParenthesisLayoutRef : public LayoutReference {
|
||||
public:
|
||||
RightParenthesisLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<RightParenthesisLayoutNode>()) {}
|
||||
RightParenthesisLayoutRef();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ protected:
|
||||
|
||||
class RightSquareBracketLayoutRef : public LayoutReference {
|
||||
public:
|
||||
RightSquareBracketLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<RightSquareBracketLayoutNode>()) {}
|
||||
|
||||
|
||||
RightSquareBracketLayoutRef();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -59,12 +59,7 @@ private:
|
||||
|
||||
class VerticalOffsetLayoutRef : public LayoutReference {
|
||||
public:
|
||||
VerticalOffsetLayoutRef(LayoutRef l, VerticalOffsetLayoutNode::Type type) :
|
||||
LayoutReference(TreePool::sharedPool()->createTreeNode<VerticalOffsetLayoutNode>())
|
||||
{
|
||||
static_cast<VerticalOffsetLayoutNode *>(node())->setType(type);
|
||||
replaceChildAtIndexInPlace(0,l);
|
||||
}
|
||||
VerticalOffsetLayoutRef(LayoutRef l, VerticalOffsetLayoutNode::Type type);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -350,6 +350,33 @@ bool HorizontalLayoutNode::willReplaceChild(LayoutNode * oldChild, LayoutNode *
|
||||
|
||||
// HorizontalLayoutRef
|
||||
|
||||
HorizontalLayoutRef::HorizontalLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<HorizontalLayoutNode>()) {}
|
||||
|
||||
HorizontalLayoutRef::HorizontalLayoutRef(LayoutRef l) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l, 0, 0);
|
||||
}
|
||||
|
||||
HorizontalLayoutRef::HorizontalLayoutRef(LayoutRef l1, LayoutRef l2) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
}
|
||||
HorizontalLayoutRef::HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
addChildAtIndexInPlace(l3, 2, 2);
|
||||
}
|
||||
HorizontalLayoutRef::HorizontalLayoutRef(LayoutRef l1, LayoutRef l2, LayoutRef l3, LayoutRef l4) : HorizontalLayoutRef() {
|
||||
addChildAtIndexInPlace(l1, 0, 0);
|
||||
addChildAtIndexInPlace(l2, 1, 1);
|
||||
addChildAtIndexInPlace(l3, 2, 2);
|
||||
addChildAtIndexInPlace(l4, 3, 3);
|
||||
}
|
||||
HorizontalLayoutRef::HorizontalLayoutRef(const LayoutRef * children, size_t numberOfChildren) : HorizontalLayoutRef() {
|
||||
for (size_t i = 0; i < numberOfChildren; i++) {
|
||||
addChildAtIndexInPlace(children[i], i, i);
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayoutRef::addOrMergeChildAtIndex(LayoutRef l, int index, bool removeEmptyChildren, LayoutCursor * cursor) {
|
||||
if (l.isHorizontal()) {
|
||||
mergeChildrenAtIndex(HorizontalLayoutRef(static_cast<HorizontalLayoutNode *>(l.node())), index, removeEmptyChildren, cursor);
|
||||
|
||||
@@ -269,4 +269,16 @@ void NthRootLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionCol
|
||||
}
|
||||
}
|
||||
|
||||
NthRootLayoutRef::NthRootLayoutRef(LayoutRef radicand) : NthRootLayoutRef() {
|
||||
replaceChildAtIndexInPlace(0, radicand);
|
||||
}
|
||||
|
||||
NthRootLayoutRef::NthRootLayoutRef(LayoutRef radicand, LayoutRef index) : NthRootLayoutRef() {
|
||||
replaceChildAtIndexInPlace(0, radicand);
|
||||
addChildAtIndexInPlace(index, 1, 1);
|
||||
static_cast<NthRootLayoutNode *>(node())->setNumberOfChildren(2);
|
||||
}
|
||||
|
||||
NthRootLayoutRef::NthRootLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<NthRootLayoutNode>()) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,11 +59,6 @@ void RightParenthesisLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expr
|
||||
RenderWithChildHeight(ParenthesisLayoutNode::ChildHeightGivenLayoutHeight(layoutSize().height()), ctx, p, expressionColor, backgroundColor);
|
||||
}
|
||||
|
||||
RightParenthesisLayoutRef::RightParenthesisLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<RightParenthesisLayoutNode>()) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,4 +8,6 @@ void RightSquareBracketLayoutNode::render(KDContext * ctx, KDPoint p, KDColor ex
|
||||
ctx->fillRect(KDRect(p.x()+k_widthMargin-k_bracketWidth+1, p.y() + childHeight(), k_bracketWidth, k_lineThickness), expressionColor);
|
||||
}
|
||||
|
||||
RightSquareBracketLayoutRef::RightSquareBracketLayoutRef() : LayoutReference(TreePool::sharedPool()->createTreeNode<RightSquareBracketLayoutNode>()) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -271,4 +271,11 @@ LayoutNode * VerticalOffsetLayoutNode::baseLayout() {
|
||||
return parentNode->childAtIndex(idxInParent - 1);
|
||||
}
|
||||
|
||||
VerticalOffsetLayoutRef::VerticalOffsetLayoutRef(LayoutRef l, VerticalOffsetLayoutNode::Type type) :
|
||||
LayoutReference(TreePool::sharedPool()->createTreeNode<VerticalOffsetLayoutNode>())
|
||||
{
|
||||
static_cast<VerticalOffsetLayoutNode *>(node())->setType(type);
|
||||
replaceChildAtIndexInPlace(0,l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user