



#include <flare_gui/draggable_region.h>



#include <allegro_flare/color.h>

#include <allegro5/allegro_primitives.h>

#include <flare_gui/collision_box.h>
#include <flare_gui/widget_parent.h>






FGUIDraggableRegion::FGUIDraggableRegion(FGUIParent *parent, float x, float y, float w, float h)
	: FGUIWidget(parent, new FGUICollisionBox(x, y, w, h))
{}



void FGUIDraggableRegion::on_draw()
{
	placement2d *placement = gimmie_placement();
	al_draw_filled_rounded_rectangle(0, 0, placement->w, placement->h, 5, 5, color::color(color::black, 0.1));
}



void FGUIDraggableRegion::on_drag(float x, float y, float dx, float dy)
{
	if (parent)
	{
		placement2d *parent_placement = parent->gimmie_placement();
		parent_placement->x += dx;
		parent_placement->y += dy;
	}
}
