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

Method getFreeSelector

Tools/EditorFramework/ScopeTextureControl.cpp:416–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414 }
415
416 SelectorControl* ScopeTextureControl::getFreeSelector(
417 VectorSelector& _selectors,
418 bool _backType,
419 SelectorType _type,
420 bool& _changes)
421 {
422 for (auto& selector : _selectors)
423 {
424 if (!selector.first->getVisible())
425 {
426 if (selector.second == _type)
427 {
428 selector.first->setVisible(true);
429 return selector.first;
430 }
431 }
432 }
433
434 _changes = true;
435
436 SelectorControl* control = nullptr;
437
438 if (_backType)
439 {
440 if (_type == SelectorPosition)
441 control = new PositionSelectorBlackControl();
442 else if (_type == SelectorOffsetH)
443 control = new HorizontalSelectorBlackControl();
444 else if (_type == SelectorOffsetV)
445 control = new VerticalSelectorBlackControl();
446 }
447 else
448 {
449 if (_type == SelectorPosition)
450 control = new PositionSelectorControl();
451 else if (_type == SelectorPositionReadOnly)
452 control = new PositionSelectorControl();
453 else if (_type == SelectorCoord)
454 control = new AreaSelectorControl();
455 else if (_type == SelectorOffsetH)
456 control = new HorizontalSelectorControl();
457 else if (_type == SelectorOffsetV)
458 control = new VerticalSelectorControl();
459
460 control->eventChangePosition.connect(this, &ScopeTextureControl::notifyChangePosition);
461 }
462
463 MYGUI_ASSERT(control != nullptr, "Selector type not found");
464
465 addSelectorControl(control);
466
467 if (_type == SelectorPositionReadOnly)
468 control->setEnabled(false);
469
470 _selectors.emplace_back(control, _type);
471
472 return control;
473 }

Callers

nothing calls this directly

Calls 5

addSelectorControlFunction · 0.85
getVisibleMethod · 0.45
setVisibleMethod · 0.45
connectMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected