MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / AddUIControl

Method AddUIControl

Source/IDrawableModule.cpp:907–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

905}
906
907void IDrawableModule::AddUIControl(IUIControl* control)
908{
909 try
910 {
911 std::string name = control->Name();
912 if (CanModuleTypeSaveState() && name.empty() == false)
913 {
914 IUIControl* dupe = FindUIControl(name.c_str(), false);
915 if (dupe != nullptr)
916 {
917 if (dynamic_cast<ClickButton*>(control) != nullptr && dynamic_cast<ClickButton*>(dupe) != nullptr)
918 {
919 //they're both just buttons, this is fine
920 }
921 else if (!dupe->GetShouldSaveState())
922 {
923 //we're duplicating the name of a non-saving ui control, assume that we are also not saving (hopefully that's true), and this is fine
924 }
925 else
926 {
927 assert(false); //can't have multiple ui controls with the same name!
928 }
929 }
930 }
931 }
932 catch (UnknownUIControlException& e)
933 {
934 }
935
936 mUIControls.push_back(control);
937 FloatSlider* slider = dynamic_cast<FloatSlider*>(control);
938 if (slider)
939 {
940 mSliderMutex.lock();
941 mFloatSliders.push_back(slider);
942 mSliderMutex.unlock();
943 }
944}
945
946void IDrawableModule::RemoveUIControl(IUIControl* control, bool cleanUpReferences /* = true */)
947{

Callers 10

CodeEntryMethod · 0.80
RadioButtonMethod · 0.80
CheckboxMethod · 0.80
GridControlTargetMethod · 0.80
FloatSliderMethod · 0.80
IntSliderMethod · 0.80
ConstructMethod · 0.80
DropdownListMethod · 0.80
ClickButtonMethod · 0.80
ADSRDisplayMethod · 0.80

Calls 3

emptyMethod · 0.80
GetShouldSaveStateMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected