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 setParentTree(CGroupTree *parent);
void setFather(SNode *father);
void openAll();
void closeAll();
void makeOrphan();
bool parse (xmlNodePtr cur, CGroupTree *parentGroup);

@ -271,6 +271,14 @@ namespace NLGUI
pNode->setFather(this);
}
// ----------------------------------------------------------------------------
void CGroupTree::SNode::openAll()
{
Opened = true;
for (uint i = 0; i < Children.size(); ++i)
Children[i]->openAll();
}
// ----------------------------------------------------------------------------
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
if (bText)
@ -1118,6 +1128,13 @@ namespace NLGUI
{
// open/close the node
changedNode->Opened = !changedNode->Opened;
if (toggleAll)
{
if (changedNode->Opened)
changedNode->openAll();
else
changedNode->closeAll();
}
}
// else must close all necessary nodes.
else

Loading…
Cancel
Save