linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05847
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2995: minor virtual tree changes
------------------------------------------------------------
revno: 2995
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2012-07-12 23:32:03 +0200
message:
minor virtual tree changes
modified:
dwt/include/dwt/widgets/VirtualTree.h
dwt/src/widgets/VirtualTree.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/VirtualTree.h'
--- dwt/include/dwt/widgets/VirtualTree.h 2012-07-12 20:49:11 +0000
+++ dwt/include/dwt/widgets/VirtualTree.h 2012-07-12 21:32:03 +0000
@@ -80,7 +80,6 @@
Item* next;
Item* firstChild;
Item* lastChild;
- UINT mask;
UINT state;
boost::optional<tstring> text;
int image;
=== modified file 'dwt/src/widgets/VirtualTree.cpp'
--- dwt/src/widgets/VirtualTree.cpp 2012-07-12 20:49:11 +0000
+++ dwt/src/widgets/VirtualTree.cpp 2012-07-12 21:32:03 +0000
@@ -66,7 +66,7 @@
}
case TVM_GETCOUNT:
{
- retVal = items.size();
+ retVal = items.size() - 1; // don't count the fake root
return true;
}
case TVM_GETITEM:
@@ -139,7 +139,6 @@
next(nullptr),
firstChild(nullptr),
lastChild(nullptr),
- mask(0),
state(TVIS_EXPANDED),
image(0),
selectedImage(0),
@@ -154,7 +153,6 @@
next(nullptr),
firstChild(nullptr),
lastChild(nullptr),
- mask(tvis.itemex.mask),
state(tvis.itemex.state & tvis.itemex.stateMask),
image(tvis.itemex.iImage),
selectedImage(tvis.itemex.iSelectedImage),
@@ -245,11 +243,14 @@
bool VirtualTree::handleDelete(LPARAM lParam) {
if(!lParam || lParam == reinterpret_cast<LPARAM>(TVI_ROOT)) {
+ // delete all items.
bool ret = sendTreeMsg(TVM_DELETEITEM, 0, lParam);
items.clear();
addRoot();
return ret;
}
+
+ // delete one item.
auto item = reinterpret_cast<Item*>(lParam);
if(!validate(item)) { return false; }
hide(*item);
@@ -283,6 +284,7 @@
case TVE_COLLAPSE:
{
if(item->expanded()) { item->state &= ~TVIS_EXPANDED; }
+ // remove children of this item when collapsing it.
auto child = item->firstChild;
while(child) {
hide(*child);
@@ -309,6 +311,7 @@
}
case TVE_EXPAND:
{
+ // add direct children of this item before expanding it.
auto child = item->firstChild;
while(child) {
display(*child);
@@ -470,6 +473,7 @@
}
void VirtualTree::updateChildDisplay(Item* item) {
+ // this determines whether the item has a +/- sign next to it.
if(!item->handle) { return; }
TVITEMEX tv = { TVIF_CHILDREN, item->handle };
tv.cChildren = item->firstChild ? 1 : 0;