[wx-dev] Re: CVS: [RD] wxWidgets/src/generic treectlg.cpp, 1.197, 1.198

Robin Dunn robin at alldunn.com
Mon Jul 3 14:52:16 PDT 2006


Vadim Zeitlin wrote:

>>  
>> -void wxGenericTreeCtrl::ExpandAll(const wxTreeItemId& item)
>> -{
>> -    if ( !HasFlag(wxTR_HIDE_ROOT) || item != GetRootItem())
>> -    {
>> -        Expand(item);
>> -        if ( !IsExpanded(item) )
>> -            return;
>> -    }
>> -
>> -    wxTreeItemIdValue cookie;
>> -    wxTreeItemId child = GetFirstChild(item, cookie);
>> -    while ( child.IsOk() )
>> -    {
>> -        ExpandAll(child);
>> -
>> -        child = GetNextChild(item, cookie);
>> -    }
>> -}
> 
>  But the new code is not exactly the same as the old. The first part of the
> function is missing in the new version. I don't really understand what does
> it do though so I'm not sure if it's needed or not?

I don't know either.


> 
>>  void wxGenericTreeCtrl::Collapse(const wxTreeItemId& itemId)
>>  {
>>      wxCHECK_RET( !HasFlag(wxTR_HIDE_ROOT) || itemId != GetRootItem(),
>> @@ -2620,7 +2601,7 @@
>>              if ( !IsExpanded(m_current) )
>>              {
>>                  // expand all
>> -                ExpandAll(m_current);
>> +                ExpandAllChildren(m_current);
> 
>  Also, maybe it would be better to rename the new methods to keep the same
> meaning to minimize confusion? E.g. rename ExpandAllChildren() to
> ExpandAll() and rename ExpandAll() to ExpandAllItems()?

My assumption was that since ExpandAll didn't exist before in the wxMSW 
class then it was most likely only used internally in the generic 
version, and so it was safe to just change it to ExpandAllChildren where 
it was used in wxGenericTreeCtrl and not worry about compatibility. 
However I'm okay with changing the names as you describe if that is what 
is decided to be the best.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wx-dev mailing list