| 2839 | } |
| 2840 | |
| 2841 | ScriptingObjects::ScriptedLookAndFeel::CSSLaf::CSSLaf(ScriptedLookAndFeel* parent_, ScriptContentComponent* content, Component* c, const ValueTree& data, const ValueTree& ad): |
| 2842 | LafBase(), |
| 2843 | StyleSheetLookAndFeel(*content), |
| 2844 | parent(parent_), |
| 2845 | dataCopy(data), |
| 2846 | additionalDataCopy(ad), |
| 2847 | componentToStyle(c) |
| 2848 | { |
| 2849 | this->root.css.addIsolatedCollection(c, parent->currentStyleSheetFile, parent->css); |
| 2850 | |
| 2851 | simple_css::Selector id(simple_css::SelectorType::ID, data["id"].toString()); |
| 2852 | |
| 2853 | StringArray initIds; |
| 2854 | initIds.add(id.toString()); |
| 2855 | |
| 2856 | initIds.addArray(StringArray::fromTokens(ad["class"].toString(), " ", "")); |
| 2857 | |
| 2858 | simple_css::FlexboxComponent::Helpers::writeSelectorsToProperties(*c, initIds); |
| 2859 | |
| 2860 | |
| 2861 | if(auto ptr = root.css.getForComponent(c)) |
| 2862 | { |
| 2863 | root.css.setAnimator(&root.animator); |
| 2864 | |
| 2865 | auto cursor = ptr->getMouseCursor(); |
| 2866 | |
| 2867 | if(cursor != MouseCursor()) |
| 2868 | c->setMouseCursor(cursor); |
| 2869 | |
| 2870 | Component::SafePointer<Component> safe(c); |
| 2871 | |
| 2872 | auto updateProperty = [safe](Identifier v, var newValue) |
| 2873 | { |
| 2874 | if(safe.getComponent() != nullptr) |
| 2875 | { |
| 2876 | if(auto root = simple_css::CSSRootComponent::find(*safe.getComponent())) |
| 2877 | { |
| 2878 | if(auto ptr2 = root->css.getForComponent(safe.getComponent())) |
| 2879 | { |
| 2880 | if(v == Identifier("class")) |
| 2881 | { |
| 2882 | auto t = StringArray::fromTokens(newValue.toString(), " ", ""); |
| 2883 | |
| 2884 | Array<var> classIds; |
| 2885 | |
| 2886 | for(auto& c: t) |
| 2887 | classIds.add(var(c)); |
| 2888 | |
| 2889 | safe->getProperties().set(v, classIds); |
| 2890 | root->css.clearCache(safe); |
| 2891 | |
| 2892 | if(auto ptr3 = root->css.getForComponent(safe.getComponent())) |
| 2893 | { |
| 2894 | ptr3->copyVarProperties(ptr2); |
| 2895 | } |
| 2896 | |
| 2897 | } |
| 2898 | else |
nothing calls this directly
no test coverage detected