Files
MuditaOS/module-gui/gui/widgets/Icon.cpp
jimmorrisson 14918dc4f9 [EGD-4925] Change new filesystem handling implementation in module-gui. (#1193)
Due to vfs deprecation there is need to remove all vfs calls from code. This PR covers module gui. There are some modifications in other modules included which are necessary because of build system issues.
2020-12-16 15:23:11 +01:00

54 lines
1.6 KiB
C++

// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "Icon.hpp"
#include "TextParse.hpp"
#include <i18n/i18n.hpp>
#include <Style.hpp>
#include <Font.hpp>
using namespace gui;
namespace style
{
namespace img
{
constexpr uint32_t x = 176;
constexpr uint32_t y = 90;
} // namespace img
namespace text
{
constexpr uint32_t x = 40;
constexpr uint32_t y = 247;
constexpr uint32_t w = 400;
constexpr uint32_t h = 66;
constexpr Color color = {7, 0};
} // namespace text
} // namespace style
Icon::Icon(Item *parent,
const uint32_t &x,
const uint32_t &y,
const uint32_t &w,
const uint32_t &h,
const UTF8 imageName,
const UTF8 &str)
: Rect(parent, x, y, w, h)
{
setEdges(RectangleEdge::None);
setPenFocusWidth(style::window::default_border_no_focus_w);
setPenWidth(style::window::default_border_no_focus_w);
new Image(this, style::img::x, style::img::y, imageName);
text = new Text(this, style::text::x, style::text::y, style::text::w, style::text::h);
text->setTextType(TextType::MultiLine);
text->setEditMode(EditMode::Browse);
text->setEdges(RectangleEdge::None);
text->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
auto format = TextFormat(Font(27).raw(), Color(7, 0));
for (auto &el : textToTextBlocks(str, format)) {
text->addText(el);
}
}