~aleteoryx/muditaos

79947489dc2a70aa71b6d9ffe8d0d44a6862ad23 — Przemyslaw Brudny 4 years ago b83605d
[EGD-3363] Added color setter to Text

Added color setter to Text.
M module-apps/application-messages/widgets/SMSInputWidget.cpp => module-apps/application-messages/widgets/SMSInputWidget.cpp +2 -5
@@ 86,11 86,8 @@ namespace gui

                if (inputText->isEmpty()) {

                    // Temporary solution to be fixed when proper Text Color handling will be added.
                    auto format = TextFormat(Font(27).raw(), Color(7, 0));
                    for (auto &el : textToTextBlocks(utils::translate("sms_temp_reply"), format)) {
                        inputText->addText(el);
                    }
                    inputText->setColor(Color(7, 0));
                    inputText->setText(utils::translate("sms_temp_reply"));
                }

                application->getWindow(gui::name::window::thread_view)

M module-gui/gui/widgets/text/Text.cpp => module-gui/gui/widgets/text/Text.cpp +7 -0
@@ 293,6 293,13 @@ namespace gui
            padding.right = value;
    }

    void Text::setColor(Color color)
    {
        if (format.getColor() != color) {
            format.setColor(color);
        }
    }

    void Text::setPadding(const Padding &value)
    {
        if (padding != value) {

M module-gui/gui/widgets/text/Text.hpp => module-gui/gui/widgets/text/Text.hpp +1 -0
@@ 155,6 155,7 @@ namespace gui
        void setMinimumWidthToFitText();
        void setMinimumWidthToFitText(const UTF8 &text);
        void setMinimumHeightToFitText(unsigned int linesCount = 1);
        void setColor(Color color);

        // virtual methods from Item
        bool onInput(const InputEvent &inputEvent) override;