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
>
22
#include <
neolib/core/i_enum.hpp
>
23
#include <
neogfx/gui/widget/widget.hpp
>
24
#include <
neogfx/gfx/image.hpp
>
25
#include <
neogfx/gfx/texture.hpp
>
26
#include <
neogfx/gui/widget/i_image_widget.hpp
>
27
28
namespace
neogfx
29
{
30
class
image_widget
:
public
widget
<i_image_widget>
31
{
32
meta_object
(
widget<i_image_widget>
)
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
:
59
rect
placement_rect
()
const
;
60
private
:
61
texture
iTexture;
62
color_or_gradient
iColor;
63
neogfx::aspect_ratio
iAspectRatio;
64
cardinal
iPlacement;
65
bool
iDpiAutoScale;
66
};
67
}
neogfx::basic_rect
Definition
geometrical.hpp:761
neogfx::basic_size< coordinate >
neogfx::i_graphics_context
Definition
i_graphics_context.hpp:124
neogfx::i_image
Definition
i_image.hpp:35
neogfx::i_layout
Definition
i_layout.hpp:231
neogfx::i_texture
Definition
i_texture.hpp:84
neogfx::i_widget
Definition
i_widget.hpp:50
neogfx::image_widget
Definition
image_widget.hpp:31
neogfx::image_widget::placement_rect
rect placement_rect() const
neogfx::image_widget::set_dpi_auto_scale
void set_dpi_auto_scale(bool aDpiAutoScale) override
neogfx::image_widget::image
const texture & image() const override
neogfx::image_widget::paint
void paint(i_graphics_context &aGc) const override
neogfx::image_widget::set_image
void set_image(const i_image &aImage) override
neogfx::image_widget::set_image
void set_image(const i_texture &aImage) override
neogfx::image_widget::set_image_color
void set_image_color(const color_or_gradient &aImageColor) override
neogfx::image_widget::set_image
void set_image(i_string const &aImageUri) override
neogfx::image_widget::set_aspect_ratio
void set_aspect_ratio(neogfx::aspect_ratio aAspectRatio) override
neogfx::image_widget::minimum_size
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
neogfx::image_widget::size_policy
neogfx::size_policy size_policy() const override
neogfx::image_widget::image_color
const color_or_gradient & image_color() const override
neogfx::image_widget::set_placement
void set_placement(cardinal aPlacement) override
neogfx::texture
Definition
texture.hpp:35
neogfx::widget
Definition
widget.hpp:35
neolib::i_string
Definition
i_string.hpp:49
neolib::optional
Definition
optional.hpp:55
neolib::variant< color, gradient >
image.hpp
texture.hpp
widget.hpp
i_enum.hpp
i_image_widget.hpp
neogfx
Definition
action.hpp:28
neogfx::cardinal
cardinal
Definition
i_geometry.hpp:56
neogfx::cardinal::Center
@ Center
neogfx::aspect_ratio
aspect_ratio
Definition
i_geometry.hpp:48
neogfx::aspect_ratio::Keep
@ Keep
meta_object
#define meta_object(...)
Definition
i_object.hpp:28
neogfx.hpp
define_event
#define define_event(name, declName,...)
Definition
event.hpp:200
include
neogfx
gui
widget
image_widget.hpp
Generated by
1.9.8