1.10 |
#include <imageholder.h>
Public Member Functions | |
ImageHolder (const Image &image, const std::string &text, const Rect &rect, const AlignFlags &text_align=T::default_text_align()) noexcept | |
ImageHolder (const Image &image, const std::string &text={}, const AlignFlags &text_align=T::default_text_align()) noexcept | |
ImageHolder (const ImageHolder &) noexcept=delete | |
ImageHolder (const std::string &text={}, const AlignFlags &text_align=T::default_text_align()) noexcept | |
ImageHolder (Frame &parent, const Image &image, const std::string &text, const Rect &rect, const AlignFlags &text_align=T::default_text_align()) noexcept | |
ImageHolder (Frame &parent, const Image &image={}, const std::string &text={}, const AlignFlags &text_align=T::default_text_align()) noexcept | |
ImageHolder (ImageHolder &&) noexcept=default | |
ImageHolder (Serializer::Properties &props) noexcept | |
virtual | ~ImageHolder ()=default |
bool | auto_scale_image () const |
Get the auto scale image state. | |
void | auto_scale_image (bool enable) |
Enable/disable the auto scale of the image. | |
void | draw (Painter &painter, const Rect &rect) override |
EGT_NODISCARD float | hscale () const |
Get the horizontal scale value. | |
void | hscale (float hscale) |
Set the horizontal scale value. | |
Image & | image () |
Get a non-const reference to the image. | |
EGT_NODISCARD const Image & | image () const |
Get a const reference of the image. | |
void | image (const Image &image) |
Set a new Image. | |
EGT_NODISCARD AlignFlags | image_align () const |
Get the image alignment. | |
void | image_align (const AlignFlags &align) |
Set the alignment of the image relative to the text. | |
EGT_NODISCARD SizeF | image_scale () const |
Get both scale values. | |
void | image_scale (const SizeF &scale) |
Scale the image in both direction. | |
void | image_scale (float scale) |
Scale the image in both direction with the same ratio. | |
bool | keep_image_ratio () const |
Get the keep image ratio state. | |
void | keep_image_ratio (bool enable) |
Enable/disable ratio preservation while scaling the image. | |
EGT_NODISCARD Size | min_size_hint () const override |
ImageHolder & | operator= (const ImageHolder &) noexcept=delete |
ImageHolder & | operator= (ImageHolder &&) noexcept=default |
void | reset_uri () |
Reset the URI, therefore clear the current image, if any. | |
void | scale_image (float hscale, float vscale, bool approximate=false) |
Scale the image. | |
void | scale_image (float scale, bool approximate=false) |
Scale the image. | |
void | serialize (Serializer &serializer) const override |
EGT_NODISCARD bool | show_label () const |
Get the show label state. | |
void | show_label (bool value) |
Enable/disable showing the label text. | |
EGT_NODISCARD std::string | type () const override |
EGT_NODISCARD std::string | uri () const |
Get the URI of the current image. | |
void | uri (const std::string &uri) |
Load a new Image from an uri. | |
EGT_NODISCARD float | vscale () const |
Get the vertical scale value. | |
void | vscale (float vscale) |
Set the vertical scale value. | |
Static Public Member Functions | |
static void | default_draw (ImageHolder &widget, Painter &painter, const Rect &rect) |
Default draw method for the widget. | |
Protected Member Functions | |
ImageHolder (Serializer::Properties &props, bool is_derived) noexcept | |
void | deserialize (Serializer::Properties &props) |
void | refresh () |
Protected Attributes | |
Image | m_image |
The image. Allowed to be empty. | |
AlignFlags | m_image_align {AlignFlag::left | AlignFlag::expand} |
Alignment of the image relative to the text. | |
bool | m_show_label {true} |
When true, the label text is shown. | |
|
inlineexplicitnoexcept |
[in] | text | The text to display. |
[in] | text_align | Alignment for the text. |
|
inlineexplicitnoexcept |
[in] | image | The image to display. |
[in] | text | The text to display. |
[in] | text_align | Alignment for the text. |
|
inlineexplicitnoexcept |
[in] | image | The image to display. |
[in] | text | The text to display. |
[in] | rect | Initial rectangle of the widget. |
[in] | text_align | Alignment for the text. |
|
inlineexplicitnoexcept |
[in] | parent | The parent Frame. |
[in] | image | The image to display. |
[in] | text | The text to display. |
[in] | text_align | Alignment for the text. |
|
inlinenoexcept |
[in] | parent | The parent Frame. |
[in] | image | The image to display. |
[in] | text | The text to display. |
[in] | rect | Initial rectangle of the widget. |
[in] | text_align | Alignment for the text. |
|
inlineexplicitnoexcept |
[in] | props | list of arguments and its properties. |
|
deletenoexcept |
|
defaultnoexcept |
|
virtualdefault |
|
inlineexplicitprotectednoexcept |
|
inline |
Get the auto scale image state.
|
inline |
Enable/disable the auto scale of the image.
If enabled, the image will be automatically scaled to fit within the button box. By default, set to true.
|
inlinestatic |
Default draw method for the widget.
|
inlineprotected |
|
inline |
Get the horizontal scale value.
|
inline |
Set the horizontal scale value.
|
inline |
Get a non-const reference to the image.
|
inline |
Get a const reference of the image.
|
inline |
Get the image alignment.
|
inline |
Set the alignment of the image relative to the text.
[in] | align | Only left, right, top, and bottom alignments are supported. |
|
inline |
Get both scale values.
|
inline |
Scale the image in both direction.
|
inline |
Scale the image in both direction with the same ratio.
|
inline |
Get the keep image ratio state.
|
inline |
Enable/disable ratio preservation while scaling the image.
If enabled, the original image ratio won't be changed during the image auto scale operation. By default, set to true.
|
inlineoverride |
Reimplemented in StringItem.
|
deletenoexcept |
|
defaultnoexcept |
|
inlineprotected |
|
inline |
Reset the URI, therefore clear the current image, if any.
|
inline |
Scale the image.
Change the scale of the image.
[in] | hscale | Horizontal scale [0.0 - 1.0], with 1.0 being 100%. |
[in] | vscale | Vertical scale [0.0 - 1.0], with 1.0 being 100%. |
[in] | approximate | Approximate the scale to increase image cache hit efficiency. |
This scales relative to the original size of the image. Not the result of any subsequent Image::resize() or Image::scale() call.
|
inline |
Scale the image.
[in] | scale | Vertical and horizontal scale [0.0 - 1.0], with 1.0 being 100%. |
[in] | approximate | Approximate the scale to increase image cache hit efficiency. |
|
inlineoverride |
|
inline |
Get the show label state.
|
inline |
Enable/disable showing the label text.
[in] | value | When true, the label text is shown. |
|
inlineoverride |
|
inline |
Get the URI of the current image.
|
inline |
Load a new Image from an uri.
[in] | uri | The URI of the image to load. |
|
inline |
Get the vertical scale value.
|
inline |
Set the vertical scale value.
|
protected |
The image. Allowed to be empty.
|
protected |
Alignment of the image relative to the text.
|
protected |
When true, the label text is shown.