2016-09-11 14:28:01 +00:00
|
|
|
#include "color_rect.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
void ColorRect::set_frame_color(const Color& p_color) {
|
2016-09-11 14:28:01 +00:00
|
|
|
|
|
|
|
color=p_color;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
Color ColorRect::get_frame_color() const{
|
2016-09-11 14:28:01 +00:00
|
|
|
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
void ColorRect::_notification(int p_what) {
|
2016-09-11 14:28:01 +00:00
|
|
|
|
|
|
|
if (p_what==NOTIFICATION_DRAW) {
|
|
|
|
draw_rect(Rect2(Point2(),get_size()),color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
void ColorRect::_bind_methods() {
|
2016-09-11 14:28:01 +00:00
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
ClassDB::bind_method(_MD("set_frame_color","color"),&ColorRect::set_frame_color);
|
|
|
|
ClassDB::bind_method(_MD("get_frame_color"),&ColorRect::get_frame_color);
|
2016-09-11 14:28:01 +00:00
|
|
|
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR,"color"),_SCS("set_frame_color"),_SCS("get_frame_color") );
|
|
|
|
}
|
|
|
|
|
2017-01-12 21:27:27 +00:00
|
|
|
ColorRect::ColorRect() {
|
2016-09-11 14:28:01 +00:00
|
|
|
|
|
|
|
color=Color(1,1,1);
|
|
|
|
}
|
|
|
|
|