本文整理汇总了C++中XNODE::GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ XNODE::GetChildren方法的具体用法?C++ XNODE::GetChildren怎么用?C++ XNODE::GetChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XNODE
的用法示例。
在下文中一共展示了XNODE::GetChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadMacros
void PCB_EDIT_FRAME::ReadMacros()
{
wxString str;
wxFileName fn;
fn = GetBoard()->GetFileName();
fn.SetExt( MacrosFileExtension );
wxFileDialog dlg( this, _( "Read Macros File" ), fn.GetPath(),
fn.GetFullName(), MacrosFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( !wxFileExists( dlg.GetPath() ) )
{
wxString msg;
msg.Printf( _( "File %s not found" ), GetChars( dlg.GetPath() ) );
DisplayError( this, msg );
return;
}
wxXmlDocument xml;
xml.SetFileEncoding( wxT( "UTF-8" ) );
if( !xml.Load( dlg.GetFilename() ) )
return;
XNODE *macrosNode = (XNODE*) xml.GetRoot()->GetChildren();
while( macrosNode )
{
int number = -1;
if( macrosNode->GetName() == wxT( "macros" ) )
{
number = wxAtoi( macrosNode->GetAttribute( wxT( "number" ), wxT( "-1" ) ) );
if( number >= 0 && number < 10 )
{
m_Macros[number].m_Record.clear();
XNODE *hotkeyNode = (XNODE*) macrosNode->GetChildren();
while( hotkeyNode )
{
if( hotkeyNode->GetName() == wxT( "hotkey" ) )
{
int x = wxAtoi( hotkeyNode->GetAttribute( wxT( "x" ), wxT( "0" ) ) );
int y = wxAtoi( hotkeyNode->GetAttribute( wxT( "y" ), wxT( "0" ) ) );
int hk = wxAtoi( hotkeyNode->GetAttribute( wxT( "hkcode" ), wxT( "0" ) ) );
MACROS_RECORD macros_record;
macros_record.m_HotkeyCode = hk;
macros_record.m_Position.x = x;
macros_record.m_Position.y = y;
m_Macros[number].m_Record.push_back( macros_record );
}
hotkeyNode = (XNODE*) hotkeyNode->GetNext();
}
}
}
macrosNode = (XNODE*) macrosNode->GetNext();
}
}