mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Reworked how set_tree works.
This commit is contained in:
parent
f498628ee1
commit
bde46b20cd
@ -65,33 +65,31 @@ void Node::remove_child(Node *child) {
|
||||
}
|
||||
|
||||
NodeTree *Node::get_tree() {
|
||||
if (!_tree) {
|
||||
}
|
||||
|
||||
return _tree;
|
||||
}
|
||||
|
||||
void Node::set_tree(NodeTree *tree) {
|
||||
if (_tree) {
|
||||
notification(NOTIFICATION_EXIT_TREE);
|
||||
_in_tree = false;
|
||||
_notification(NOTIFICATION_EXIT_TREE);
|
||||
}
|
||||
|
||||
_tree = tree;
|
||||
|
||||
if (_tree) {
|
||||
notification(NOTIFICATION_ENTER_TREE);
|
||||
_in_tree = true;
|
||||
_notification(NOTIFICATION_ENTER_TREE);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
_children[i]->set_tree(tree);
|
||||
}
|
||||
}
|
||||
|
||||
void Node::notification(const int what) {
|
||||
switch (what) {
|
||||
case NOTIFICATION_EXIT_TREE:
|
||||
_in_tree = false;
|
||||
break;
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
_in_tree = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_notification(what);
|
||||
|
||||
for (int i = 0; i < _children.size(); ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user