当前位置: 首页>>代码示例>>C++>>正文


C++ AddRoot函数代码示例

本文整理汇总了C++中AddRoot函数的典型用法代码示例。如果您正苦于以下问题:C++ AddRoot函数的具体用法?C++ AddRoot怎么用?C++ AddRoot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AddRoot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QDialog

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");
}
开发者ID:WACodeAcademy,项目名称:GUI-dev,代码行数:11,代码来源:dialog.cpp

示例2: wxTreeCtrl

//============================================================================
// 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 );
}
开发者ID:wxguidesigner,项目名称:wxGUIDesigner,代码行数:28,代码来源:treeview.cpp

示例3: wxDynamicCast

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;
};
开发者ID:Mileslee,项目名称:wxgis,代码行数:31,代码来源:gxtreeview.cpp

示例4: wxLogTrace

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
  }
开发者ID:joeyates,项目名称:sherpa,代码行数:32,代码来源:DirectoryTree.cpp

示例5: wxTreeCtrlEx

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);
}
开发者ID:oneminot,项目名称:filezilla3,代码行数:26,代码来源:RemoteTreeView.cpp

示例6: QDialog

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));
}
开发者ID:dinguluer,项目名称:UiMagician,代码行数:35,代码来源:widgetimageselector.cpp

示例7: sourceFile

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();
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:31,代码来源:PHPOutlineTree.cpp

示例8: wxTreeCtrlEx

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));
}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:32,代码来源:LocalTreeView.cpp

示例9: string_to_object

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);
	}
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:27,代码来源:NSBrowser.cpp

示例10: wxRemotelyScrolledTreeCtrl

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);
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:33,代码来源:tree.cpp

示例11: wxGetApp

//----------------------------------------
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;
}
开发者ID:adakite,项目名称:main,代码行数:32,代码来源:DatasetTreeCtrl.cpp

示例12: init_data

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;
}
开发者ID:valentingrigorean,项目名称:Collaborative-Notepad,代码行数:27,代码来源:download.cpp

示例13: wxTreeCtrl

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;
}
开发者ID:ArphonePei,项目名称:PDFConverter,代码行数:25,代码来源:OPJThreads.cpp

示例14: wxTreeCtrl

                   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
 }
开发者ID:Benjamin-L,项目名称:Dinosauria,代码行数:27,代码来源:p3dmedit.cpp

示例15: QDialog

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");

}
开发者ID:thomasalvatran,项目名称:Notepad,代码行数:18,代码来源:mydialog.cpp


注:本文中的AddRoot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。