summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authortoger5 <toger5@hotmail.de>2017-08-08 16:14:47 +0200
committertoger5 <toger5@hotmail.de>2017-08-15 20:11:36 +0200
commit701fb55a108bd83d9a1e6c6bc4bfe61539df333d (patch)
tree9c26415abcb1ff13d8120f04857577c912849328 /scene
parent015494ba56fc393b9e83a51dca76979eecc3d3c2 (diff)
styleBoxFlat removed light, dark color entirely
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/style_box.cpp48
-rw-r--r--scene/resources/style_box.h7
-rw-r--r--scene/resources/theme.cpp4
3 files changed, 8 insertions, 51 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 68dba9a98a..6729d9d762 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -291,29 +291,6 @@ Color StyleBoxFlat::get_bg_color() const {
return bg_color;
}
-void StyleBoxFlat::set_light_color(const Color &p_color) {
-
- set_border_color(MARGIN_LEFT, p_color);
- set_border_color(MARGIN_TOP, p_color);
- set_border_color(MARGIN_RIGHT, p_color);
- emit_changed();
-}
-
-Color StyleBoxFlat::get_light_color() const {
-
- return get_border_color(MARGIN_TOP);
-}
-
-void StyleBoxFlat::set_dark_color(const Color &p_color) {
- set_border_color(MARGIN_BOTTOM, p_color);
- emit_changed();
-}
-
-Color StyleBoxFlat::get_dark_color() const {
-
- return get_border_color(MARGIN_BOTTOM);
-}
-
void StyleBoxFlat::set_border_color_all(const Color &p_color) {
for (int i = 0; i < 4; i++) {
@@ -321,6 +298,10 @@ void StyleBoxFlat::set_border_color_all(const Color &p_color) {
}
emit_changed();
}
+Color StyleBoxFlat::get_border_color_all() const {
+
+ return border_color[MARGIN_TOP];
+}
void StyleBoxFlat::set_border_color(Margin p_border, const Color &p_color) {
border_color.write()[p_border] = p_color;
@@ -497,7 +478,6 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color
}
int rings = (border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0) ? 1 : 2;
rings = 2;
- //TODO: check if the border_width is not too big... so it gets sized negative
int ring_corner_radius[4];
set_inner_corner_radius(style_rect, ring_rect, corner_radius, ring_corner_radius);
@@ -677,17 +657,11 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
}
} else if (!(border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0)) {
//DRAW INNER BORDER AA
- // for (int i = 0; i < 4; i++) {
- // aa_border_width[i] = ((border_width[i] == 0) ? 0 : aa_size);
- // }
draw_ring(verts, indices, colors, style_rect, adapted_corner,
infill_rect, aa_border_width, border_color_alpha, border_color.read().ptr(), corner_detail);
}
//DRAW OUTER BORDER AA
if (!(border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0)) {
- // for (int i = 0; i < 4; i++) {
- // aa_border_width[i] = ((border_width[i] == 0) ? 0 : aa_size);
- // }
draw_ring(verts, indices, colors, style_rect, adapted_corner,
style_rect.grow(aa_size), aa_border_width, border_color.read().ptr(), border_color_alpha, corner_detail);
}
@@ -705,16 +679,7 @@ void StyleBoxFlat::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_bg_color"), &StyleBoxFlat::get_bg_color);
ClassDB::bind_method(D_METHOD("set_border_color", "color"), &StyleBoxFlat::set_border_color_all);
- ClassDB::bind_method(D_METHOD("get_border_color", "color"), &StyleBoxFlat::get_light_color);
-
- // ClassDB::bind_method(D_METHOD("set_border_color", "margin", "color"), &StyleBoxFlat::set_border_color);
- // ClassDB::bind_method(D_METHOD("get_border_color", "margin"), &StyleBoxFlat::get_border_color);
-
- ClassDB::bind_method(D_METHOD("set_light_color", "color"), &StyleBoxFlat::set_light_color);
- ClassDB::bind_method(D_METHOD("get_light_color"), &StyleBoxFlat::get_light_color);
-
- ClassDB::bind_method(D_METHOD("set_dark_color", "color"), &StyleBoxFlat::set_dark_color);
- ClassDB::bind_method(D_METHOD("get_dark_color"), &StyleBoxFlat::get_dark_color);
+ ClassDB::bind_method(D_METHOD("get_border_color", "color"), &StyleBoxFlat::get_border_color_all);
ClassDB::bind_method(D_METHOD("set_border_width_all", "width"), &StyleBoxFlat::set_border_width_all);
ClassDB::bind_method(D_METHOD("get_border_width_min"), &StyleBoxFlat::get_border_width_min);
@@ -764,9 +729,6 @@ void StyleBoxFlat::_bind_methods() {
ADD_GROUP("Border", "border_");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "border_color"), "set_border_color", "get_border_color");
- // ADD_PROPERTYI(PropertyInfo(Variant::COLOR, "border_color_top"), "set_border_color", "get_border_color", MARGIN_TOP);
- // ADD_PROPERTYI(PropertyInfo(Variant::COLOR, "border_color_right"), "set_border_color", "get_border_color", MARGIN_RIGHT);
- // ADD_PROPERTYI(PropertyInfo(Variant::COLOR, "border_color_bottom"), "set_border_color", "get_border_color", MARGIN_BOTTOM);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "border_blend"), "set_border_blend", "get_border_blend");
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 30a63ff67e..0d96d4092f 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -147,14 +147,9 @@ public:
void set_bg_color(const Color &p_color);
Color get_bg_color() const;
- void set_light_color(const Color &p_color);
- Color get_light_color() const;
-
- void set_dark_color(const Color &p_color);
- Color get_dark_color() const;
-
//Border Color
void set_border_color_all(const Color &p_color);
+ Color get_border_color_all() const;
void set_border_color(Margin p_border, const Color &p_color);
Color get_border_color(Margin p_border) const;
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 945a4307d5..ac1bb105ac 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -929,8 +929,8 @@ RES ResourceFormatLoaderTheme::load(const String &p_path, const String &p_origin
dark = Color::html(params[3]);
}
- sbflat->set_dark_color(dark);
- sbflat->set_light_color(bright);
+ sbflat->set_border_color_all(bright);
+ // sbflat->set_dark_color(dark);
sbflat->set_bg_color(normal);
if (params.size() == ccodes + 5) {