Commit a4ff0567 authored by Jan Köster's avatar Jan Köster
Browse files

effects added widgets

parent a3e00954
Loading
Loading
Loading
Loading
+50 −0
Changes for editor/widgets/container/container.cpp: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ extern "C" {
            std::string verticalAlign = "";
            std::string m_verticalAlign = "";

            // Box shadow
            std::string boxShadow = "none";
            std::string m_boxShadow = "";

            // Visibility
            bool hidden = false;
            bool m_hidden = false;
@@ -273,6 +277,7 @@ extern "C" {
                addField("padding", "Padding", "text", "e.g. 10px 20px", "desktop");
                addField("margin", "Margin", "text", "e.g. 10px auto", "desktop");
                addField("vertical_align", "Vertical Align", "select", nullptr, "desktop", mkOpts({"top","center","bottom"}));
                addField("box_shadow", "Box Shadow", "select", nullptr, "desktop", mkOpts({"none","sm","md","lg","card","float","inner"}));
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
                {
                    json_object *hf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
@@ -290,6 +295,7 @@ extern "C" {
                addField("m_width", "Mobile Width", "text", "e.g. 100%", "mobile");
                addField("m_height", "Mobile Height", "text", "e.g. auto", "mobile");
                addField("m_vertical_align", "Mobile Vertical Align", "select", nullptr, "mobile", mkOpts({"top","center","bottom"}));
                addField("m_box_shadow", "Mobile Box Shadow", "select", nullptr, "mobile", mkOpts({"none","sm","md","lg","card","float","inner"}));
                addField("m_hidden", "Mobile Hidden", "checkbox", nullptr, "mobile");
                {
                    json_object *mhf = json_object_array_get_idx(arr, json_object_array_length(arr) - 1);
@@ -347,6 +353,8 @@ extern "C" {
                // Vertical alignment
                element->SetAttribute("vertical_align", verticalAlign.c_str());
                element->SetAttribute("m_vertical_align", m_verticalAlign.c_str());
                element->SetAttribute("box_shadow", boxShadow.c_str());
                element->SetAttribute("m_box_shadow", m_boxShadow.c_str());

                // Visibility
                element->SetAttribute("hidden", hidden ? "true" : "false");
@@ -448,6 +456,10 @@ extern "C" {
                if (loaded_va) verticalAlign = loaded_va;
                const char* loaded_m_va = xml_data->Attribute("m_vertical_align");
                if (loaded_m_va) m_verticalAlign = loaded_m_va;
                const char* loaded_bs = xml_data->Attribute("box_shadow");
                if (loaded_bs) boxShadow = loaded_bs;
                const char* loaded_m_bs = xml_data->Attribute("m_box_shadow");
                if (loaded_m_bs) m_boxShadow = loaded_m_bs;

                // Visibility
                const char* loaded_hidden = xml_data->Attribute("hidden");
@@ -497,6 +509,8 @@ extern "C" {
                json_object_object_add(obj, "m_height", json_object_new_string(m_height.c_str()));
                json_object_object_add(obj, "vertical_align", json_object_new_string(verticalAlign.c_str()));
                json_object_object_add(obj, "m_vertical_align", json_object_new_string(m_verticalAlign.c_str()));
                json_object_object_add(obj, "box_shadow", json_object_new_string(boxShadow.c_str()));
                json_object_object_add(obj, "m_box_shadow", json_object_new_string(m_boxShadow.c_str()));
                json_object_object_add(obj, "hidden", json_object_new_boolean(hidden));
                json_object_object_add(obj, "m_hidden", json_object_new_boolean(m_hidden));
                json_object_object_add(obj, "custom_css", json_object_new_string(customCss.c_str()));
@@ -624,6 +638,14 @@ extern "C" {
                    val = json_object_get_string(val_obj);
                    if (val) m_verticalAlign = val;
                }
                if (json_object_object_get_ex(obj, "box_shadow", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) boxShadow = val;
                }
                if (json_object_object_get_ex(obj, "m_box_shadow", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) m_boxShadow = val;
                }
                if (json_object_object_get_ex(obj, "hidden", &val_obj)) {
                    if (json_object_is_type(val_obj, json_type_string)) {
                        const char *s = json_object_get_string(val_obj);
@@ -696,6 +718,19 @@ extern "C" {
                    else if (verticalAlign == "center") style += " justify-content: center;";
                    else if (verticalAlign == "bottom") style += " justify-content: flex-end;";
                }
                if (boxShadow != "none" && !boxShadow.empty()) {
                    auto shadowCss = [](const std::string &key) -> std::string {
                        if (key == "sm")    return "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)";
                        if (key == "md")    return "0 4px 8px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12)";
                        if (key == "lg")    return "0 10px 25px rgba(0,0,0,0.15), 0 6px 10px rgba(0,0,0,0.10)";
                        if (key == "card")  return "0 2px 15px rgba(0,0,0,0.10)";
                        if (key == "float") return "0 20px 40px rgba(0,0,0,0.20)";
                        if (key == "inner") return "inset 0 2px 8px rgba(0,0,0,0.15)";
                        return "";
                    };
                    std::string css = shadowCss(boxShadow);
                    if (!css.empty()) style += " box-shadow: " + css + ";";
                }
                if (hidden) {
                    style += " display: none;";
                }
@@ -736,6 +771,21 @@ extern "C" {
                    else if (m_verticalAlign == "center") mobileCSS += " justify-content: center !important;";
                    else if (m_verticalAlign == "bottom") mobileCSS += " justify-content: flex-end !important;";
                }
                if (!m_boxShadow.empty() && m_boxShadow != "none") {
                    auto shadowCss = [](const std::string &key) -> std::string {
                        if (key == "sm")    return "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)";
                        if (key == "md")    return "0 4px 8px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12)";
                        if (key == "lg")    return "0 10px 25px rgba(0,0,0,0.15), 0 6px 10px rgba(0,0,0,0.10)";
                        if (key == "card")  return "0 2px 15px rgba(0,0,0,0.10)";
                        if (key == "float") return "0 20px 40px rgba(0,0,0,0.20)";
                        if (key == "inner") return "inset 0 2px 8px rgba(0,0,0,0.15)";
                        return "";
                    };
                    std::string css = shadowCss(m_boxShadow);
                    if (!css.empty()) mobileCSS += " box-shadow: " + css + " !important;";
                } else if (m_boxShadow == "none") {
                    mobileCSS += " box-shadow: none !important;";
                }
                if (m_hidden) mobileCSS += " display: none !important;";
                else if (hidden) {
                    if (!m_verticalAlign.empty() || !verticalAlign.empty())
+12 −0
Changes for editor/widgets/textbox/textbox.cpp: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ extern "C" {
            std::string fontWeight   = "normal";
            std::string fontStyle    = "normal";
            std::string whiteSpace      = "normal";
            std::string textDecoration  = "none";

            // Icon
            std::string icon         = "none";
@@ -267,6 +268,7 @@ extern "C" {
                addField("font_weight", "Font Weight", "select", nullptr, "all", mkOpts({"normal","bold","lighter","bolder"}));
                addField("font_style", "Font Style", "select", nullptr, "all", mkOpts({"normal","italic","oblique"}));
                addField("white_space", "Zeilenumbruch", "select", nullptr, "all", mkOpts({"normal","nowrap","pre","pre-wrap","pre-line","break-spaces"}));
                addField("text_decoration", "Text Decoration", "select", nullptr, "all", mkOpts({"none","underline","overline","line-through","underline overline"}));
                addField("icon", "Icon", "select", nullptr, "all", mkOpts({"none","phone","address","email","arrow_left","arrow_right","arrow_up","arrow_down"}));
                addField("icon_color", "Icon Color", "color_var", nullptr, "all");
                addField("hidden", "Hidden", "checkbox", nullptr, "desktop");
@@ -301,6 +303,7 @@ extern "C" {
                element->SetAttribute("font_weight", fontWeight.c_str());
                element->SetAttribute("font_style", fontStyle.c_str());
                element->SetAttribute("white_space", whiteSpace.c_str());
                element->SetAttribute("text_decoration", textDecoration.c_str());
                element->SetAttribute("icon", icon.c_str());
                element->SetAttribute("icon_color", iconColor.c_str());

@@ -363,6 +366,9 @@ extern "C" {
                val = xml_data->Attribute("white_space");
                if (val) whiteSpace = val;

                val = xml_data->Attribute("text_decoration");
                if (val) textDecoration = val;

                val = xml_data->Attribute("icon");
                if (val) icon = val;

@@ -417,6 +423,7 @@ extern "C" {
                json_object_object_add(obj, "font_weight", json_object_new_string(fontWeight.c_str()));
                json_object_object_add(obj, "font_style", json_object_new_string(fontStyle.c_str()));
                json_object_object_add(obj, "white_space", json_object_new_string(whiteSpace.c_str()));
                json_object_object_add(obj, "text_decoration", json_object_new_string(textDecoration.c_str()));
                json_object_object_add(obj, "icon", json_object_new_string(icon.c_str()));
                json_object_object_add(obj, "icon_color", json_object_new_string(iconColor.c_str()));
                json_object_object_add(obj, "width", json_object_new_string(width.c_str()));
@@ -474,6 +481,10 @@ extern "C" {
                    val = json_object_get_string(val_obj);
                    if (val) whiteSpace = val;
                }
                if (json_object_object_get_ex(obj, "text_decoration", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) textDecoration = val;
                }
                if (json_object_object_get_ex(obj, "icon", &val_obj)) {
                    val = json_object_get_string(val_obj);
                    if (val) icon = val;
@@ -558,6 +569,7 @@ extern "C" {
                if (fontWeight != "normal") style += " font-weight: " + fontWeight + ";";
                if (fontStyle != "normal") style += " font-style: " + fontStyle + ";";
                if (whiteSpace != "normal") style += " white-space: " + whiteSpace + ";";
                if (textDecoration != "none" && !textDecoration.empty()) style += " text-decoration: " + textDecoration + ";";
                if (hidden) style += " display: none;";

                box.setAttribute("style", style.c_str());