void ObjectListDialogsHelper::MakeObjectItem(wxTreeCtrl * objectsList, wxTreeItemId item, const gd::Object & object, bool globalObject) { objectsList->SetItemText(item, object.GetName()); objectsList->SetItemImage(item, MakeObjectItemThumbnail(objectsList, object)); objectsList->SetItemData(item, new gd::TreeItemStringData(globalObject ? "GlobalObject" : "LayoutObject")); if (globalObject) objectsList->SetItemBold(item, true); }
RuntimeObject::RuntimeObject(RuntimeScene &scene, const gd::Object &object) : name(object.GetName()), type(object.GetType()), X(0), Y(0), zOrder(0), hidden(false), objectVariables(object.GetVariables()) { ClearForce(); behaviors.clear(); // Insert the new behaviors. for (auto it = object.GetAllBehaviors().cbegin(); it != object.GetAllBehaviors().cend(); ++it) { behaviors[it->first] = std::unique_ptr<gd::Behavior>(it->second->Clone()); behaviors[it->first]->SetOwner(this); } }
RuntimeObject::RuntimeObject(RuntimeScene & scene, const gd::Object & object) : name(object.GetName()), type(object.GetType()), X(0), Y(0), zOrder(0), hidden(false), objectVariables(object.GetVariables()) { ClearForce(); //Do not forget to delete behaviors which are managed using raw pointers. for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it ) delete it->second; behaviors.clear(); //And insert the new ones. for (std::map<gd::String, Behavior* >::const_iterator it = object.GetAllBehaviors().begin() ; it != object.GetAllBehaviors().end(); ++it ) { behaviors[it->first] = it->second->Clone(); behaviors[it->first]->SetOwner(this); } }
int ObjectListDialogsHelper::MakeObjectItemThumbnail(wxTreeCtrl * objectsList, const gd::Object & object) { wxLogNull noLogPlease; //Discard any warning when loading thumbnails. int thumbnailID = -1; wxBitmap thumbnail; if (objectsList->GetImageList() && object.GenerateThumbnail(project, thumbnail) && thumbnail.IsOk() ) { objectsList->GetImageList()->Add(thumbnail); thumbnailID = objectsList->GetImageList()->GetImageCount()-1; } return thumbnailID; }
std::set < std::string > EventsVariablesFinder::FindAllObjectVariables(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, const gd::Object & object) { std::set < std::string > results; std::set < std::string > results2 = FindArgumentsInEvents(platform, project, layout, layout.GetEvents(), "objectvar", object.GetName()); results.insert(results2.begin(), results2.end()); return results; }