summaryrefslogtreecommitdiff
path: root/scene/gui/item_list.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/item_list.cpp')
-rw-r--r--scene/gui/item_list.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 526950dbb3..5e662b8df0 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -32,7 +32,7 @@
#include "core/os/os.h"
#include "core/project_settings.h"
-void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) {
+void ItemList::add_item(const String &p_item, const Ref<Texture2D> &p_texture, bool p_selectable) {
Item item;
item.icon = p_texture;
@@ -51,7 +51,7 @@ void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, boo
shape_changed = true;
}
-void ItemList::add_icon_item(const Ref<Texture> &p_item, bool p_selectable) {
+void ItemList::add_icon_item(const Ref<Texture2D> &p_item, bool p_selectable) {
Item item;
item.icon = p_item;
@@ -110,7 +110,7 @@ String ItemList::get_item_tooltip(int p_idx) const {
return items[p_idx].tooltip;
}
-void ItemList::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
+void ItemList::set_item_icon(int p_idx, const Ref<Texture2D> &p_icon) {
ERR_FAIL_INDEX(p_idx, items.size());
@@ -119,9 +119,9 @@ void ItemList::set_item_icon(int p_idx, const Ref<Texture> &p_icon) {
shape_changed = true;
}
-Ref<Texture> ItemList::get_item_icon(int p_idx) const {
+Ref<Texture2D> ItemList::get_item_icon(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture>());
+ ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture2D>());
return items[p_idx].icon;
}
@@ -201,7 +201,7 @@ Color ItemList::get_item_custom_fg_color(int p_idx) const {
return items[p_idx].custom_fg;
}
-void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture> &p_tag_icon) {
+void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon) {
ERR_FAIL_INDEX(p_idx, items.size());
@@ -209,9 +209,9 @@ void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture> &p_tag_icon) {
update();
shape_changed = true;
}
-Ref<Texture> ItemList::get_item_tag_icon(int p_idx) const {
+Ref<Texture2D> ItemList::get_item_tag_icon(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture>());
+ ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture2D>());
return items[p_idx].tag_icon;
}
@@ -1398,7 +1398,7 @@ void ItemList::_set_items(const Array &p_items) {
for (int i = 0; i < p_items.size(); i += 3) {
String text = p_items[i + 0];
- Ref<Texture> icon = p_items[i + 1];
+ Ref<Texture2D> icon = p_items[i + 1];
bool disabled = p_items[i + 2];
int idx = get_item_count();
@@ -1542,7 +1542,6 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll);
- ClassDB::bind_method(D_METHOD("_scroll_changed"), &ItemList::_scroll_changed);
ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input);
ClassDB::bind_method(D_METHOD("_set_items"), &ItemList::_set_items);
@@ -1561,7 +1560,7 @@ void ItemList::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_column_width", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), "set_fixed_column_width", "get_fixed_column_width");
ADD_GROUP("Icon", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_mode", PROPERTY_HINT_ENUM, "Top,Left"), "set_icon_mode", "get_icon_mode");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "icon_scale"), "set_icon_scale", "get_icon_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "icon_scale"), "set_icon_scale", "get_icon_scale");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "fixed_icon_size"), "set_fixed_icon_size", "get_fixed_icon_size");
BIND_ENUM_CONSTANT(ICON_MODE_TOP);
@@ -1599,7 +1598,7 @@ ItemList::ItemList() {
add_child(scroll_bar);
shape_changed = true;
- scroll_bar->connect("value_changed", this, "_scroll_changed");
+ scroll_bar->connect("value_changed", callable_mp(this, &ItemList::_scroll_changed));
set_focus_mode(FOCUS_ALL);
current_columns = 1;