本文整理汇总了C++中wxTreeItemId函数的典型用法代码示例。如果您正苦于以下问题:C++ wxTreeItemId函数的具体用法?C++ wxTreeItemId怎么用?C++ wxTreeItemId使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxTreeItemId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayDropHighlight
wxTreeItemId DisplayDropHighlight(wxPoint point)
{
wxTreeItemId hit = GetHit(point);
if (!hit) {
ClearDropHighlight();
return wxTreeItemId();
}
const CServerPath& path = m_pRemoteTreeView->GetPathFromItem(hit);
if (path.empty()) {
ClearDropHighlight();
return wxTreeItemId();
}
const wxTreeItemId dropHighlight = m_pRemoteTreeView->m_dropHighlight;
if (dropHighlight != wxTreeItemId())
m_pRemoteTreeView->SetItemDropHighlight(dropHighlight, false);
m_pRemoteTreeView->SetItemDropHighlight(hit, true);
m_pRemoteTreeView->m_dropHighlight = hit;
return hit;
}
示例2: while
wxTreeItemId McfViewerForm::FindNode(const wchar_t* str, wxTreeItemId lastNode)
{
wxTreeItemIdValue cookie;
wxTreeItemId item = m_tcFileTree->GetFirstChild(lastNode, cookie);
while (item.IsOk())
{
if (wcscmp(str, m_tcFileTree->GetItemText(item))==0)
return item;
item = m_tcFileTree->GetNextChild(lastNode, cookie);
}
return wxTreeItemId();
}
示例3: wxTreeItemId
void browsers::TDTbrowser::OnTELLremovecell(wxString cellname, wxString parentname, bool orphan)
{
wxTreeItemId newparent;
if (orphan)
{
wxTreeItemId item;
hCellBrowser->findItem(cellname, item, hCellBrowser->GetRootItem());
hCellBrowser->copyItem(item, hCellBrowser->GetRootItem());
item = wxTreeItemId();
VERIFY(hCellBrowser->findItem(parentname, newparent, hCellBrowser->GetRootItem()));
VERIFY(hCellBrowser->findItem(cellname, item, newparent));
hCellBrowser->DeleteChildren(item);
hCellBrowser->Delete(item);
}
else if (wxT("") == parentname)
{// no parent => we are removing the cell, not it's reference
wxTreeItemId item;
//Flat
VERIFY(fCellBrowser->findItem(cellname, item, fCellBrowser->GetRootItem()));
fCellBrowser->Delete(item);
//Hier
wxTreeItemId item2;
VERIFY(hCellBrowser->findItem(cellname, item2, hCellBrowser->GetRootItem()));
// copy all children
// This part is "in case". The thing is that children should have been
// removed already, by tdtcell::removePrep
wxTreeItemIdValue cookie;
wxTreeItemId child = hCellBrowser->GetFirstChild(item2,cookie);
while (child.IsOk())
{
hCellBrowser->copyItem(child, hCellBrowser->GetRootItem());
child = hCellBrowser->GetNextChild(item2,cookie);
}
// finally delete the item and it's children
hCellBrowser->DeleteChildren(item2);
hCellBrowser->Delete(item2);
}
else
while (hCellBrowser->findItem(parentname, newparent, hCellBrowser->GetRootItem()))
{
wxTreeItemId item;
VERIFY(hCellBrowser->findItem(cellname, item, newparent));
hCellBrowser->DeleteChildren(item);
hCellBrowser->Delete(item);
}
}
示例4: wxTreeItemId
wxTreeItemId ProjectExplorerWindow::GetSelection() const
{
wxArrayTreeItemIds selectedIds;
m_tree->GetSelections(selectedIds);
if (selectedIds.Count() > 0)
{
return selectedIds[0];
}
else
{
return wxTreeItemId();
}
}
示例5: GetPrevSibling
wxTreeItemId wxTreeCtrlEx::GetPrevItemSimple(wxTreeItemId const& item) const
{
wxTreeItemId cur = GetPrevSibling(item);
if (cur.IsOk()) {
while (cur.IsOk() && HasChildren(cur) && IsExpanded(cur)) {
cur = GetLastChild(cur);
}
}
else {
cur = GetItemParent(item);
if (cur.IsOk() && cur == GetRootItem() && (GetWindowStyle() & wxTR_HIDE_ROOT)) {
cur = wxTreeItemId();
}
}
return cur;
}
示例6: while
wxTreeItemId BundlePane::FindItemInMenu(wxTreeItemId menuItem, BundleItemType type, unsigned int itemId) const {
wxTreeItemIdValue cookie;
wxTreeItemId c = m_bundleTree->GetFirstChild(menuItem, cookie);
while (c.IsOk()) {
const BundleItemData* childData = (BundleItemData*)m_bundleTree->GetItemData(c);
if (childData->m_type == BUNDLE_SUBDIR) {
wxTreeItemId res = FindItemInMenu(c, type, itemId);
if (res.IsOk()) return res;
}
else if (childData->m_type == type && childData->m_itemId == itemId) return c;
c = m_bundleTree->GetNextChild(menuItem, cookie);
}
return wxTreeItemId(); // Not in menu
}
示例7: fnFullname
wxTreeItemId PHPWorkspaceView::DoGetFileItem(const wxTreeItemId& folderItem, const wxString& filename)
{
wxFileName fnFullname(filename);
wxString fullname = fnFullname.GetFullName();
wxTreeItemIdValue cookie;
wxTreeItemId child = m_treeCtrlView->GetFirstChild(folderItem, cookie);
while(child.IsOk()) {
const ItemData* itemData = DoGetItemData(child);
if(itemData && itemData->IsFile() && wxFileName(itemData->GetFile()).GetFullName() == fullname) {
return child;
}
child = m_treeCtrlView->GetNextChild(folderItem, cookie);
}
return wxTreeItemId();
}
示例8: GetFirstChild
wxTreeItemId CLocalTreeView::GetSubdir(wxTreeItemId parent, const wxString& subDir)
{
wxTreeItemIdValue value;
wxTreeItemId child = GetFirstChild(parent, value);
while (child)
{
#ifdef __WXMSW__
if (!GetItemText(child).CmpNoCase(subDir))
#else
if (GetItemText(child) == subDir)
#endif
return child;
child = GetNextSibling(child);
}
return wxTreeItemId();
}
示例9: wxLogTrace
wxTreeItemId DirectoryTree::GetItemFromPath(const wxString& sPath, bool bReturnBestFit)
{
wxString sRemainingPath = sPath;
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("GetItemFromPath('%s')"), sPath.c_str());
// Ensure path finishes in '/'
wxString sSeparator = wxFileName::GetPathSeparator();
wxChar chSeparator = sSeparator.GetChar(0);
if(sRemainingPath.Right(1) != sSeparator)
sRemainingPath += sSeparator;
// Start from root path
wxTreeItemId tid = GetRootItem(sPath);
if(!tid.IsOk())
{
wxLogDebug(wxT("GetItemFromPath(): invalid wxTreeItemId root %u"), (int) tid);
return wxTreeItemId();
}
sRemainingPath = sRemainingPath.AfterFirst(chSeparator);
while(sRemainingPath != wxT(""))
{
wxString sDir = sRemainingPath.BeforeFirst(chSeparator);
//wxLogTrace(DIRECTORYTREE_EVENTS, wxT("\tGetChildByName('%s')"), sDir.c_str());
wxTreeItemId tidChild = GetChildByName(tid, sDir);
if(!tidChild.IsOk())
{
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("GetItemFromPath('%s'): Failed to find directory '%s'"), sPath.c_str(), sDir.c_str());
if(bReturnBestFit)
{
// Allow selection of 'best fit' path
return tid;
}
else
{
wxTreeItemId tidBad;
return tidBad;
}
}
sRemainingPath = sRemainingPath.AfterFirst(chSeparator);
tid = tidChild;
wxLogTrace(DIRECTORYTREE_EVENTS, wxT("\tFound child '%s'"), GetItemText(tid).c_str());
}
return tid;
}
示例10: wxTreeItemId
ecConfigItem::ecConfigItem(ecConfigItem* parent, const wxString& name, ecConfigType ctype,
ecOptionFlavor flavor, ecOptionType otype,
bool active, bool enabled, bool modifiable, ecUIHint hint)
{
m_CdlItem = NULL;
m_name = name;
m_configType = ctype;
m_optionType = otype;
m_optionFlavor = flavor;
m_enabled = enabled;
m_active = active;
m_modifiable = modifiable;
m_parent = parent;
m_hint = hint;
m_treeItem = wxTreeItemId();
switch (otype)
{
case ecDouble:
{
m_value = 0.0;
break;
}
case ecString:
case ecEnumerated:
{
m_value = wxT("");
break;
}
case ecLong:
{
m_value = (long) 0;
break;
}
case ecBool:
{
m_value = (bool) FALSE;
break;
}
default:
{
break;
}
}
}
示例11: GetFirstChild
wxTreeItemId PHPOutlineTree::DoFind(const wxString& pattern, const wxTreeItemId& parent)
{
if((GetRootItem() != parent) && FileUtils::FuzzyMatch(pattern, GetItemText(parent))) {
return parent;
}
if(ItemHasChildren(parent)) {
wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild(parent, cookie);
while(child.IsOk()) {
wxTreeItemId match = DoFind(pattern, child);
if(match.IsOk()) {
return match;
}
child = GetNextChild(parent, cookie);
}
}
return wxTreeItemId();
}
示例12: GetTreeCtrl
wxTreeItemId wxGenericDirCtrl::AppendItem (const wxTreeItemId & parent,
const wxString & text,
int image, int selectedImage,
wxTreeItemData * data)
{
wxTreeCtrl *treeCtrl = GetTreeCtrl ();
wxASSERT (treeCtrl);
if (treeCtrl)
{
return treeCtrl->AppendItem (parent, text, image, selectedImage, data);
}
else
{
return wxTreeItemId();
}
}
示例13: wxTreeItemId
void BundlePane::OnTreeEndDrag(wxTreeEvent& event) {
if (!m_draggedItem.IsOk()) return;
const wxTreeItemId itemSrc = m_draggedItem;
const wxTreeItemId itemDst = event.GetItem();
m_draggedItem = wxTreeItemId();
if (!itemDst.IsOk()) return; // Invalid destintion
if (itemSrc == itemDst) return; // Can't drag to self
if (IsTreeItemParentOf(itemSrc, itemDst)) return; // Can't drag to one of your own children
wxLogDebug(wxT("Ending Drag over item: %s"), m_bundleTree->GetItemText(itemDst).c_str());
const BundleItemData* srcData = (BundleItemData*)m_bundleTree->GetItemData(itemSrc);
const BundleItemData* dstData = (BundleItemData*)m_bundleTree->GetItemData(itemDst);
if (!dstData->IsMenuItem()) return; // You can only drag items to menu
if (dstData->m_bundleId != srcData->m_bundleId) return; // Items can only be dragged within same bundle
// We have to cache uuid of submenus
const wxString subUuid = (srcData->m_type == BUNDLE_SUBDIR) ? srcData->m_uuid : wxString(wxEmptyString);
const unsigned int bundleId = srcData->m_bundleId;
PListDict infoDict = GetEditableMenuPlist(bundleId);
// Insert the item
Freeze();
const wxString name = m_bundleTree->GetItemText(itemSrc);
const wxTreeItemId insertedItem = InsertMenuItem(itemDst, name, new BundleItemData(*srcData), infoDict);
if (srcData->m_type == BUNDLE_SUBDIR) {
CopySubItems(itemSrc, insertedItem);
}
// Delete source ref
if (srcData->IsMenuItem()) RemoveMenuItem(itemSrc, false, infoDict);
Thaw();
// Save the modified plist
m_plistHandler.SaveBundle(bundleId);
// Update menu in editorFrame
m_syntaxHandler.ReParseBundles(true/*onlyMenu*/);
}
示例14: GetFirstChild
bool browsers::CellBrowser::findItem(const wxString name, wxTreeItemId& item, const wxTreeItemId parent)
{
wxTreeItemIdValue cookie;
wxTreeItemId child = GetFirstChild(parent,cookie);
while (child.IsOk())
{
if (item.IsOk())
{
if (child == item) item = wxTreeItemId();
}
else if (name == GetItemText(child))
{
item = child; return true;
}
if (findItem(name, item, child)) return true;
child = GetNextChild(parent,cookie);
}
return false;
}
示例15: wxTreeItemId
wxTreeItemId PHPWorkspaceView::DoGetFolderItem(const wxTreeItemId& projectItem, PHPFolder::Ptr_t pFolder)
{
wxString curpath, path;
path = pFolder->GetPathRelativeToProject();
wxTreeItemId parent = projectItem;
wxArrayString parts = ::wxStringTokenize(path, "/", wxTOKEN_STRTOK);
for(size_t i = 0; i < parts.GetCount(); ++i) {
if(!curpath.IsEmpty()) {
curpath << "/";
}
curpath << parts.Item(i);
if(!HasFolderWithName(parent, parts.Item(i), parent)) {
return wxTreeItemId();
}
}
return parent;
}