Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
etorth committed Nov 19, 2024
1 parent b15169b commit 2faee9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
20 changes: 12 additions & 8 deletions client/src/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,27 @@ void WidgetTreeNode::execDeath() noexcept
onDeath();
}

void WidgetTreeNode::addChild(Widget *widget, bool autoDelete)
void WidgetTreeNode::doAddChild(Widget *argWidget, bool argAutoDelete)
{
fflassert(widget);
WidgetTreeNode *treeNode = widget;
fflassert(argWidget);
WidgetTreeNode *treeNode = argWidget;

if(treeNode->m_parent){
treeNode->m_parent->removeChild(widget, false);
treeNode->m_parent->removeChild(argWidget, false);
}

treeNode->m_parent = static_cast<Widget *>(this);
m_childList.emplace_back(widget, autoDelete);
m_childList.emplace_back(argWidget, argAutoDelete);
}

void WidgetTreeNode::addChildAt(Widget *argWidget, Widget::VarDir argDir, Widget::VarOff argX, Widget::VarOff argY, bool argAutoDelete)
void WidgetTreeNode::addChild(Widget *argWidget, bool argAutoDelete)
{
fflassert(argWidget);
addChild(argWidget, argAutoDelete);
doAddChild(argWidget, argAutoDelete);
}

void WidgetTreeNode::addChildAt(Widget *argWidget, WidgetTreeNode::VarDir argDir, WidgetTreeNode::VarOff argX, WidgetTreeNode::VarOff argY, bool argAutoDelete)
{
doAddChild(argWidget, argAutoDelete);
argWidget->moveAt(std::move(argDir), std::move(argX), std::move(argY));
}

Expand Down
5 changes: 4 additions & 1 deletion client/src/widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ class WidgetTreeNode // tree concept, used by class Widget only

public:
virtual void purge();
virtual void removeChild(Widget *, bool);
virtual void removeChild(Widget *, bool) final;

private:
virtual void doAddChild(Widget *, bool) final;

public:
virtual void addChild (Widget *, bool);
Expand Down

0 comments on commit 2faee9d

Please sign in to comment.