added add split button

This commit is contained in:
fourtf
2018-09-04 21:39:54 +02:00
parent 3f4e9cdf91
commit 1d682c4a93
17 changed files with 169 additions and 96 deletions
+25
View File
@@ -310,8 +310,33 @@ void SplitContainer::focusSplitRecursive(Node *node, Direction direction)
}
}
Split *SplitContainer::getTopRightSplit(Node &node)
{
switch (node.getType()) {
case Node::_Split:
return node.getSplit();
case Node::VerticalContainer:
if (!node.getChildren().empty())
return getTopRightSplit(*node.getChildren().front());
break;
case Node::HorizontalContainer:
if (!node.getChildren().empty())
return getTopRightSplit(*node.getChildren().back());
break;
default:;
}
return nullptr;
}
void SplitContainer::layout()
{
// update top right split
auto topRight = this->getTopRightSplit(this->baseNode_);
if (this->topRight_) this->topRight_->setIsTopRightSplit(false);
this->topRight_ = topRight;
if (topRight) this->topRight_->setIsTopRightSplit(true);
// layout
this->baseNode_.geometry_ = this->rect().adjusted(-1, -1, 0, 0);
std::vector<DropRect> _dropRects;