More understandable symbolic constants in generic wxDVC's DoJob class.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2011-08-27 16:44:47 +00:00
parent e1f30123c9
commit d54f0605a9

View File

@ -1959,10 +1959,13 @@ public:
virtual ~DoJob() { } virtual ~DoJob() { }
// The return value control how the tree-walker tranverse the tree // The return value control how the tree-walker tranverse the tree
// 0: Job done, stop tranverse and return enum
// 1: Ignore the current node's subtree and continue {
// 2: Job not done, continue DONE, // Job done, stop traversing and return
enum { OK = 0 , IGR = 1, CONT = 2 }; SKIP_SUBTREE, // Ignore the current node's subtree and continue
CONTINUE // Job not done, continue
};
virtual int operator() ( wxDataViewTreeNode * node ) = 0; virtual int operator() ( wxDataViewTreeNode * node ) = 0;
}; };
@ -1972,11 +1975,11 @@ bool Walker( wxDataViewTreeNode * node, DoJob & func )
switch( func( node ) ) switch( func( node ) )
{ {
case DoJob::OK: case DoJob::DONE:
return true; return true;
case DoJob::IGR: case DoJob::SKIP_SUBTREE:
return false; return false;
case DoJob::CONT: case DoJob::CONTINUE:
break; break;
} }
@ -2761,13 +2764,13 @@ public:
if( current == static_cast<int>(row)) if( current == static_cast<int>(row))
{ {
ret = node; ret = node;
return DoJob::OK; return DoJob::DONE;
} }
if( node->GetSubTreeCount() + current < static_cast<int>(row) ) if( node->GetSubTreeCount() + current < static_cast<int>(row) )
{ {
current += node->GetSubTreeCount(); current += node->GetSubTreeCount();
return DoJob::IGR; return DoJob::SKIP_SUBTREE;
} }
else else
{ {
@ -2781,10 +2784,10 @@ public:
{ {
const int index = static_cast<int>(row) - current - 1; const int index = static_cast<int>(row) - current - 1;
ret = node->GetChildNodes()[index]; ret = node->GetChildNodes()[index];
return DoJob::OK; return DoJob::DONE;
} }
return DoJob::CONT; return DoJob::CONTINUE;
} }
} }
@ -3168,18 +3171,18 @@ public:
ret ++; ret ++;
if( node->GetItem() == item ) if( node->GetItem() == item )
{ {
return DoJob::OK; return DoJob::DONE;
} }
if( node->GetItem() == *m_iter ) if( node->GetItem() == *m_iter )
{ {
m_iter++; m_iter++;
return DoJob::CONT; return DoJob::CONTINUE;
} }
else else
{ {
ret += node->GetSubTreeCount(); ret += node->GetSubTreeCount();
return DoJob::IGR; return DoJob::SKIP_SUBTREE;
} }
} }