~aleteoryx/muditaos

muditaos/module-gui/gui/widgets/ImageBoxWithText.hpp -rw-r--r-- 1.3 KiB
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#pragma once

#include <ImageBox.hpp>
#include <TextFixedSize.hpp>

namespace gui

{
    namespace imageBoxWithText
    {
        inline constexpr auto wh                 = 100;
        inline constexpr auto text_margin_top    = 11;
        inline constexpr auto text_margin_bottom = 5;
        inline constexpr auto font               = style::window::font::verysmall;
        inline constexpr auto fontBold           = style::window::font::verysmallbold;
    } // namespace imageBoxWithText

    class ImageBoxWithText : public ImageBox
    {
      public:
        ImageBoxWithText(Item *parent,
                         const Position &x,
                         const Position &y,
                         const Length &w,
                         const Length &h,
                         Image *image,
                         const UTF8 &description);
        ImageBoxWithText(Item *parent, Image *image, const UTF8 &description);
        ~ImageBoxWithText() override = default;

        void setText(const UTF8 &description);
        void setMinimumSizeToFitImage() override;

      protected:
        TextFixedSize *text;
    };
}; // namespace gui