|
@@ -667,7 +667,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
|
} else {
|
|
} else {
|
|
Ref<InputEventKey> k = p_event;
|
|
Ref<InputEventKey> k = p_event;
|
|
|
|
|
|
- if (k.is_valid() && k->get_unicode()) {
|
|
|
|
|
|
+ if (allow_search && k.is_valid() && k->get_unicode()) {
|
|
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
|
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
|
uint64_t diff = now - search_time_msec;
|
|
uint64_t diff = now - search_time_msec;
|
|
uint64_t max_interval = uint64_t(GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000));
|
|
uint64_t max_interval = uint64_t(GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000));
|
|
@@ -1273,6 +1273,14 @@ bool ItemList::get_allow_reselect() const {
|
|
return allow_reselect;
|
|
return allow_reselect;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void ItemList::set_allow_search(bool p_allow) {
|
|
|
|
+ allow_search = p_allow;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool ItemList::get_allow_search() const {
|
|
|
|
+ return allow_search;
|
|
|
|
+}
|
|
|
|
+
|
|
void ItemList::set_icon_scale(real_t p_scale) {
|
|
void ItemList::set_icon_scale(real_t p_scale) {
|
|
ERR_FAIL_COND(Math::is_nan(p_scale) || Math::is_inf(p_scale));
|
|
ERR_FAIL_COND(Math::is_nan(p_scale) || Math::is_inf(p_scale));
|
|
icon_scale = p_scale;
|
|
icon_scale = p_scale;
|
|
@@ -1437,6 +1445,9 @@ void ItemList::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &ItemList::set_allow_reselect);
|
|
ClassDB::bind_method(D_METHOD("set_allow_reselect", "allow"), &ItemList::set_allow_reselect);
|
|
ClassDB::bind_method(D_METHOD("get_allow_reselect"), &ItemList::get_allow_reselect);
|
|
ClassDB::bind_method(D_METHOD("get_allow_reselect"), &ItemList::get_allow_reselect);
|
|
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("set_allow_search", "allow"), &ItemList::set_allow_search);
|
|
|
|
+ ClassDB::bind_method(D_METHOD("get_allow_search"), &ItemList::get_allow_search);
|
|
|
|
+
|
|
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
|
|
ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height);
|
|
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
|
|
ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height);
|
|
|
|
|
|
@@ -1459,6 +1470,7 @@ void ItemList::_bind_methods() {
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode");
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_reselect"), "set_allow_reselect", "get_allow_reselect");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select");
|
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_search"), "set_allow_search", "get_allow_search");
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_text_lines", PROPERTY_HINT_RANGE, "1,10,1,or_greater"), "set_max_text_lines", "get_max_text_lines");
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_text_lines", PROPERTY_HINT_RANGE, "1,10,1,or_greater"), "set_max_text_lines", "get_max_text_lines");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height");
|
|
ADD_GROUP("Columns", "");
|
|
ADD_GROUP("Columns", "");
|
|
@@ -1495,6 +1507,7 @@ ItemList::ItemList() {
|
|
|
|
|
|
fixed_column_width = 0;
|
|
fixed_column_width = 0;
|
|
same_column_width = false;
|
|
same_column_width = false;
|
|
|
|
+ allow_search = true;
|
|
max_text_lines = 1;
|
|
max_text_lines = 1;
|
|
max_columns = 1;
|
|
max_columns = 1;
|
|
auto_height = false;
|
|
auto_height = false;
|