Beispiel #1
0
//---------------------------------------------------------
bool CACTIVE_History::_Set_History(void)
{
	Freeze();

	DeleteAllItems();

	CSG_Data_Object	*pObject	= _Get_Object();

	if( pObject == NULL || pObject->Get_History().Get_Children_Count() <= 0 )
	{
		AddRoot(_TL("no history"), IMG_ROOT);
	}
	else if( SG_Compare_Version(pObject->Get_History().Get_Property("saga-version"), "2.1.3") >= 0 )	// new version
	{
		_Add_History(AddRoot(pObject->Get_Name(), IMG_ROOT), pObject->Get_History());
	}
	else
	{
		_Add_History_OLD(AddRoot(pObject->Get_Name(), IMG_ROOT), pObject->Get_History());
	}

	Expand(GetRootItem());

	Thaw();

	return( true );
}
Beispiel #2
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    ui->treeWidget->setColumnCount(2);
    ui->treeWidget->setHeaderLabels(QStringList() << "one" <<"two");
    AddRoot("1. Hello", "World");
    AddRoot("2. Hello", "World");
    AddRoot("3. Hello", "World");
}
//============================================================================
// TreeView
//============================================================================
wxGD::TreeView::TreeView( Handler *handler, wxWindow *parent )
:
wxTreeCtrl( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
                    wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT ),
m_handler( handler )
{
    wxImageList *imageList = m_handler->GetLargeImageList();
    if( !imageList )
        return;

    SetImageList( imageList );

    int imageIndex = ArtProvider::GetItemImageListIndex( "controls", "Project" );

    AddRoot( "Project", imageIndex );

    Bind( wxEVT_COMMAND_TREE_BEGIN_DRAG,        &TreeView::OnBeginDrag,     this );
    Bind( wxEVT_COMMAND_TREE_END_DRAG,          &TreeView::OnEndDrag,       this );
    Bind( wxEVT_COMMAND_TREE_ITEM_COLLAPSED,    &TreeView::OnItemCollapsed, this );
    Bind( wxEVT_COMMAND_TREE_ITEM_EXPANDED,     &TreeView::OnItemExpanded,  this );
    Bind( wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,  &TreeView::OnItemRightClick,this );
    Bind( wxEVT_COMMAND_TREE_SEL_CHANGED,       &TreeView::OnSelChanged,    this );

    Bind( wxGD_EVT_OBJECT_CREATED, &TreeView::OnObjectCreated, this );
}
Beispiel #4
0
bool wxGxTreeViewBase::Activate(IApplication* const pApplication, wxXmlNode* const pConf)
{
	if(!wxGxView::Activate(pApplication, pConf))
		return false;

    wxGxApplicationBase* pGxApp = dynamic_cast<wxGxApplicationBase*>(pApplication);
    if(NULL == pGxApp)
        return false;
    m_pSelection = pGxApp->GetGxSelection();

    m_pApp = dynamic_cast<wxGISApplicationBase*>(pApplication);
    if(NULL == m_pApp)
        return false;
 
    if(!GetGxCatalog())
		return false;
    m_pCatalog = wxDynamicCast(GetGxCatalog(), wxGxCatalogUI);

    //delete
    m_pDeleteCmd = m_pApp->GetCommand(wxT("wxGISCatalogMainCmd"), 4);
	//new
	m_pNewMenu = dynamic_cast<wxGISNewMenu*>(m_pApp->GetCommandBar(NEWMENUNAME));

    AddRoot(m_pCatalog);

    m_ConnectionPointCatalogCookie = m_pCatalog->Advise(this);

    if(m_pSelection)
        m_ConnectionPointSelectionCookie = m_pSelection->Advise(this);
	return true;
};
Beispiel #5
0
void DirectoryTree::InitTree()
  {
  wxLogTrace(DIRECTORYTREE_EVENTS, wxT("InitTree()"));
  DeleteAllItems();

#ifdef __UNIX
  wxTreeItemId tidRoot = AddChild(wxTreeItemId(), FILE_SYSTEM_ROOT);
#elif _WINDOWS
  wxTreeItemId tidRoot = AddRoot(FILE_SYSTEM_ROOT, 0, 1, NULL);
#endif // OS
	if(!tidRoot.IsOk())
    {
    wxLogDebug(wxT("DirectoryTree::InitTree(): AddRoot() failed."));
    return; 
    }

#ifdef _WINDOWS
  // Enumerate the system volumes
  TCHAR szDrives[0x200];
  DWORD dwTotalLength = GetLogicalDriveStrings(0x200 * sizeof(TCHAR), szDrives);
  DWORD dwOffset = 0;
  while(dwOffset < dwTotalLength)
    {
    TCHAR * szDrive = szDrives + dwOffset;
    wxString sDrive(szDrive);
    AddChild(tidRoot, sDrive);

    DWORD dwLength = wcslen(szDrive);
    dwOffset += dwLength + 1;
    }
#endif // OS
  }
Beispiel #6
0
CRemoteTreeView::CRemoteTreeView(wxWindow* parent, wxWindowID id, CState* pState, CQueueView* pQueue)
	: wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER | wxTR_HIDE_ROOT),
	CSystemImageList(16),
	CStateEventHandler(pState)
{
#ifdef __WXMAC__
	SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
#endif

	pState->RegisterHandler(this, STATECHANGE_REMOTE_DIR);
	pState->RegisterHandler(this, STATECHANGE_APPLYFILTER);

	CreateImageList();

	UpdateSortMode();
	RegisterOption(OPTION_FILELIST_NAMESORT);

	m_busy = false;
	m_pQueue = pQueue;
	AddRoot(_T(""));
	m_ExpandAfterList = wxTreeItemId();

	SetDropTarget(new CRemoteTreeViewDropTarget(this));

	Enable(false);
}
WidgetImageSelector::WidgetImageSelector( QString &imageData ,QWidget *parent) :
    QDialog(parent),
    imageDataRef(imageData),
    ui(new Ui::WidgetImageSelector)
{
    ui->setupUi(this);

    int selectTopItem;

    //Set columns count
    ui->WidgetImageSelectorTreeWidget->setColumnCount(3);
    if(QTreeWidgetItem* header = ui->WidgetImageSelectorTreeWidget->headerItem()) {
      header->setText(0, SET_COLUMN_ZERO_HEADER_TEXT);
      header->setText(1, SET_COLUMN_ONE_HEADER_TEXT);
      header->setText(2, SET_COLUMN_TWO_HEADER_TEXT);
    }
    /*Resize columns to content
    for(int i = 0; i < 3; i++){
        ui->WidgetImageSelectorTreeWidget->resizeColumnToContents(i);
    }*/
    AddRoot();

    // Select the image
    if(imageData != NULL)
    {
        selectTopItem = imageData.toInt() - 1u;
    }
    else
    {
        selectTopItem = 94 - 1u;
    }

    // Select the top level Item
    ui->WidgetImageSelectorTreeWidget->setCurrentItem(ui->WidgetImageSelectorTreeWidget->topLevelItem(selectTopItem));
}
Beispiel #8
0
void PHPOutlineTree::BuildTree(const wxFileName& filename)
{
    m_filename = filename;
    PHPSourceFile sourceFile(filename, NULL);
    sourceFile.SetParseFunctionBody(false);
    sourceFile.Parse();
    wxWindowUpdateLocker locker(this);
    DeleteAllItems();

    wxTreeItemId root = AddRoot(wxT("Root"));

    wxImageList* images = new wxImageList(clGetScaledSize(16), clGetScaledSize(16), true);
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/globals")));            // 0
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_private")));   // 1
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_protected"))); // 2
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_public")));    // 3
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_private")));     // 4
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_protected")));   // 5
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_public")));      // 6
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/namespace")));          // 7
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/class")));              // 8
    images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/enumerator")));         // 9
    AssignImageList(images);

    // Build the tree view
    BuildTree(root, sourceFile.Namespace());

    if(HasChildren(GetRootItem())) {
        ExpandAll();
    }
}
Beispiel #9
0
CLocalTreeView::CLocalTreeView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueueView)
	: wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER),
	CSystemImageList(16),
	CStateEventHandler(pState),
	m_pQueueView(pQueueView)
{
	wxGetApp().AddStartupProfileRecord(_T("CLocalTreeView::CLocalTreeView"));
#ifdef __WXMAC__
	SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
#endif

	pState->RegisterHandler(this, STATECHANGE_LOCAL_DIR);
	pState->RegisterHandler(this, STATECHANGE_APPLYFILTER);

	SetImageList(GetSystemImageList());

#ifdef __WXMSW__
	m_pVolumeEnumeratorThread = 0;

	CreateRoot();
#else
	wxTreeItemId root = AddRoot(_T("/"));
	SetItemImage(root, GetIconIndex(dir), wxTreeItemIcon_Normal);
	SetItemImage(root, GetIconIndex(opened_dir), wxTreeItemIcon_Selected);
	SetItemImage(root, GetIconIndex(dir), wxTreeItemIcon_Expanded);
	SetItemImage(root, GetIconIndex(opened_dir), wxTreeItemIcon_SelectedExpanded);

	SetDir(_T("/"));
#endif

	SetDropTarget(new CLocalTreeViewDropTarget(this));
}
Beispiel #10
0
void
NSBrowserTreeCtrl::build_tree()
{
	// resolve name service reference
	int dummy = 0;
	CORBA::ORB_var orb = CORBA::ORB_init(dummy,0);

	std::string ns;
	ns = Qedo::ConfigurationReader::instance()->lookup_config_value( "/General/NameService" );;
	//ns = "corbaloc::tri:12356/NameService";
	CORBA::Object_var obj;
	obj = orb -> string_to_object( ns.c_str() );
	CreateImageList();


	try {
		nameService = CosNaming::NamingContext::_narrow(obj.in());
	} catch (CORBA::SystemException) {};
	if (!CORBA::is_nil(nameService))
	{
    wxTreeItemId rootId = AddRoot(wxT("RootContext"),
                                  TreeCtrlIcon_FolderOpened , TreeCtrlIcon_Folder ,
                                  new NSBrowserTreeItemData(wxT("Root item")));

		 AddItemsRecursively(rootId, nameService);
	}
}
Beispiel #11
0
TestTree::TestTree(wxWindow* parent, wxWindowID id, const wxPoint& pt,
        const wxSize& sz, long style):
        wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style)
{
    m_imageList = new wxImageList(16, 16, true);
#if !defined(__WXMSW__) // || wxUSE_XPM_IN_MSW
    m_imageList->Add(wxIcon(icon1_xpm));
    m_imageList->Add(wxIcon(icon2_xpm));
#elif defined(__WXMSW__)
    m_imageList->Add(wxIcon(wxT("wxICON_SMALL_CLOSED_FOLDER"), wxBITMAP_TYPE_ICO_RESOURCE));
    m_imageList->Add(wxIcon(wxT("wxICON_SMALL_FILE"), wxBITMAP_TYPE_ICO_RESOURCE));
#else
#error "Sorry, we don't have icons available for this platforms."
#endif
    SetImageList(m_imageList);


    // Add some dummy items
    wxTreeItemId rootId = AddRoot(_("Root"), -1, -1);
    int i;
    for (i = 1; i <= 20; i++)
    {
        wxString label;
        label.Printf(wxT("Item %d"), i);
        wxTreeItemId id = AppendItem(rootId, label, 0);
        //SetItemImage( id, 1, wxTreeItemIcon_Expanded );

        int j;
        for (j = 0; j < 10; j++)
            AppendItem(id, _("Child"), 1);
    }
    Expand(rootId);
}
Beispiel #12
0
//----------------------------------------
wxTreeItemId CDatasetTreeCtrl::AddItemToTree(const wxString& datasetName)
{
  wxTreeItemId id;

  CWorkspaceDataset* wks = wxGetApp().GetCurrentWorkspaceDataset();
  if (wks == NULL)
  {
    return id;
  }
  
  if (wks->GetDatasetCount() <= 0)
  {
    return id;
  }

  CDataset* dataset = wks->GetDataset(datasetName);
  
  int image = CTreeCtrl::TreeCtrlIcon_File;

  wxTreeItemId rootId = GetRootItem();
  
  if (!rootId)
  {

    rootId = AddRoot("Root", CTreeCtrl::TreeCtrlIcon_Folder, CTreeCtrl::TreeCtrlIcon_Folder);
  }

  id = AppendItem(rootId, datasetName.c_str(), image, image + 1, new CDatasetTreeItemData(dataset));

  return id;
}
void Download::getItems()
{   
    F_Type f;
    Data data = init_data(LIST_FILE);
    QTreeWidgetItem *father=NULL,*child=NULL;
    m_client->write_data(&data,sizeof(Data));
    start:
    m_client->read_data(&f,sizeof(F_Type));   
    if(f.type == -222)
        goto end;
    if(f.level == 0)
        goto j_father;
    if(f.level > 0)
        goto j_child;
    goto end;
    j_father:
    father=AddRoot(f.name,f.path,f.type,f.size);
    goto start;
    j_child:
    if(f.level == 1)
        child=AddChild(father,f.name,f.path,f.type,f.size);
    else if(f.level>=1)
        child=AddChild(child,f.name,f.path,f.type,f.size);
    goto start;
    end:    
    return;
}
Beispiel #14
0
OPJMarkerTree::OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
           const wxPoint& pos, const wxSize& size, long style)
          : wxTreeCtrl(parent, id, pos, size, style)
{
    m_reverseSort = false;
	m_fname = fname;

	m_peektextCtrl = ((OPJFrame *) (parent->GetParent()->GetParent()))->m_textCtrlbrowse;
    CreateImageList();

    // Add some items to the tree
    //AddTestItemsToTree(5, 5);
    int image = wxGetApp().ShowImages() ? OPJMarkerTree::TreeCtrlIcon_Folder : -1;
    wxTreeItemId rootId = AddRoot(name,
                                  image, image,
                                  new OPJMarkerData(name));

    OPJParseThread *pthread = CreateParseThread(0x00, subframe);
    if (pthread->Run() != wxTHREAD_NO_ERROR)
        wxLogMessage(wxT("Can't start parse thread!"));
    else
		wxLogMessage(wxT("New parse thread started."));

	m_childframe = subframe;
}
Beispiel #15
0
                   P3DPlantModelTreeCtrl::P3DPlantModelTreeCtrl
                                      (wxWindow           *parent,
                                       P3DPlantModel      *PlantModel,
                                       P3DBranchPanel     *BranchPanel)
                   : wxTreeCtrl(parent,PLANT_TREE_CTRL_ID,wxDefaultPosition,
                                wxDefaultSize,wxTR_HAS_BUTTONS | wxRAISED_BORDER)
 {
  this->BranchPanel = BranchPanel;

  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));

  P3DBranchModel  *PlantBase;

  PlantBase = PlantModel->GetPlantBase();

  wxTreeItemId RootId = AddRoot(MakeTreeItemLabel(PlantBase->GetName(),PlantBase));

  SetItemData(RootId,new P3DPlantModelTreeCtrlItemData(PlantBase));

  AppendChildrenRecursive(PlantBase,RootId);

  #if defined(__WXMSW__)
   {
    SetItemBold(RootId,true);
   }
  #endif
 }
Beispiel #16
0
/**
 * Method used to prepare the tree for addition of nodes
 */
void DecoratedTree::Initialize(void)
{
    if (!initialized)
    {
        AddRoot("Root");
        initialized = true;        
    }
}
Beispiel #17
0
MyDialog::MyDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyDialog)
{
    ui->setupUi(this);
    ui->label->setText("mydialog label ********");
    ui->listWidget->addItem("Hello");
    for(int i= 0; i< 9; i++)
        ui->listWidget->addItem(QString::number(i) + " Item");

    ui->treeWidget->setColumnCount(2);
//    ui->treeWidget->setHeaderLabel("col a");
    ui->treeWidget->setHeaderLabels(QStringList() << "First" << "Second");
    AddRoot("1 Hello","World");
    AddRoot("2 Hello","World");
    AddRoot("3 Hello","World");

}
Beispiel #18
0
void Registry::GarbageCollect(Object root)
{ 
#ifdef KAI_USE_TRICOLOR
	AddRoot(root);
	TriColor();
#else
	MarkSweepAndDestroy(root); 
#endif
}
Beispiel #19
0
 void ClearProps()
 {
     DeleteAllItems();
     AddRoot(_("Properties"));
     if (m_EditCtrl)
     {
         m_EditCtrl->EndEdit();
         m_EditCtrl = NULL;
     }
 }
Beispiel #20
0
SessionTreeControl::SessionTreeControl( wxWindow* parent ) :
    wxTreeCtrl( parent, wxID_ANY, parent->GetPosition(), parent->GetSize() )
{
    rootID = AddRoot( _("Sessions"), -1, -1, new wxTreeItemData() );
    videoNodeID = AppendItem( rootID, _("Video") );
    audioNodeID = AppendItem( rootID, _("Audio") );
    Expand( rootID );

    timer = new RotateTimer( this );
}
Beispiel #21
0
V4StudioTree::V4StudioTree(wxWindow *parent_, wxSize size,V4FieldList *fieldView) : 
	wxTreeCtrl(parent_, -1, wxDefaultPosition, size, wxTR_DEFAULT_STYLE)
{
	CreateImageList();
	AddRoot("Scene", V4StudioTree::TreeCtrlIcon_Folder, V4StudioTree::TreeCtrlIcon_FolderOpened);
	m_transformNode = NULL;
	m_selectedNode = NULL;

	parent = (V4StudioFrame *) parent_;
}
Beispiel #22
0
void SymbolTree::BuildTree(const wxFileName &fileName)
{
	// Clear the tree
	DeleteAllItems();
	m_items.clear();
	m_globalsNode = wxTreeItemId();
	m_prototypesNode = wxTreeItemId();
	m_macrosNode = wxTreeItemId();
	m_sortItems.clear();

	m_fileName = fileName;
	// Get the current tree
	m_tree = TagsManagerST::Get()->Load(m_fileName);
	if ( !m_tree ) {
		return;
	}

	// Add invisible root node
	wxTreeItemId root;
	root = AddRoot(fileName.GetFullName(), 15, 15);

	TreeWalker<wxString, TagEntry> walker(m_tree->GetRoot());

	// add three items here:
	// the globals node, the mcros and the prototype node
	m_globalsNode    = AppendItem(root, wxT("Global Functions and Variables"), 2, 2, new MyTreeItemData(wxT("Global Functions and Variables"), wxEmptyString));
	m_prototypesNode = AppendItem(root, wxT("Functions Prototypes"), 2, 2, new MyTreeItemData(wxT("Functions Prototypes"), wxEmptyString));
	m_macrosNode     = AppendItem(root, wxT("Macros"), 2, 2, new MyTreeItemData(wxT("Macros"), wxEmptyString));

	// Iterate over the tree and add items
	m_sortItems.clear();

	Freeze();
	for (; !walker.End(); walker++) {
		// Add the item to the tree
		TagNode* node = walker.GetNode();

		// Skip root node
		if (node->IsRoot())
			continue;

		// Add the node
		AddItem(node);
	}

	SortTree(m_sortItems);
	Thaw();

	//select the root node by default
	if (!(GetWindowStyleFlag() & wxTR_HIDE_ROOT)) {
		//root is visible, select it
		SelectItem(GetRootItem());
	}
}
wxTreeItemId CocaSystemTree::add( const coca::ISystem& system, wxString name )
{
    wxTreeItemId id = AddRoot( name, E_COCA_IMAGE );
    if ( system.getRoot() ) { add( *system.getRoot(), id ); }

    Expand( id );
    EnsureVisible( id );
    SelectItem( id );

    return id;
}
Beispiel #24
0
void browsers::TDTbrowser::collectInfo(const wxString libname, laydata::TDTHierTree* tdtH) {
   AddRoot(libname);
   if (!tdtH) return; // new, empty design 
   laydata::TDTHierTree* root = tdtH->GetFirstRoot();
   wxTreeItemId nroot;
   while (root){
      nroot = AppendItem(GetRootItem(), wxString(root->GetItem()->name().c_str()));
      SetItemTextColour(nroot,*wxLIGHT_GREY);
      collectChildren(root, nroot);
      root = root->GetNextRoot();
   }
}
Beispiel #25
0
HDUITREEITEM	CDUITreeViewImpl::AddChildItem(HDUITREEITEM hParent , HDUITREEITEM hChild) 
{
	DUI_ASSERT(hChild);

	if ( hParent == NULL )
		return AddRoot(hChild);

	if ( hParent->AddControl(hChild) )
		return hChild;

	return NULL;
}
Beispiel #26
0
void Registry::MarkSweepAndDestroy(Object root)
{
#ifdef KAI_USE_TRICOLOR
	AddRoot(root);
	TriColor();
	return;
#else
	DestroyNominated();			// destroy any pending
	MarkAndSweep(root);			// mark objects for destruction
	DestroyNominated();			// destroy them
#endif
}
Beispiel #27
0
// create a new tree item and insert it into the tree
RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(
    TreeNode *pParent,
    const wxString& strName,
    int idImage,
    const wxString *pstrValue,
    wxRegKey::WOW64ViewMode viewMode)
{
    // create new item & insert it
    TreeNode *pNewNode = new TreeNode;
    pNewNode->m_pTree  = this;
    pNewNode->m_pParent = pParent;
    pNewNode->m_strName = strName;
    pNewNode->m_bKey    = pstrValue == NULL;
    pNewNode->m_pKey    = NULL;
    pNewNode->m_viewMode = viewMode;
    if (pParent)
    {
        pNewNode->m_id  = AppendItem(pParent->Id(),
            pNewNode->IsKey() ? strName : *pstrValue,
            idImage);
    }
    else
    {
        pNewNode->m_id  = AddRoot(strName);
    }

    wxASSERT_MSG( pNewNode->m_id, wxT("can't create tree control item!"));

    // save the pointer in the item
    SetItemData(pNewNode->m_id, pNewNode);

    // add it to the list of parent's children
    if ( pParent != NULL )
    {
        pParent->m_aChildren.Add(pNewNode);
    }

    if ( pNewNode->IsKey() )
    {
        SetItemHasChildren(pNewNode->Id());

        if ( !pNewNode->IsRoot() )
        {
            // set the expanded icon as well
            SetItemImage(pNewNode->Id(),
                RegImageList::OpenedKey,
                wxTreeItemIcon_Expanded);
        }
    }

    return pNewNode;
}
void DESIGN_TREE_FRAME::ReCreateDesignTree()
{
    wxWindowUpdateLocker dummy(this);   // Avoid flicker when rebuilding the tree

    DeleteAllItems();

    const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();

    // root tree:
    wxFileName      fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrFileName() );
    wxTreeItemId    rootitem;

    if( fn.GetName().IsEmpty() )
        rootitem = AddRoot( wxT( "<default>" ), 0, 0 );
    else
        rootitem = AddRoot( fn.GetName(), 0, 0 );

    SetItemBold( rootitem, true );

    // Now adding all current items
    for( unsigned ii = 0; ii < pglayout.GetCount(); ii++ )
    {
        WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
        int img = 0;
        switch( item->GetType() )
        {
            case WORKSHEET_DATAITEM::WS_SEGMENT: img = 1; break;
            case WORKSHEET_DATAITEM::WS_RECT: img = 2; break;
            case WORKSHEET_DATAITEM::WS_TEXT: img = 3; break;
            case WORKSHEET_DATAITEM::WS_POLYPOLYGON: img = 4; break;
            case WORKSHEET_DATAITEM::WS_BITMAP: img = 5; break;
        }
        wxTreeItemId cell= AppendItem( rootitem, item->m_Name, img, img );
        DESIGN_TREE_ITEM_DATA* data = new DESIGN_TREE_ITEM_DATA( item );
        SetItemData( cell, data );
    }

    Expand( rootitem );
}
Beispiel #29
0
//==============================================================================
void browsers::GDSbrowser::collectInfo(const wxString libname, GDSin::GDSHierTree* gdsH) {
   AddRoot(libname);
   if (!gdsH) return; // new, empty design 
   GDSin::GDSHierTree* root = gdsH->GetFirstRoot();
   wxTreeItemId nroot;
   while (root){
      nroot = AppendItem(GetRootItem(), wxString(root->GetItem()->Get_StrName()));
//      SetItemTextColour(nroot,*wxLIGHT_GREY);
      collectChildren(root, nroot);
      root = root->GetNextRoot();
   }
//   Toped->Resize();
}
wxTreeItemId udCodeItemsTree::CreateTreeItems(udProjectItem* item, wxTreeItemId parent)
{
	wxTreeItemId treeId;

    if( item )
    {
		#ifdef __WXMSW__
		wxWindowUpdateLocker noUpdate( this );
		#endif

		int nImageIndex = udArt::GetImageIndex(item->GetClassInfo()->GetClassName());
		
        // create tree item relevat to project items
        if( item->IsKindOf( CLASSINFO(udRootItem)) )
        {
			treeId = AddRoot( wxT("Reusable code fragments"), nImageIndex, nImageIndex, new udTreeItem(this, item));
			//EnsureVisible( treeId );
			//Expand( treeId );
			m_mapTreeItems[ (wxUIntPtr)item ] = treeId;
        }
		else if( item->IsKindOf( CLASSINFO(udCodePackageItem)) )
		{
			treeId = CreateItem( parent, item, nImageIndex );
			//EnsureVisible( treeId );
			//Expand( treeId );
		}
		else if( item->IsKindOf( CLASSINFO(udVariableItem)) || 
				 item->IsKindOf( CLASSINFO(udFunctionItem)) ) 
		{
			treeId = CreateItem( parent, item, nImageIndex );
		}
		
		// show new tree item
		if( treeId.IsOk() )
		{
			EnsureVisible( treeId );
			Expand( treeId );
		
			// create item's children as well
			SerializableList::compatibility_iterator node = item->GetFirstChildNode();
			while(node)
			{
				CreateTreeItems((udProjectItem*)node->GetData(), treeId);
				node = node->GetNext();
			}
		}
	}
	
	return treeId;
}