~aleteoryx/muditaos

ref: 2cf455dc130a0df575e95cff47ae797353e304e6 muditaos/module-gui/gui/widgets/ImageBox.cpp -rw-r--r-- 887 bytes
2cf455dc — Alex0vSky [MOS-1046] Update module-services/service-cellular/call/doc/README.md 2 years 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "ImageBox.hpp"

using namespace gui;

ImageBox::ImageBox(Item *parent, const Position &x, const Position &y, const Length &w, const Length &h, Image *image)
    : VBox(parent, x, y, w, h), image(image)
{
    setEdges(RectangleEdge::None);
    setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
    addWidget(image);
}

ImageBox::ImageBox(Item *parent, Image *image) : ImageBox(parent, 0, 0, 0, 0, image)
{}

void ImageBox::showImage(bool show)
{
    image->setVisible(show);
}

void ImageBox::setImage(const UTF8 &name, ImageTypeSpecifier specifier)
{
    image->set(name, specifier);
}

void ImageBox::setMinimumSizeToFitImage()
{
    setMinimumSize(image->getWidth(), image->getHeight());
}