bac2a2edc5 Exclude SDL2 from Windows compilation. 5b859bfd84 WaylandDisplayBackend: If the clicked window has a locked mouse, hide the cursor afterwards ce76df6aa6 WaylandDisplayBackend: Add a TODO about XDG_Activation a0ba04275b WaylandDisplayWindow: Move XDG Activation Token outside activate() git-subtree-dir: libraries/ZWidget git-subtree-split: bac2a2edc52cf12d1223244251876e9c4533e614
31 lines
495 B
C++
31 lines
495 B
C++
|
|
#pragma once
|
|
|
|
#include "../../core/widget.h"
|
|
#include "../../core/image.h"
|
|
|
|
enum ImageBoxMode
|
|
{
|
|
Center,
|
|
Contain,
|
|
Cover
|
|
};
|
|
|
|
class ImageBox : public Widget
|
|
{
|
|
public:
|
|
ImageBox(Widget* parent);
|
|
|
|
void SetImage(std::shared_ptr<Image> newImage);
|
|
void SetImageMode(ImageBoxMode mode);
|
|
|
|
double GetPreferredWidth() const;
|
|
double GetPreferredHeight() const;
|
|
|
|
protected:
|
|
void OnPaint(Canvas* canvas) override;
|
|
|
|
private:
|
|
std::shared_ptr<Image> image;
|
|
ImageBoxMode mode = ImageBoxMode::Center;
|
|
};
|