1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
8 // Copyright: 1998 (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "wxinifo.cpp"
14 #pragma interface "wxinifo.cpp"
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
31 inline static void expand_item( wxTreeCtrl
* pTree
, wxTreeItemId
& itemId
)
33 pTree
->Expand( itemId
);
36 void wxCreateClassInfoTree( wxTreeCtrl
* pTree
,
37 wxTreeItemId parentBranchId
,
41 expand_item( pTree
, parentBranchId
);
47 // collect all classes into list
50 wxClassInfo
* pCur
= wxClassInfo::GetFirst();
52 wxClassInfo::InitializeClasses();
56 lst
.Append( (wxObject
*)pCur
);
58 pCur
= pCur
->GetNext();
62 wxClassInfo::InitializeClasses();
64 // reflect class-hierarchy into the tree nodes
72 wxNode
* pCur
= lst
.First();
74 // repeat passes through class list, untill all of
75 // the class items are "hanged" onto their parent-items in the tree
79 wxClassInfo
& info
= *((wxClassInfo
*)pCur
->Data());
81 if ( info
.GetBaseClass1() == NULL
)
83 // parentless classes are put into the root branch
85 wxTreeItemId
* pId
= new wxTreeItemId();
86 *pId
= pTree
->AppendItem( parentBranchId
, info
.GetClassName(), classImageNo
);
88 expand_item( pTree
, *pId
);
91 hash
.Put( long(&info
), (wxObject
*)pId
);
93 // class is "hanged", remove it from the list
104 wxTreeItemId
* pParentId
= (wxTreeItemId
*)hash
.Get( (long)info
.GetBaseClass1() );
106 if ( pParentId
!= NULL
)
108 wxTreeItemId
* pId
= new wxTreeItemId();
110 *pId
= pTree
->AppendItem( *pParentId
, info
.GetClassName(), classImageNo
);
112 expand_item( pTree
, *pId
);
114 hash
.Put( long(&info
), (wxObject
*)pId
);
120 // class is "hanged", remove it from the list
127 // otherwise there's a parent, but it's not in the tree yet...
128 // hope to "hang" it in the subsequent passes
135 } while( nHanged
!= 0 );