1 - Moved settingsdlg.[h,cpp] and wxinfo.[h,cpp] to demo where they belong
2 - removed pf_sample from library - this was test code 3 - modified newbmpbutton to create all button images once at initial creation 4 - newbmpbutton only refreses when necessary 5 - non-msw platforms may now disable (enable(FALSE)) a button - this will half-grey the image and draw text in disabled color. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
159
utils/framelayout/samples/demo/wxinfo.cpp
Normal file
159
utils/framelayout/samples/demo/wxinfo.cpp
Normal file
@@ -0,0 +1,159 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 23/11/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: 1998 (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "wxinifo.cpp"
|
||||
#pragma interface "wxinifo.cpp"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/hash.h"
|
||||
#include "wxinfo.h"
|
||||
|
||||
inline static void expand_item( wxTreeCtrl* pTree, wxTreeItemId& itemId )
|
||||
{
|
||||
pTree->Expand( itemId );
|
||||
}
|
||||
|
||||
void wxCreateClassInfoTree( wxTreeCtrl* pTree,
|
||||
wxTreeItemId parentBranchId,
|
||||
long classImageNo
|
||||
)
|
||||
{
|
||||
expand_item( pTree, parentBranchId );
|
||||
|
||||
wxHashTable hash;
|
||||
|
||||
wxList lst;
|
||||
|
||||
// collect all classes into list
|
||||
|
||||
{
|
||||
wxClassInfo* pCur = wxClassInfo::GetFirst();
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
while( pCur )
|
||||
{
|
||||
lst.Append( (wxObject*)pCur );
|
||||
|
||||
pCur = pCur->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
// reflect class-hierarchy into the tree nodes
|
||||
|
||||
int nHanged;
|
||||
|
||||
do
|
||||
{
|
||||
nHanged = 0;
|
||||
|
||||
wxNode* pCur = lst.First();
|
||||
|
||||
// repeat passes through class list, untill all of
|
||||
// the class items are "hanged" onto their parent-items in the tree
|
||||
|
||||
while( pCur )
|
||||
{
|
||||
wxClassInfo& info = *((wxClassInfo*)pCur->Data());
|
||||
|
||||
if ( info.GetBaseClass1() == NULL )
|
||||
{
|
||||
// parentless classes are put into the root branch
|
||||
|
||||
wxTreeItemId* pId = new wxTreeItemId();
|
||||
*pId = pTree->AppendItem( parentBranchId, info.GetClassName(), classImageNo );
|
||||
|
||||
expand_item( pTree, *pId );
|
||||
|
||||
// "remember" it
|
||||
hash.Put( long(&info), (wxObject*)pId );
|
||||
|
||||
// class is "hanged", remove it from the list
|
||||
wxNode* pTmp = pCur;
|
||||
|
||||
pCur = pCur->Next();
|
||||
|
||||
delete pTmp;
|
||||
|
||||
++nHanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxTreeItemId* pParentId = (wxTreeItemId*)hash.Get( (long)info.GetBaseClass1() );
|
||||
|
||||
if ( pParentId != NULL )
|
||||
{
|
||||
wxTreeItemId* pId = new wxTreeItemId();
|
||||
|
||||
*pId = pTree->AppendItem( *pParentId, info.GetClassName(), classImageNo );
|
||||
|
||||
expand_item( pTree, *pId );
|
||||
|
||||
hash.Put( long(&info), (wxObject*)pId );
|
||||
|
||||
wxNode* pTmp = pCur;
|
||||
|
||||
pCur = pCur->Next();
|
||||
|
||||
// class is "hanged", remove it from the list
|
||||
delete pTmp;
|
||||
|
||||
++nHanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise there's a parent, but it's not in the tree yet...
|
||||
// hope to "hang" it in the subsequent passes
|
||||
|
||||
pCur = pCur->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while( nHanged != 0 );
|
||||
}
|
||||
|
||||
void wxCreateSerializerInfoTree( wxTreeCtrl* pTree,
|
||||
wxTreeItemId parentBranchId,
|
||||
long classImageNo
|
||||
)
|
||||
{
|
||||
expand_item( pTree, parentBranchId );
|
||||
|
||||
wxSerializerInfo::InitializeSerializers();
|
||||
|
||||
// FOR NOW:: no hierarchy - one branch
|
||||
|
||||
wxSerializerInfo* pCur = wxSerializerInfo::first;
|
||||
|
||||
while( pCur )
|
||||
{
|
||||
wxString fullName = pCur->className + wxString( "Serializer" );
|
||||
|
||||
pTree->AppendItem( parentBranchId, fullName, classImageNo );
|
||||
|
||||
pCur = pCur->next;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user