AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ADrawableView Class Reference

Simple view to draw an IDrawable. More...

#include <AUI/View/ADrawableView.h>

Detailed Description

ADrawableView brings you more control over the drawable. This is useful for drawables with extended interface (i.e., AAnimatedImage).

See declarative::Icon for a declarative form and examples.

The sizing and positioning acts like ass::BackgroundImage. Moreover, these rules are taken from ass::BackgroundImage applied to ADrawableView:

auto drawable = IDrawable::fromUrl(":animation.webp");
_new<ADrawableView>(drawable) with_style {
  BackgroundImage({}, {}, {}, Sizing::COVER), // <- drawable is sized and positioned as with COVER.
};
auto drawable() const
Drawable property.
Definition ADrawableView.h:56
static API_AUI_VIEWS _< IDrawable > fromUrl(const AUrl &url) noexcept
Creates a drawable from an url.
#define with_style
Allows to define a style to the view right in place.
Definition kAUI.h:287
Note
When applying ass::BackgroundImage, do not pass url to it, it's redundant for ADrawableView and would cause a debug error.

Constructor & Destructor Documentation

◆ ADrawableView() [1/2]

ADrawableView::ADrawableView ( const AUrl & url)
explicit
Parameters
urlURL to the image resource.

◆ ADrawableView() [2/2]

ADrawableView::ADrawableView ( _< IDrawable > drawable)
explicit
Parameters
drawableThe IDrawable to be rendered.

Member Function Documentation

> All members, including inherited

◆ render()

void ADrawableView::render ( ARenderContext ctx)
overridevirtual
See also
AView::drawView

AView::render is not guaranteed to be called on per-frame basis. Moreover, this method can be called multiple times if render-to-texture caching decides to do so.

Reimplemented from AView.