1#include "themed_canvas_overlay.h"
7 const auto& theme = cgv::gui::theme_info::instance();
8 init_container_style(theme);
13 register_shader(
"rectangle", cgv::g2d::shaders::rectangle);
18 canvas_overlay::begin_content(ctx, clear_frame_buffer);
21 content_canvas.enable_shader(ctx,
"rectangle");
22 content_canvas.set_style(ctx, container_style_);
24 content_canvas.disable_current_shader(ctx);
29 init_container_style(theme);
36 container_style_.fill_color = theme.group();
37 container_style_.border_color = theme.background();
38 container_style_.border_width =
static_cast<float>(theme.spacing());
39 container_style_.feather_width = 0.0f;
44 rectangle.scale(-padding_);
48void themed_canvas_overlay::set_background_visible(
bool flag) {
virtual void on_set(void *member_ptr) override
default implementation of that calls handle_member_change and afterwards upates the member in the gui...
bool init(cgv::render::context &ctx) override
this method is called after creation or recreation of the context, return whether all necessary funct...
void set_margin(const ivec2 &margin)
set the overlay margin
cgv::g2d::irect get_local_rectangle() const
return the current rectangle area of the overlay in local space, i.e. with position set to zero
virtual void handle_theme_change(const cgv::gui::theme_info &theme) override
override in your class to handle theme changes
cgv::g2d::irect get_content_rectangle() const
return the current rectangle area of the themed_overlay content
bool init(cgv::render::context &ctx) override
this method is called after creation or recreation of the context, return whether all necessary funct...
bool background_visible_
whether the background is visible (true by default)
themed_canvas_overlay()
creates an overlay in the bottom left corner with zero size using a canvas for 2d drawing
base class for all drawables, which is independent of the used rendering API.