Changed: Expand/collapse all tree node childs with right click

--HG--
branch : develop
hg/compatibility-develop
Nimetu 7 years ago
parent 575f58d749
commit 6b7617f8e1

@ -97,6 +97,7 @@ namespace NLGUI
void addChildSortedByBitmap(SNode *pNode); void addChildSortedByBitmap(SNode *pNode);
void setParentTree(CGroupTree *parent); void setParentTree(CGroupTree *parent);
void setFather(SNode *father); void setFather(SNode *father);
void openAll();
void closeAll(); void closeAll();
void makeOrphan(); void makeOrphan();
bool parse (xmlNodePtr cur, CGroupTree *parentGroup); bool parse (xmlNodePtr cur, CGroupTree *parentGroup);

@ -271,6 +271,14 @@ namespace NLGUI
pNode->setFather(this); pNode->setFather(this);
} }
// ----------------------------------------------------------------------------
void CGroupTree::SNode::openAll()
{
Opened = true;
for (uint i = 0; i < Children.size(); ++i)
Children[i]->openAll();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupTree::SNode::closeAll() void CGroupTree::SNode::closeAll()
{ {
@ -1082,7 +1090,9 @@ namespace NLGUI
} }
} }
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown) bool toggleOne = (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown);
bool toggleAll = (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown);
if (toggleOne || toggleAll)
{ {
// line selection // line selection
if (bText) if (bText)
@ -1118,6 +1128,13 @@ namespace NLGUI
{ {
// open/close the node // open/close the node
changedNode->Opened = !changedNode->Opened; changedNode->Opened = !changedNode->Opened;
if (toggleAll)
{
if (changedNode->Opened)
changedNode->openAll();
else
changedNode->closeAll();
}
} }
// else must close all necessary nodes. // else must close all necessary nodes.
else else

Loading…
Cancel
Save