本文整理汇总了C++中gd::Layout::HasObjectNamed方法的典型用法代码示例。如果您正苦于以下问题:C++ Layout::HasObjectNamed方法的具体用法?C++ Layout::HasObjectNamed怎么用?C++ Layout::HasObjectNamed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::Layout
的用法示例。
在下文中一共展示了Layout::HasObjectNamed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
vector < gd::String > GD_CORE_API GetBehaviorsOfObject(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups)
{
bool behaviorsAlreadyInserted = false;
vector < gd::String > behaviors;
//Search in objects
if ( layout.HasObjectNamed(name) ) //We check first layout's objects' list.
{
std::vector < gd::String > objectBehaviors = layout.GetObject(name).GetAllBehaviorNames();
std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
behaviorsAlreadyInserted = true;
}
else if ( project.HasObjectNamed(name) ) //Then the global object list
{
vector < gd::String > objectBehaviors = project.GetObject(name).GetAllBehaviorNames();
std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
behaviorsAlreadyInserted = true;
}
//Search in groups
if ( searchInGroups )
{
for (std::size_t i = 0;i<layout.GetObjectGroups().size();++i)
{
if ( layout.GetObjectGroups()[i].GetName() == name )
{
//A group has the name searched
//Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = layout.GetObjectGroups()[i].GetAllObjectsNames();
for (std::size_t j = 0;j<groupsObjects.size();++j)
{
//Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!behaviorsAlreadyInserted)
{
behaviorsAlreadyInserted = true;
behaviors = objectBehaviors;
}
else
{
for (std::size_t a = 0 ;a<behaviors.size();++a)
{
if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{
behaviors.erase(behaviors.begin() + a);
--a;
}
}
}
}
}
}
for (std::size_t i = 0;i<project.GetObjectGroups().size();++i)
{
if ( project.GetObjectGroups()[i].GetName() == name )
{
//A group has the name searched
//Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = project.GetObjectGroups()[i].GetAllObjectsNames();
for (std::size_t j = 0;j<groupsObjects.size();++j)
{
//Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!behaviorsAlreadyInserted)
{
behaviorsAlreadyInserted = true;
behaviors = objectBehaviors;
}
else
{
for (std::size_t a = 0 ;a<behaviors.size();++a)
{
if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{
behaviors.erase(behaviors.begin() + a);
--a;
}
}
}
}
}
}
}
return behaviors;
}
示例2: LaunchEditor
//.........这里部分代码省略.........
if ( retour == 3 )
editCtrl->ChangeValue("-");
if ( retour == 4 )
editCtrl->ChangeValue("*");
if ( retour == 5 )
editCtrl->ChangeValue("/");
return;
}
else if ( metadata.GetType() == "password" )
{
GeneratePassword dialog(parent);
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.mdp);
return;
}
else if ( metadata.GetType() == "trueorfalse" )
{
TrueOrFalse dialog(parent, _("Choose True or False to fill the parameter"), _("True or False"));
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(_("True"));
else
editCtrl->ChangeValue(_("False"));
}
else if ( metadata.GetType() == "yesorno" )
{
if (wxMessageBox(_("Choose yes or no to fullfil parent parameter:"), _("Yes or no") ,wxYES_NO ) == wxYES)
editCtrl->ChangeValue(_("yes"));
else
editCtrl->ChangeValue(_("no"));
return;
}
else if ( metadata.GetType() == "layer" )
{
gd::ChooseLayerDialog dialog(parent, layout);
if( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.GetChosenLayer());
return;
}
else if ( metadata.GetType() == "joyaxis" )
{
ChoiceJoyAxis dialog(parent, editCtrl->GetValue(), project, layout);
if( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.joyaxis);
return;
}
else if ( metadata.GetType() == "file" )
{
ChoiceFile dialog(parent, editCtrl->GetValue(), project, layout);
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.file);
return;
}
else if ( metadata.GetType() == "objectvar" )
{
if ( paramEdits.empty() ) return;
gd::String objectWanted = paramEdits[0]->GetValue();
gd::Object * object = NULL;
if ( layout.HasObjectNamed(objectWanted) )
object = &layout.GetObject(objectWanted);
else if ( project.HasObjectNamed(objectWanted) )
object = &project.GetObject(objectWanted);
else
return;
gd::ChooseVariableDialog dialog(parent, object->GetVariables());
dialog.SetAssociatedObject(&project, &layout, object);
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.GetSelectedVariable());
return;
}
else if ( metadata.GetType() == "scenevar" )
{
gd::ChooseVariableDialog dialog(parent, layout.GetVariables());
dialog.SetAssociatedLayout(&project, &layout);
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.GetSelectedVariable());
return;
}
else if ( metadata.GetType() == "globalvar" )
{
gd::ChooseVariableDialog dialog(parent, project.GetVariables());
dialog.SetAssociatedProject(&project);
if ( dialog.ShowModal() == 1 )
editCtrl->ChangeValue(dialog.GetSelectedVariable());
return;
}
}