1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00
OpenMW/apps/openmw/mwgui/backgroundimage.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
993 B
C++
Raw Normal View History

#ifndef OPENMW_MWGUI_BACKGROUNDIMAGE_H
#define OPENMW_MWGUI_BACKGROUNDIMAGE_H
#include <MyGUI_ImageBox.h>
namespace MWGui
{
/**
* @brief A variant of MyGUI::ImageBox with aspect ratio correction using black bars
*/
2020-02-13 21:36:56 +01:00
class BackgroundImage final : public MyGUI::ImageBox
{
MYGUI_RTTI_DERIVED(BackgroundImage)
public:
2018-10-09 10:21:12 +04:00
BackgroundImage()
: mChild(nullptr)
, mAspect(0)
{
}
/**
* @param fixedRatio Use a fixed ratio of 4:3, regardless of the image dimensions
* @param stretch Stretch to fill the whole screen, or add black bars?
*/
void setBackgroundImage(const std::string& image, bool fixedRatio = true, bool stretch = true);
void setSize(const MyGUI::IntSize& _value) override;
void setCoord(const MyGUI::IntCoord& _value) override;
private:
MyGUI::ImageBox* mChild;
double mAspect;
void adjustSize();
};
}
#endif