diff options
Diffstat (limited to 'scene/gui/tree.cpp')
-rw-r--r-- | scene/gui/tree.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index d63ef41239..bc7b7485d8 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -6,6 +6,7 @@ /* http://www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1040,7 +1041,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 cache.selected->draw(ci, r); } if (text_editor->is_visible_in_tree()) { - text_editor->set_pos(get_global_pos() + r.pos); + text_editor->set_position(get_global_position() + r.pos); } } @@ -1502,7 +1503,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool cache.click_id = c.buttons[j].id; cache.click_item = p_item; cache.click_column = col; - cache.click_pos = get_global_mouse_pos() - get_global_pos(); + cache.click_pos = get_global_mouse_position() - get_global_position(); update(); //emit_signal("button_pressed"); return -1; @@ -1626,7 +1627,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } popup_menu->set_size(Size2(col_width, 0)); - popup_menu->set_pos(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); + popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); popup_menu->popup(); popup_edited_item = p_item; popup_edited_item_col = col; @@ -1692,7 +1693,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool case TreeItem::CELL_MODE_CUSTOM: { edited_item = p_item; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); + custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2)))); bring_up_editor = false; @@ -1709,7 +1710,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool popup_edited_item = p_item; popup_edited_item_col = col; - pressing_item_rect = Rect2(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); + pressing_item_rect = Rect2(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); pressing_for_editor_text = editor_text; pressing_for_editor = true; @@ -2378,7 +2379,7 @@ bool Tree::edit_selected() { edited_item = s; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + rect.pos, rect.size); + custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size); emit_signal("custom_popup_edited", false); item_edited(col, s); @@ -2393,7 +2394,7 @@ bool Tree::edit_selected() { } popup_menu->set_size(Size2(rect.size.width, 0)); - popup_menu->set_pos(get_global_pos() + rect.pos + Point2i(0, rect.size.height)); + popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height)); popup_menu->popup(); popup_edited_item = s; popup_edited_item_col = col; @@ -2401,8 +2402,8 @@ bool Tree::edit_selected() { } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - Point2i textedpos = get_global_pos() + rect.pos; - text_editor->set_pos(textedpos); + Point2i textedpos = get_global_position() + rect.pos; + text_editor->set_position(textedpos); text_editor->set_size(rect.size); text_editor->clear(); text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step))); @@ -2410,7 +2411,7 @@ bool Tree::edit_selected() { if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - value_editor->set_pos(textedpos + Point2i(0, text_editor->get_size().height)); + value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height)); value_editor->set_size(Size2(rect.size.width, 1)); value_editor->show_modal(); updating_value_editor = true; @@ -2528,7 +2529,7 @@ void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_DRAG_BEGIN) { single_select_defer = NULL; - if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) { + if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) { scrolling = true; set_fixed_process(true); } @@ -2576,7 +2577,7 @@ void Tree::_notification(int p_what) { } if (scrolling) { - Point2 point = get_viewport()->get_mouse_pos() - get_global_pos(); + Point2 point = get_viewport()->get_mouse_position() - get_global_position(); if (point.x < cache.scroll_border) { point.x -= cache.scroll_border; } else if (point.x > get_size().width - cache.scroll_border) { @@ -2912,7 +2913,7 @@ int Tree::get_column_width(int p_column) const { if (expand_area < expanding_total) return columns[p_column].min_width; - ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldnt happen + ERR_FAIL_COND_V(expanding_columns == 0, -1); // shouldn't happen return expand_area * columns[p_column].min_width / expanding_total; } |