Support setting image_provider in ui::label
This commit is contained in:
parent
e7a1d1b265
commit
e51480db0a
2 changed files with 13 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
#include <psemek/ui/element.hpp>
|
#include <psemek/ui/element.hpp>
|
||||||
#include <psemek/ui/box_shape.hpp>
|
#include <psemek/ui/box_shape.hpp>
|
||||||
#include <psemek/ui/tagged_text.hpp>
|
#include <psemek/ui/tagged_text.hpp>
|
||||||
|
#include <psemek/ui/image_provider.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
@ -58,6 +59,9 @@ namespace psemek::ui
|
||||||
virtual void set_skip_spaces(bool value);
|
virtual void set_skip_spaces(bool value);
|
||||||
virtual bool skip_spaces() const { return skip_spaces_; }
|
virtual bool skip_spaces() const { return skip_spaces_; }
|
||||||
|
|
||||||
|
virtual struct image_provider * set_image_provider(struct image_provider * provider);
|
||||||
|
virtual struct image_provider * image_provider() const { return image_provider_; }
|
||||||
|
|
||||||
struct shape const & shape() const override { return shape_; }
|
struct shape const & shape() const override { return shape_; }
|
||||||
void reshape(geom::box<float, 2> const & bbox) override;
|
void reshape(geom::box<float, 2> const & bbox) override;
|
||||||
|
|
||||||
|
|
@ -83,6 +87,8 @@ namespace psemek::ui
|
||||||
overflow_mode overflow_ = overflow_mode::ignore;
|
overflow_mode overflow_ = overflow_mode::ignore;
|
||||||
bool skip_spaces_ = false;
|
bool skip_spaces_ = false;
|
||||||
|
|
||||||
|
struct image_provider * image_provider_ = nullptr;
|
||||||
|
|
||||||
box_shape shape_;
|
box_shape shape_;
|
||||||
|
|
||||||
struct text_chunk
|
struct text_chunk
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,13 @@ namespace psemek::ui
|
||||||
on_state_changed();
|
on_state_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image_provider * label::set_image_provider(struct image_provider * provider)
|
||||||
|
{
|
||||||
|
std::swap(provider, image_provider_);
|
||||||
|
on_state_changed();
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
void label::set_overflow(overflow_mode value)
|
void label::set_overflow(overflow_mode value)
|
||||||
{
|
{
|
||||||
overflow_ = value;
|
overflow_ = value;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue