本文整理汇总了C++中Panel::AddNode方法的典型用法代码示例。如果您正苦于以下问题:C++ Panel::AddNode方法的具体用法?C++ Panel::AddNode怎么用?C++ Panel::AddNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel::AddNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
Project::New(wxWindow *parent, MenuState *state, const wxString& type)
{
if (l_instance != NULL)
{
DESTROY(l_instance);
}
l_instance = NEW(Project, (parent, type));
// Load the XML project description.
Debug::Printf(TXT("Parsing \"%s\".\n"), l_Types[type].c_str());
wxXmlDocument xml;
if (!xml.Load(l_Types[type]))
{
THROW(TXT("Couldn't parse the XML file."));
}
if (xml.GetRoot()->GetName() != wxT("project"))
{
THROW(TXT("Root node isn't <project>."));
}
//wxArrayString groups = NodeLibrary::AddUserNodes();
//wxString grpfile(g_FragmentShaderLibPath);
//grpfile.Append(wxT("nodes\\user.xml"));
//wxArrayString groups = NodeLibrary::Add(grpfile);
wxXmlNode *child = xml.GetRoot()->GetChildren();
while (child != 0)
{
if (child->GetType() == wxXML_COMMENT_NODE)
{
child = child->GetNext();
continue;
}
if (child->GetName() == wxT("panel"))
{
wxString name;
if (!child->GetPropVal(wxT("name"), &name))
{
THROW(TXT("Couldn't find attribute 'name' in element <panel>."));
}
Panel *panel = NEW(Panel, (l_instance, state->Clone()));
panel->Freeze();
l_instance->AddPage(panel, name);
Debug::Printf(TXT("Panel \"%s\" (%p) created.\n"), name.c_str(), panel);
wxXmlNode *child2 = child->GetChildren();
/*
for (size_t i = 0; i < groups.GetCount(); i++)
{
panel->AddToTree(groups[i]);
Debug::Printf(TXT("Group \"%s\" added to panel %p.\n"), groups[i].c_str(), panel);
}
*/
while (child2 != 0)
{
if (child2->GetType() == wxXML_COMMENT_NODE)
{
child2 = child2->GetNext();
continue;
}
if (child2->GetName() == wxT("add-library"))
{
wxString path;
if (!child2->GetPropVal(wxT("path"), &path))
{
THROW(TXT("Couldn't find attribute 'path' in element <add-library>."));
}
panel->LoadLibrary(path);
Debug::Printf(TXT("Library \"%s\" added to panel %p.\n"), path, panel);
}
else if (child2->GetName() == wxT("add-node"))
{
wxString type;
if (!child2->GetPropVal(wxT("type"), &type))
{
THROW(TXT("Couldn't find attribute 'type' in element <add-node>."));
}
wxString deletable = child2->GetPropVal(wxT("deletable"), wxT("false"));
panel->AddNode(type, deletable == wxT("true"));
Debug::Printf(TXT("Node \"%s\" added to panel %p.\n"), type.c_str(), panel);
}
else
{
Debug::Printf(TXT("\tInvalid element <%s> in <panel>.\n"), child2->GetName().c_str());
}
child2 = child2->GetNext();
}
panel->Thaw();
}
else
{
Debug::Printf(TXT("\tInvalid element <%s> in <project>.\n"), child->GetName().c_str());
}
child = child->GetNext();
}
// Delete the menu state (it has been cloned for each panel.)
DESTROY(state);
// Load the panels configuration.
l_instance->LoadConfig();
// Clear Undo data of all panels.
size_t count = l_instance->GetPageCount();
//.........这里部分代码省略.........