Files
MuditaOS/module-gui/gui/widgets/ImageBox.cpp
Maciej Gibowicz 7088002df3 [BH-1860] Add new clock face with quotes
In the settings, the user can choose a clock face with quotes. A
dedicated clock face includes information about the time, alarm
settings, quote and author of the quote.
2024-02-22 12:07:30 +01:00

39 lines
1.0 KiB
C++

// Copyright (c) 2017-2024, 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::fitBoxToImage()
{
setMinimumSize(image->getWidth(), image->getHeight());
setMaximumSize(image->getWidth(), image->getHeight());
}
void ImageBox::setMinimumSizeToFitImage()
{
setMinimumSize(image->getWidth(), image->getHeight());
}