|
@@ -2086,6 +2086,26 @@ void PopupMenu::set_item_indent(int p_idx, int p_indent) {
|
|
|
_menu_changed();
|
|
|
}
|
|
|
|
|
|
+void PopupMenu::set_item_max_states(int p_idx, int p_max_states) {
|
|
|
+ if (p_idx < 0) {
|
|
|
+ p_idx += get_item_count();
|
|
|
+ }
|
|
|
+ ERR_FAIL_INDEX(p_idx, items.size());
|
|
|
+
|
|
|
+ if (items[p_idx].max_states == p_max_states) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ items.write[p_idx].max_states = p_max_states;
|
|
|
+
|
|
|
+ if (!global_menu_name.is_empty()) {
|
|
|
+ DisplayServer::get_singleton()->global_menu_set_item_max_states(global_menu_name, p_idx, p_max_states);
|
|
|
+ }
|
|
|
+
|
|
|
+ control->queue_redraw();
|
|
|
+ _menu_changed();
|
|
|
+}
|
|
|
+
|
|
|
void PopupMenu::set_item_multistate(int p_idx, int p_state) {
|
|
|
if (p_idx < 0) {
|
|
|
p_idx += get_item_count();
|
|
@@ -2724,6 +2744,7 @@ void PopupMenu::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("set_item_shortcut", "index", "shortcut", "global"), &PopupMenu::set_item_shortcut, DEFVAL(false));
|
|
|
ClassDB::bind_method(D_METHOD("set_item_indent", "index", "indent"), &PopupMenu::set_item_indent);
|
|
|
ClassDB::bind_method(D_METHOD("set_item_multistate", "index", "state"), &PopupMenu::set_item_multistate);
|
|
|
+ ClassDB::bind_method(D_METHOD("set_item_multistate_max", "index", "max_states"), &PopupMenu::set_item_max_states);
|
|
|
ClassDB::bind_method(D_METHOD("set_item_shortcut_disabled", "index", "disabled"), &PopupMenu::set_item_shortcut_disabled);
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("toggle_item_checked", "index"), &PopupMenu::toggle_item_checked);
|
|
@@ -2750,6 +2771,9 @@ void PopupMenu::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("get_item_shortcut", "index"), &PopupMenu::get_item_shortcut);
|
|
|
ClassDB::bind_method(D_METHOD("get_item_indent", "index"), &PopupMenu::get_item_indent);
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("get_item_multistate_max", "index"), &PopupMenu::get_item_max_states);
|
|
|
+ ClassDB::bind_method(D_METHOD("get_item_multistate", "index"), &PopupMenu::get_item_state);
|
|
|
+
|
|
|
ClassDB::bind_method(D_METHOD("set_focused_item", "index"), &PopupMenu::set_focused_item);
|
|
|
ClassDB::bind_method(D_METHOD("get_focused_item"), &PopupMenu::get_focused_item);
|
|
|
ClassDB::bind_method(D_METHOD("set_item_count", "count"), &PopupMenu::set_item_count);
|