2017-02-02 21:22:03 +01:00
|
|
|
#include "color_rect.h"
|
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
void ColorFrame::set_frame_color(const Color &p_color) {
|
2017-02-02 21:22:03 +01:00
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
color = p_color;
|
2017-02-02 21:22:03 +01:00
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
Color ColorFrame::get_frame_color() const {
|
2017-02-02 21:22:03 +01:00
|
|
|
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ColorFrame::_notification(int p_what) {
|
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
if (p_what == NOTIFICATION_DRAW) {
|
|
|
|
draw_rect(Rect2(Point2(), get_size()), color);
|
2017-02-02 21:22:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ColorFrame::_bind_methods() {
|
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
ObjectTypeDB::bind_method(_MD("set_frame_color", "color"), &ColorFrame::set_frame_color);
|
|
|
|
ObjectTypeDB::bind_method(_MD("get_frame_color"), &ColorFrame::get_frame_color);
|
2017-02-02 21:22:03 +01:00
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), _SCS("set_frame_color"), _SCS("get_frame_color"));
|
2017-02-02 21:22:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ColorFrame::ColorFrame() {
|
|
|
|
|
2017-03-19 00:36:26 +01:00
|
|
|
color = Color(1, 1, 1);
|
2017-02-02 21:22:03 +01:00
|
|
|
}
|