| 31 | } |
| 32 | |
| 33 | void PointerContextManager::addContext(std::string_view _name) |
| 34 | { |
| 35 | bool found = false; |
| 36 | for (const auto& context : mContexts) |
| 37 | { |
| 38 | if (_name == context->getResourceName()) |
| 39 | { |
| 40 | found = true; |
| 41 | break; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | if (!found) |
| 46 | { |
| 47 | MyGUI::IResource* resource_generic = MyGUI::ResourceManager::getInstance().getByName(_name, false); |
| 48 | if (resource_generic != nullptr) |
| 49 | { |
| 50 | ResourcePointerContext* resource = resource_generic->castType<ResourcePointerContext>(false); |
| 51 | if (resource != nullptr) |
| 52 | { |
| 53 | if (!isHighLevelContext()) |
| 54 | { |
| 55 | mContexts.push_back(resource); |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | // вставляем перед первым хаем |
| 60 | for (VectorContext::iterator item = mContexts.begin(); item != mContexts.end(); ++item) |
| 61 | { |
| 62 | if ((*item)->isHighLevel()) |
| 63 | { |
| 64 | mContexts.insert(item, resource); |
| 65 | break; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | updateCursor(); |
| 74 | } |
| 75 | |
| 76 | void PointerContextManager::removeContext(std::string_view _name) |
| 77 | { |