#pragma once
#include "mborder.h"

struct button_args {
	WARG(linear_color, normal_color, linear_color(0.2f, 0.2f, 0.2f, 1))
	WARG(linear_color, hover_color, linear_color(0.1f, 0.1f, 0.1f, 1))
	WARG(linear_color, pressed_color, linear_color(0.05f, 0.05f, 0.05f, 1))
};

class mbutton : public mborder<button_args> {
public:
	mbutton();
	void init() override;
	void setup_widget(const button_args& in_args) override;
	void on_paint(mirage_paint_context& in_context) override;

	void on_click(const Eigen::Vector2f& in_position, mouse_button in_button) override;
	void on_double_click(const Eigen::Vector2f& in_position, mouse_button in_button) override;
	hit_test_handle on_mouse_move(const Eigen::Vector2f& in_position) override { return hit_test_handle::handled(); }
	void on_mouse_enter() override;
	void on_mouse_leave() override;
	hit_test_handle on_mouse_button_down(const Eigen::Vector2f& in_position, mouse_button in_button) override;
	hit_test_handle on_mouse_button_up(const Eigen::Vector2f& in_position, mouse_button in_button) override;
private:
	linear_color normal_color_;
	linear_color hover_color_;
	linear_color pressed_color_;

	linear_color color_;
};
