Rename raise() to move_to_front()
This commit is contained in:
parent
0f62e357e0
commit
b218727599
12 changed files with 25 additions and 32 deletions
|
@ -500,6 +500,13 @@
|
|||
Transformations issued by [param event]'s inputs are applied in local space instead of global space.
|
||||
</description>
|
||||
</method>
|
||||
<method name="move_to_front">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Moves this node to display on top of its siblings. This has more use in [Control], as [Node2D] can be ordered with [member Node2D.z_index].
|
||||
Internally, the node is moved to the bottom of parent's children list. The method has no effect on nodes without a parent.
|
||||
</description>
|
||||
</method>
|
||||
<method name="queue_redraw">
|
||||
<return type="void" />
|
||||
<description>
|
||||
|
|
|
@ -577,12 +577,6 @@
|
|||
Queues a node for deletion at the end of the current frame. When deleted, all of its child nodes will be deleted as well. This method ensures it's safe to delete the node, contrary to [method Object.free]. Use [method Object.is_queued_for_deletion] to check whether a node will be deleted at the end of the frame.
|
||||
</description>
|
||||
</method>
|
||||
<method name="raise">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Moves this node to the bottom of parent node's children hierarchy. This is often useful in GUIs ([Control] nodes), because their order of drawing depends on their order in the tree. The top Node is drawn first, then any siblings below the top Node in the hierarchy are successively drawn on top of it. After using [code]raise[/code], a Control will be drawn on top of its siblings.
|
||||
</description>
|
||||
</method>
|
||||
<method name="remove_and_skip">
|
||||
<return type="void" />
|
||||
<description>
|
||||
|
|
|
@ -3375,7 +3375,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed
|
|||
singleton->main_editor_button_vb->add_child(tb);
|
||||
singleton->editor_table.push_back(p_editor);
|
||||
|
||||
singleton->distraction_free->raise();
|
||||
singleton->distraction_free->move_to_front();
|
||||
}
|
||||
singleton->editor_data.add_editor_plugin(p_editor);
|
||||
singleton->add_child(p_editor);
|
||||
|
@ -4965,7 +4965,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
|
|||
}
|
||||
|
||||
if (atidx == i) {
|
||||
node->raise();
|
||||
node->move_to_front();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -5390,7 +5390,7 @@ Button *EditorNode::add_bottom_panel_item(String p_text, Control *p_item) {
|
|||
tb->set_toggle_mode(true);
|
||||
tb->set_focus_mode(Control::FOCUS_NONE);
|
||||
bottom_panel_vb->add_child(p_item);
|
||||
bottom_panel_hb->raise();
|
||||
bottom_panel_hb->move_to_front();
|
||||
bottom_panel_hb_editors->add_child(tb);
|
||||
p_item->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
p_item->hide();
|
||||
|
@ -5424,7 +5424,7 @@ void EditorNode::make_bottom_panel_item_visible(Control *p_item) {
|
|||
void EditorNode::raise_bottom_panel_item(Control *p_item) {
|
||||
for (int i = 0; i < bottom_panel_items.size(); i++) {
|
||||
if (bottom_panel_items[i].control == p_item) {
|
||||
bottom_panel_items[i].button->raise();
|
||||
bottom_panel_items[i].button->move_to_front();
|
||||
SWAP(bottom_panel_items.write[i], bottom_panel_items.write[bottom_panel_items.size() - 1]);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -577,7 +577,7 @@ void EditorAssetLibrary::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("AssetLib")));
|
||||
error_label->raise();
|
||||
error_label->move_to_front();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
|
|
|
@ -176,7 +176,7 @@ void ProgressDialog::add_task(const String &p_task, const String &p_label, int p
|
|||
} else {
|
||||
cancel_hb->hide();
|
||||
}
|
||||
cancel_hb->raise();
|
||||
cancel_hb->move_to_front();
|
||||
cancelled = false;
|
||||
_popup();
|
||||
if (p_can_cancel) {
|
||||
|
|
|
@ -1086,7 +1086,7 @@ void ColorPicker::_screen_pick_pressed() {
|
|||
} else {
|
||||
screen->show();
|
||||
}
|
||||
screen->raise();
|
||||
screen->move_to_front();
|
||||
#ifndef _MSC_VER
|
||||
#warning show modal no longer works, needs to be converted to a popup
|
||||
#endif
|
||||
|
|
|
@ -351,7 +351,7 @@ void GraphEdit::_graph_node_raised(Node *p_gn) {
|
|||
if (gn->is_comment()) {
|
||||
move_child(gn, 0);
|
||||
} else {
|
||||
gn->raise();
|
||||
gn->move_to_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,6 +369,13 @@ void CanvasItem::queue_redraw() {
|
|||
MessageQueue::get_singleton()->push_callable(callable_mp(this, &CanvasItem::_redraw_callback));
|
||||
}
|
||||
|
||||
void CanvasItem::move_to_front() {
|
||||
if (!get_parent()) {
|
||||
return;
|
||||
}
|
||||
get_parent()->move_child(this, get_parent()->get_child_count() - 1);
|
||||
}
|
||||
|
||||
void CanvasItem::set_modulate(const Color &p_modulate) {
|
||||
if (modulate == p_modulate) {
|
||||
return;
|
||||
|
@ -897,6 +904,7 @@ void CanvasItem::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("hide"), &CanvasItem::hide);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("queue_redraw"), &CanvasItem::queue_redraw);
|
||||
ClassDB::bind_method(D_METHOD("move_to_front"), &CanvasItem::move_to_front);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_as_top_level", "enable"), &CanvasItem::set_as_top_level);
|
||||
ClassDB::bind_method(D_METHOD("is_set_as_top_level"), &CanvasItem::is_set_as_top_level);
|
||||
|
|
|
@ -198,6 +198,7 @@ public:
|
|||
void hide();
|
||||
|
||||
void queue_redraw();
|
||||
void move_to_front();
|
||||
|
||||
void set_clip_children(bool p_enabled);
|
||||
bool is_clipping_children() const;
|
||||
|
|
|
@ -389,21 +389,6 @@ void Node::_move_child(Node *p_child, int p_pos, bool p_ignore_end) {
|
|||
data.blocked--;
|
||||
}
|
||||
|
||||
void Node::raise() {
|
||||
if (!data.parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Internal children move within a different index range.
|
||||
if (_is_internal_front()) {
|
||||
data.parent->move_child(this, data.parent->data.internal_children_front - 1);
|
||||
} else if (_is_internal_back()) {
|
||||
data.parent->move_child(this, data.parent->data.internal_children_back - 1);
|
||||
} else {
|
||||
data.parent->move_child(this, data.parent->get_child_count(false) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Node::_propagate_groups_dirty() {
|
||||
for (const KeyValue<StringName, GroupData> &E : data.grouped) {
|
||||
if (E.value.group) {
|
||||
|
@ -2816,7 +2801,6 @@ void Node::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("is_in_group", "group"), &Node::is_in_group);
|
||||
ClassDB::bind_method(D_METHOD("move_child", "child_node", "to_position"), &Node::move_child);
|
||||
ClassDB::bind_method(D_METHOD("get_groups"), &Node::_get_groups);
|
||||
ClassDB::bind_method(D_METHOD("raise"), &Node::raise);
|
||||
ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner);
|
||||
ClassDB::bind_method(D_METHOD("get_owner"), &Node::get_owner);
|
||||
ClassDB::bind_method(D_METHOD("remove_and_skip"), &Node::remove_and_skip);
|
||||
|
|
|
@ -348,7 +348,6 @@ public:
|
|||
|
||||
void move_child(Node *p_child, int p_pos);
|
||||
void _move_child(Node *p_child, int p_pos, bool p_ignore_end = false);
|
||||
void raise();
|
||||
|
||||
void set_owner(Node *p_owner);
|
||||
Node *get_owner() const;
|
||||
|
|
|
@ -2103,7 +2103,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
|
|||
p_control->set_as_top_level(true);
|
||||
p_control->set_position(gui.last_mouse_pos);
|
||||
p_base->get_root_parent_control()->add_child(p_control); // Add as child of viewport.
|
||||
p_control->raise();
|
||||
p_control->move_to_front();
|
||||
|
||||
gui.drag_preview_id = p_control->get_instance_id();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue