MCPcopy Create free account
hub / github.com/MyGUI/mygui / addContext

Method addContext

Demos/Demo_Pointers/PointerContextManager.cpp:33–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 2

createSceneMethod · 0.80

Calls 6

isHighLevelMethod · 0.80
getByNameMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected