當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。