neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
image_widget.hpp
Go to the documentation of this file.
1// image_widget.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19#pragma once
20
21#include <neogfx/neogfx.hpp>
24#include <neogfx/gfx/image.hpp>
27
28namespace neogfx
29{
30 class image_widget : public widget<i_image_widget>
31 {
33 public:
34 define_event(ImageChanged, image_changed)
35 define_event(ImageGeometryChanged, image_geometry_changed)
36 public:
37 image_widget(const i_texture& aTexture = texture{}, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
38 image_widget(const i_image& aImage, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
39 image_widget(i_widget& aParent, const i_texture& aTexture = texture{}, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
40 image_widget(i_widget& aParent, const i_image& aImage, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
41 image_widget(i_layout& aLayout, const i_texture& aTexture = texture{}, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
42 image_widget(i_layout& aLayout, const i_image& aImage, aspect_ratio aAspectRatio = aspect_ratio::Keep, cardinal aPlacement = cardinal::Center);
43 public:
44 neogfx::size_policy size_policy() const override;
45 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
46 public:
47 void paint(i_graphics_context& aGc) const override;
48 public:
49 const texture& image() const override;
50 const color_or_gradient& image_color() const override;
51 void set_image(i_string const& aImageUri) override;
52 void set_image(const i_image& aImage) override;
53 void set_image(const i_texture& aImage) override;
54 void set_image_color(const color_or_gradient& aImageColor) override;
55 void set_aspect_ratio(neogfx::aspect_ratio aAspectRatio) override;
56 void set_placement(cardinal aPlacement) override;
57 void set_dpi_auto_scale(bool aDpiAutoScale) override;
58 public:
60 private:
61 texture iTexture;
62 color_or_gradient iColor;
63 neogfx::aspect_ratio iAspectRatio;
64 cardinal iPlacement;
65 bool iDpiAutoScale;
66 };
67}
rect placement_rect() const
void set_dpi_auto_scale(bool aDpiAutoScale) override
const texture & image() const override
void paint(i_graphics_context &aGc) const override
void set_image(const i_image &aImage) override
void set_image(const i_texture &aImage) override
void set_image_color(const color_or_gradient &aImageColor) override
void set_image(i_string const &aImageUri) override
void set_aspect_ratio(neogfx::aspect_ratio aAspectRatio) override
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
neogfx::size_policy size_policy() const override
const color_or_gradient & image_color() const override
void set_placement(cardinal aPlacement) override
#define meta_object(...)
Definition i_object.hpp:28
#define define_event(name, declName,...)
Definition event.hpp:200