~aleteoryx/muditaos

6dadcc333e4c2a0687b0604b13cbfdf45a93cfb7 — Przemyslaw Brudny 3 years ago 8b2391f
[MOS-250] Added print text edit type for label purposes

Added print text edit type for label purposes.
M module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp => module-apps/apps-common/widgets/TimeSetFmtSpinner.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "TimeSetFmtSpinner.hpp"


@@ 38,7 38,7 @@ namespace gui
        focusChangedCallback = [&](Item &) {
            if (focus) {
                setTimeFormat(this->timeFormat);
                if (editMode != EditMode::Browse) {
                if (editMode == EditMode::Edit) {
                    setFocusItem(timeSetSpinner);
                }
            }

M module-gui/gui/widgets/text/Label.cpp => module-gui/gui/widgets/text/Label.cpp +1 -1
@@ 8,7 8,7 @@ namespace gui
    Label::Label(Item *parent, Position x, Position y, Length w, Length h, const UTF8 &inputText)
        : TextFixedSize(parent, x, y, w, h)
    {
        setEditMode(EditMode::Browse);
        setEditMode(EditMode::Print);
        setCursorStartPosition(CursorStartPosition::DocumentBegin);
        setTextType(TextType::SingleLine);
        drawUnderline(false);

M module-gui/gui/widgets/text/Text.cpp => module-gui/gui/widgets/text/Text.cpp +4 -0
@@ 570,6 570,10 @@ namespace gui
            return false;
        }

        if (isMode(EditMode::Print)) {
            return false;
        }

        if (isMode(EditMode::Scroll) && textType == TextType::MultiLine) {

            debug_text("Text in scroll mode ignores left/right navigation");

M module-gui/gui/widgets/text/TextConstants.hpp => module-gui/gui/widgets/text/TextConstants.hpp +4 -3
@@ 50,9 50,10 @@ namespace gui

    enum class EditMode
    {
        Browse,
        Edit,
        Scroll,
        Print,  /// <- Text in only printed, no navigation, no scrolling, no cursor visible.
        Browse, /// <- Text is printed with navigation enabled, without edit, scrolling and cursor not visible.
        Scroll, /// <- Text is printed with navigation and scroll enabled, without edit and cursor not visible.
        Edit,   /// <- Text is printed with navigation, scroll, cursor visible and edit.
    };

    enum class TextType