diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/control.cpp | 14 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 13 | ||||
-rw-r--r-- | scene/gui/patch_9_rect.cpp | 34 | ||||
-rw-r--r-- | scene/gui/range.cpp | 10 | ||||
-rw-r--r-- | scene/gui/split_container.cpp | 2 |
5 files changed, 35 insertions, 38 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index d2f3eea721..c249d3dd64 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1347,12 +1347,12 @@ Control::AnchorType Control::get_anchor(Margin p_margin) const { void Control::_change_notify_margins() { // this avoids sending the whole object data again on a change - _change_notify("margin/left"); - _change_notify("margin/top"); - _change_notify("margin/right"); - _change_notify("margin/bottom"); - _change_notify("rect/pos"); - _change_notify("rect/size"); + _change_notify("margin_left"); + _change_notify("margin_top"); + _change_notify("margin_right"); + _change_notify("margin_bottom"); + _change_notify("rect_pos"); + _change_notify("rect_size"); } void Control::set_margin(Margin p_margin, float p_value) { @@ -2158,7 +2158,7 @@ void Control::set_rotation(float p_radians) { data.rotation = p_radians; update(); _notify_transform(); - _change_notify("rect/rotation"); + _change_notify("rect_rotation"); } float Control::get_rotation() const { diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 35d54d9843..df8bfcf691 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -177,7 +177,18 @@ void WindowDialog::_notification(int p_what) { Size2 size = get_size(); Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog"); - panel->draw(canvas, Rect2(Point2(), size)); + int margin_left = static_cast<int>(panel->get_margin(MARGIN_LEFT)); + int margin_top = static_cast<int>(panel->get_margin(MARGIN_TOP)); + int margin_right = static_cast<int>(panel->get_margin(MARGIN_RIGHT)); + int margin_bottom = static_cast<int>(panel->get_margin(MARGIN_BOTTOM)); + + Rect2 rect; + rect.pos.x = -margin_left; + rect.pos.y = -margin_top; + rect.size.width = size.width + margin_left + margin_right; + rect.size.height = size.height + margin_top + margin_bottom; + + panel->draw(canvas, rect); int title_height = get_constant("title_height", "WindowDialog"); Color title_color = get_color("title_color", "WindowDialog"); diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index d0bd45e435..e1ac2be7e6 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -37,27 +37,13 @@ void NinePatchRect::_notification(int p_what) { if (texture.is_null()) return; - Size2 s = get_size(); + Rect2 rect = Rect2(Point2(), get_size()); + Rect2 src_rect = region_rect; + + texture->get_rect_region(rect, src_rect, rect, src_rect); + RID ci = get_canvas_item(); - VS::get_singleton()->canvas_item_add_nine_patch(ci, Rect2(Point2(), s), region_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center); - //draw_texture_rect(texture,Rect2(Point2(),s),false,modulate); - - /* - Vector<Point2> points; - points.resize(4); - points[0]=Point2(0,0); - points[1]=Point2(s.x,0); - points[2]=Point2(s.x,s.y); - points[3]=Point2(0,s.y); - Vector<Point2> uvs; - uvs.resize(4); - uvs[0]=Point2(0,0); - uvs[1]=Point2(1,0); - uvs[2]=Point2(1,1); - uvs[3]=Point2(0,1); - - VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid()); -*/ + VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center); } } @@ -116,16 +102,16 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) { minimum_size_changed(); switch (p_margin) { case MARGIN_LEFT: - _change_notify("patch_margin/left"); + _change_notify("patch_margin_left"); break; case MARGIN_TOP: - _change_notify("patch_margin/top"); + _change_notify("patch_margin_top"); break; case MARGIN_RIGHT: - _change_notify("patch_margin/right"); + _change_notify("patch_margin_right"); break; case MARGIN_BOTTOM: - _change_notify("patch_margin/bottom"); + _change_notify("patch_margin_bottom"); break; } } diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index f15f3a6078..626d1d9663 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -33,7 +33,7 @@ void Range::_value_changed_notify() { _value_changed(shared->val); emit_signal("value_changed", shared->val); update(); - _change_notify("range/value"); + _change_notify("value"); } void Range::Shared::emit_value_changed() { @@ -87,26 +87,26 @@ void Range::set_min(double p_min) { shared->min = p_min; set_value(shared->val); - shared->emit_changed("range/min"); + shared->emit_changed("min"); } void Range::set_max(double p_max) { shared->max = p_max; set_value(shared->val); - shared->emit_changed("range/max"); + shared->emit_changed("max"); } void Range::set_step(double p_step) { shared->step = p_step; - shared->emit_changed("range/step"); + shared->emit_changed("step"); } void Range::set_page(double p_page) { shared->page = p_page; set_value(shared->val); - shared->emit_changed("range/page"); + shared->emit_changed("page"); } double Range::get_value() const { diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 5b6f17e0f7..11d068b048 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -185,7 +185,7 @@ void SplitContainer::_resort() { } update(); - _change_notify("split/offset"); + _change_notify("split_offset"); } Size2 SplitContainer::get_minimum_size() const { |