Skip to content

Commit

Permalink
Merge pull request #38520 from nobuyukinyuu/popupmenu-current-index
Browse files Browse the repository at this point in the history
PopupMenu.get_current_index() bound to ClassDB
  • Loading branch information
akien-mga authored May 7, 2020
2 parents 1ff9748 + 35f3008 commit 112884d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scene/gui/popup_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,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();
Expand Down Expand Up @@ -1457,6 +1462,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);
Expand Down
1 change: 1 addition & 0 deletions scene/gui/popup_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class PopupMenu : public Popup {
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);
Expand Down

0 comments on commit 112884d

Please sign in to comment.