Make checkbox nicer

This commit is contained in:
dec05eba
2024-09-11 19:19:10 +02:00
parent 234cc3391e
commit cb04c11b2c
10 changed files with 107 additions and 46 deletions

View File

@@ -4,6 +4,7 @@
#include <mglpp/graphics/Color.hpp>
#include <mglpp/graphics/Text.hpp>
#include <mglpp/graphics/Sprite.hpp>
namespace gsr {
class CheckBox : public Widget {
@@ -17,12 +18,16 @@ namespace gsr {
mgl::vec2f get_size() override;
void set_checked(bool checked);
void set_checked(bool checked, bool animated = false);
bool is_checked() const;
private:
void apply_animation();
mgl::vec2f get_checkbox_size();
private:
mgl::Text text;
mgl::Sprite background_sprite;
mgl::Sprite circle_sprite;
bool checked = false;
float toggle_animation_value = 0.0f;
};
}

View File

@@ -24,6 +24,10 @@ namespace gsr {
void reset_scroll();
private:
void apply_animation();
void limit_scroll(double child_height);
void limit_scroll_cursor(mgl::Window &window, double child_height, double scrollbar_empty_space);
void draw_scrollbar();
float get_scrollbar_width() const;
private:
mgl::vec2f size;