Added second argument to ItemList.item_selected
This commit is contained in:
parent
b9b6102b91
commit
f95c8a69fc
|
@ -619,7 +619,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
if (!selected || allow_reselect) {
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), i);
|
||||
emit_signal(SNAME("item_selected"), i, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
} else {
|
||||
emit_signal(SNAME("multi_selected"), i, true);
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(i);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -678,7 +678,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current - current_columns);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(i);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current + current_columns);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current - current_columns * i);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
break;
|
||||
|
@ -733,7 +733,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current + current_columns * i);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
|
||||
|
@ -747,7 +747,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current - 1);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(current + 1);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
accept_event();
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
set_current(i);
|
||||
ensure_current_is_visible();
|
||||
if (select_mode == SELECT_SINGLE) {
|
||||
emit_signal(SNAME("item_selected"), current);
|
||||
emit_signal(SNAME("item_selected"), current, mb->get_button_index() == MOUSE_BUTTON_LEFT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1621,7 +1621,7 @@ void ItemList::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(SELECT_SINGLE);
|
||||
BIND_ENUM_CONSTANT(SELECT_MULTI);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
|
||||
ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "left")));
|
||||
ADD_SIGNAL(MethodInfo("item_rmb_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position")));
|
||||
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected")));
|
||||
ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index")));
|
||||
|
|
Loading…
Reference in a new issue