PopupMenu.get_current_index() bound to ClassDB

(cherry picked from commit 35f30086de)
This commit is contained in:
nobuyuki_nyuu 2020-05-06 15:27:35 -05:00 committed by Rémi Verschelde
parent e637fe9dd3
commit 12386a2d80
2 changed files with 7 additions and 0 deletions

View File

@ -1063,6 +1063,11 @@ bool PopupMenu::is_item_shortcut_disabled(int p_idx) const {
return items[p_idx].shortcut_is_disabled;
}
int PopupMenu::get_current_index() const {
return mouse_over;
}
int PopupMenu::get_item_count() const {
return items.size();
@ -1443,6 +1448,7 @@ void PopupMenu::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_tooltip", "idx"), &PopupMenu::get_item_tooltip);
ClassDB::bind_method(D_METHOD("get_item_shortcut", "idx"), &PopupMenu::get_item_shortcut);
ClassDB::bind_method(D_METHOD("get_current_index"), &PopupMenu::get_current_index);
ClassDB::bind_method(D_METHOD("get_item_count"), &PopupMenu::get_item_count);
ClassDB::bind_method(D_METHOD("remove_item", "idx"), &PopupMenu::remove_item);

View File

@ -176,6 +176,7 @@ public:
Ref<ShortCut> get_item_shortcut(int p_idx) const;
int get_item_state(int p_idx) const;
int get_current_index() const;
int get_item_count() const;
bool activate_item_by_event(const Ref<InputEvent> &p_event, bool p_for_global_only = false);