本文整理汇总了C++中wxTreeItemId::IsOk方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTreeItemId::IsOk方法的具体用法?C++ wxTreeItemId::IsOk怎么用?C++ wxTreeItemId::IsOk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTreeItemId
的用法示例。
在下文中一共展示了wxTreeItemId::IsOk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryGetPrevItem
wxTreeItemId PHPFileLayoutTree::TryGetPrevItem(wxTreeItemId item)
{
wxCHECK_MSG(item.IsOk(), wxTreeItemId(), wxT("invalid tree item"));
// find out the starting point
wxTreeItemId prevItem = GetPrevSibling(item);
if(!prevItem.IsOk()) {
prevItem = GetItemParent(item);
if(prevItem == GetRootItem()) {
return wxTreeItemId();
}
}
// from there we must be able to navigate until this item
while(prevItem.IsOk()) {
ScrollTo(prevItem);
if(!IsVisible(prevItem)) {
return wxTreeItemId();
}
const wxTreeItemId nextItem = GetNextVisible(prevItem);
if(!nextItem.IsOk() || nextItem == item) return prevItem;
prevItem = nextItem;
}
return wxTreeItemId();
}
示例2: IsTreeItemParentOf
bool BundlePane::IsTreeItemParentOf(const wxTreeItemId parent, const wxTreeItemId child) const {
wxASSERT(parent.IsOk() && child.IsOk());
wxTreeItemId item = m_bundleTree->GetItemParent(child);
while (item.IsOk()) {
if (item == parent) return true;
item = m_bundleTree->GetItemParent(item);
}
return false;
}
示例3: OnRemove
void ecAdminDialog::OnRemove(wxCommandEvent& event)
{
wxTreeCtrl* treeCtrl = (wxTreeCtrl*) FindWindow( ecID_ADMIN_DIALOG_TREE) ;
const wxTreeItemId hTreeItem = treeCtrl->GetSelection ();
if (! hTreeItem || !hTreeItem.IsOk())
return;
if (wxYES != wxMessageBox (_("The selected package will be deleted from the repository. Core eCos packages may be restored only by reinstalling eCos.\n\nDo you wish to continue?"),
_("Remove Package"), wxYES_NO | wxICON_EXCLAMATION))
return;
ecAdminItemData* data = (ecAdminItemData*) treeCtrl->GetItemData (hTreeItem);
if (data) // if a package node is selected
{
// remove all package version nodes
wxString pstrPackage(data->m_string);
bool bStatus = TRUE;
long cookie;
wxTreeItemId hChildItem = treeCtrl->GetFirstChild (hTreeItem, cookie);
while (hChildItem && bStatus)
{
const wxTreeItemId hNextChildItem = treeCtrl->GetNextSibling (hChildItem);
bStatus = RemovePackageVersion (hChildItem);
hChildItem = hNextChildItem;
}
// remove the package node
if (bStatus)
{
treeCtrl->Delete (hTreeItem);
}
}
else // a version node is selected
{
// remove the version node
const wxTreeItemId hParentItem = treeCtrl->GetParent (hTreeItem);
wxASSERT (hParentItem && hParentItem.IsOk() );
if (RemovePackageVersion (hTreeItem) && ! treeCtrl->ItemHasChildren (hParentItem)) // if the only version was deleted
{
// remove the package node
treeCtrl->Delete (hParentItem);
}
}
}
示例4: Source_Create
//---------------------------------------------------------
bool CData_Source_PgSQL::Source_Create(const wxTreeItemId &Item)
{
CData_Source_PgSQL_Data *pData = Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL ) return( false );
if( pData->Get_Type() == TYPE_ROOT
|| pData->Get_Type() == TYPE_SERVER )
{
CSG_Module *pModule = SG_Get_Module_Library_Manager().Get_Module("db_pgsql", DB_PGSQL_DB_Create);
if( pModule && pModule->On_Before_Execution() )
{
if( pData->Get_Type() == TYPE_SERVER )
{
pModule->Set_Parameter("PG_HOST", pData->Get_Host());
pModule->Set_Parameter("PG_PORT", pData->Get_Port());
}
if( DLG_Parameters(pModule->Get_Parameters()) )
{
pModule->Execute();
}
}
}
return( true );
}
示例5: Append_Table
//---------------------------------------------------------
void CData_Source_PgSQL::Append_Table(const wxTreeItemId &Parent, const SG_Char *Name, int Type, int Image)
{
CData_Source_PgSQL_Data *pData = Parent.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Parent) : NULL; if( pData == NULL ) return;
wxTreeItemId Item = AppendItem(Parent, Name, Image, Image, new CData_Source_PgSQL_Data(Type, Name, pData->Get_Server()));
if( Type == TYPE_GRIDS )
{
CSG_Table Grids;
RUN_MODULE(DB_PGSQL_Table_Query, false, // CTable_Query
SET_PARAMETER("CONNECTION", pData->Get_Server())
&& SET_PARAMETER("TABLES" , Name)
&& SET_PARAMETER("TABLE" , &Grids)
&& SET_PARAMETER("FIELDS" , SG_T("rid, name"))
);
if( bResult )
{
for(int i=0; i<Grids.Get_Count(); i++)
{
AppendItem(Item, Grids[i].asString(1), IMG_GRID, IMG_GRID,
new CData_Source_PgSQL_Data(TYPE_GRID, CSG_String::Format("%s:rid=%d", Name, Grids[i].asInt(0)), pData->Get_Server())
);
}
}
}
}
示例6: Source_Open
//---------------------------------------------------------
void CData_Source_PgSQL::Source_Open(const wxTreeItemId &Item)
{
CData_Source_PgSQL_Data *pData = Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL ) return;
if( pData->Get_Type() == TYPE_ROOT
|| pData->Get_Type() == TYPE_SERVER )
{
CSG_Module *pModule = SG_Get_Module_Library_Manager().Get_Module("db_pgsql", DB_PGSQL_Get_Connection); // CGet_Connection
if( pModule && pModule->On_Before_Execution() )
{
if( pData->Get_Type() == TYPE_SERVER )
{
pModule->Set_Parameter("PG_HOST", pData->Get_Host());
pModule->Set_Parameter("PG_PORT", pData->Get_Port());
}
if( DLG_Parameters(pModule->Get_Parameters()) )
{
pModule->Execute();
}
}
}
else if( pData->is_Connected() )
{
Update_Source(Item);
}
else if( !Source_Open(pData, true) )
{
DLG_Message_Show_Error(_TL("Could not connect to data source."), _TL("Connect to PostgreSQL"));
}
}
示例7: findId
wxTreeItemId CocaSystemTree::findId( const void* nodePointer, wxTreeItemId id ) const
{
if ( !id.IsOk() ) { return id; }
if ( nodePointer == getNode( id ) ) { return id; }
wxTreeItemIdValue cookie = 0;
id = GetFirstChild( id, cookie );
for ( ; id.IsOk(); id = GetNextSibling( id ) )
{
wxTreeItemId foundId = findId( nodePointer, id );
if ( foundId.IsOk() ) { return foundId; }
}
return id; // is invalid
}
示例8: Search
void MainWindow::Search(wxTreeItemId search,bool toogle)
{
wxTreeItemIdValue cookie;
NodeTree *itemData = search.IsOk() ? (NodeTree *) tree->GetItemData(search)
:NULL;
if(itemData->getTipo()==N_World )
if(itemData->pointer.world->getNumObjects()!=0)
Search(tree->GetFirstChild(search,cookie),toogle);
if(itemData->menus.menu_positionable)
{
if(itemData->menus.menu_composed || itemData->pointer.positionableentity->getOwner()->getClassName()=="World")
{
if(toogle)
itemData->pointer.positionableentity->setDrawReferenceSystem();
else
itemData->pointer.positionableentity->setDrawReferenceSystem(false);
if(itemData->menus.menu_composed)
if(itemData->pointer.composedentity->getNumObjects()>0)
Search(tree->GetFirstChild(search,cookie),toogle);
}
}
if(tree->GetLastChild(tree->GetItemParent(search))==search)
return;
Search(tree->GetNextSibling(search),toogle);
}
示例9: GetTreeItem
wxTreeItemId wxSpinTreeCtrl::GetTreeItem(const char *nodeId, wxTreeItemId idParent, wxTreeItemIdValue cookie)
{
if (! idParent.IsOk())
return NULL;
wxSpinTreeItemData *treeData = (wxSpinTreeItemData*)GetItemData(idParent);
if (treeData && treeData->m_pNode.valid())
{
if (strcmp(treeData->m_pNode->id->s_name, nodeId) == 0)
{
return idParent;
}
}
if (ItemHasChildren(idParent))
{
wxTreeItemId child;
for (child = GetFirstChild(idParent, cookie); child.IsOk(); child = GetNextChild(idParent, cookie))
{
wxTreeItemId targetItem = GetTreeItem(nodeId, child, cookie);
if (targetItem.IsOk())
return targetItem;
}
}
return GetTreeItem(nodeId, GetNextSibling(idParent), cookie);
}
示例10: RecursiveSearch
bool ClassBrowser::RecursiveSearch(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& parent, wxTreeItemId& result)
{
if (!parent.IsOk() || !tree)
return false;
// first check the parent item
if (FoundMatch(search, tree, parent))
{
result = parent;
return true;
}
wxTreeItemIdValue cookie;
wxTreeItemId child = tree->GetFirstChild(parent, cookie);
if (!child.IsOk())
return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);
while (child.IsOk())
{
if (FoundMatch(search, tree, child))
{
result = child;
return true;
}
if (tree->ItemHasChildren(child))
{
if (RecursiveSearch(search, tree, child, result))
return true;
}
child = tree->GetNextChild(parent, cookie);
}
return RecursiveSearch(search, tree, FindNext(search, tree, parent), result);
}
示例11: Source_Drop
//---------------------------------------------------------
bool CData_Source_PgSQL::Source_Drop(const wxTreeItemId &Item)
{
static wxString Username = "postgres", Password = "postgres";
CData_Source_PgSQL_Data *pData = Item.IsOk() ? (CData_Source_PgSQL_Data *)GetItemData(Item) : NULL; if( pData == NULL ) return( false );
if( !DLG_Login(Username, Password, _TL("Drop Database")) )
{
return( false );
}
pData->Set_Username(Username);
pData->Set_Password(Password);
if( pData->Get_Type() == TYPE_SOURCE && pData->is_Connected() )
{
RUN_MODULE(DB_PGSQL_DB_Drop, true, // CDatabase_Drop
SET_PARAMETER("PG_HOST", pData->Get_Host ())
&& SET_PARAMETER("PG_PORT", pData->Get_Port ())
&& SET_PARAMETER("PG_NAME", pData->Get_DBName ())
&& SET_PARAMETER("PG_USER", pData->Get_Username())
&& SET_PARAMETER("PG_PWD" , pData->Get_Password())
);
return( bResult );
}
return( false );
}
示例12: RenameObject
void PanelObjectList::RenameObject(wxTreeItemId id, const char* desc)
{
if( id.IsOk() )
{
m_pTree_Objects->SetItemText( id, desc );
}
}
示例13: findItemByData
wxTreeItemId luProjTree::findItemByData(const wxTreeItemId& parent, const wxString& data)
{
if (!parent.IsOk()) return parent;
ItemData* item = dynamic_cast<ItemData*>(GetItemData(parent));
if (item && item->GetName() == data)
return parent;
if (item) gkPrintf("%s", (const char*)item->GetName());
if (HasChildren(parent))
{
wxTreeItemIdValue cookie;
wxTreeItemId item = GetFirstChild(parent, cookie);
while (item.IsOk())
{
wxTreeItemId find = findItemByData(item, data); //find is item self or children.
if (find.IsOk()) return find;
item = GetNextChild(item, cookie);
}
}
return wxTreeItemId(); //not found
}
示例14: ShowMenu
void DebuggerTree::ShowMenu(wxTreeItemId id, const wxPoint& pt)
{
wxString caption;
wxMenu menu(wxEmptyString);
// if we right-clicked on a pointer, add a "dereference pointer" entry
wxString itemtext = m_pTree->GetItemText(id);
if (itemtext.Find(_T('*')) != wxNOT_FOUND)
{
menu.Append(idDereferenceValue, wxString::Format(_("Dereference pointer '%s'"), itemtext.BeforeFirst(_T('=')).c_str()));
menu.AppendSeparator();
}
// add watch always visible
menu.Append(idAddWatch, _("&Add watch"));
menu.Append(idWatchThis, _("Watch '*&this'"));
// we have to have a valid id for the following to be enabled
WatchTreeData* data = dynamic_cast<WatchTreeData*>(m_pTree->GetItemData(id));
if (id.IsOk() && // valid item
data && data->m_pWatch) // *is* a watch
{
menu.Append(idEditWatch, _("&Edit watch"));
menu.Append(idDeleteWatch, _("&Delete watch"));
}
menu.AppendSeparator();
menu.Append(idChangeValue, _("&Change value..."));
menu.AppendSeparator();
menu.Append(idLoadWatchFile, _("&Load watch file"));
menu.Append(idSaveWatchFile, _("&Save watch file"));
menu.AppendSeparator();
menu.Append(idDeleteAllWatches, _("Delete all watches"));
PopupMenu(&menu, pt);
}
示例15: OnMenuExport
void BundlePane::OnMenuExport(wxCommandEvent& WXUNUSED(event)) {
const wxTreeItemId selItem = m_bundleTree->GetSelection();
if (!selItem.IsOk()) return;
// Get the item name
const BundleItemData* data = (BundleItemData*)m_bundleTree->GetItemData(selItem);
wxString name;
if (data->IsBundle()) {
const wxFileName bundlePath = m_plistHandler.GetBundlePath(data->m_bundleId);
name = bundlePath.GetDirs().Last();
}
else {
const wxFileName bundlePath = m_plistHandler.GetBundleItemPath(data->m_type, data->m_bundleId, data->m_itemId);
name = bundlePath.GetFullName();
}
// Get destination path from user
const wxString msg = data->IsBundle() ? _("Export Bundle as..") : _("Export Bundle Item as");
wxFileDialog dlg(this, msg, wxEmptyString, name, wxFileSelectorDefaultWildcardStr, wxFD_SAVE);
if (dlg.ShowModal() != wxID_OK) return;
const wxString path = dlg.GetPath();
if (path.empty()) return;
// Export the item
if (data->IsBundle()) {
wxFileName dstPath;
dstPath.AssignDir(path);
m_plistHandler.ExportBundle(dstPath, data->m_bundleId);
}
else m_plistHandler.ExportBundleItem(path, data->m_type, data->m_bundleId, data->m_itemId);
}