|
@@ -717,7 +717,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int
|
|
|
}
|
|
|
|
|
|
#define ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global) \
|
|
|
- ERR_FAIL_COND_MSG(p_shortcut.is_null(), "Cannot add item with invalid ShortCut."); \
|
|
|
+ ERR_FAIL_COND_MSG(p_shortcut.is_null(), "Cannot add item with invalid Shortcut."); \
|
|
|
_ref_shortcut(p_shortcut); \
|
|
|
item.text = p_shortcut->get_name(); \
|
|
|
item.xl_text = tr(item.text); \
|
|
@@ -725,7 +725,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int
|
|
|
item.shortcut = p_shortcut; \
|
|
|
item.shortcut_is_global = p_global;
|
|
|
|
|
|
-void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_shortcut(const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
items.push_back(item);
|
|
@@ -733,7 +733,7 @@ void PopupMenu::add_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_g
|
|
|
child_controls_changed();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
item.icon = p_icon;
|
|
@@ -742,7 +742,7 @@ void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortC
|
|
|
child_controls_changed();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_check_shortcut(const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX;
|
|
@@ -751,7 +751,7 @@ void PopupMenu::add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bo
|
|
|
child_controls_changed();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
item.icon = p_icon;
|
|
@@ -761,7 +761,7 @@ void PopupMenu::add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<
|
|
|
child_controls_changed();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_radio_check_shortcut(const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON;
|
|
@@ -770,7 +770,7 @@ void PopupMenu::add_radio_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_
|
|
|
child_controls_changed();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<ShortCut> &p_shortcut, int p_id, bool p_global) {
|
|
|
+void PopupMenu::add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id, bool p_global) {
|
|
|
Item item;
|
|
|
ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global);
|
|
|
item.icon = p_icon;
|
|
@@ -931,8 +931,8 @@ String PopupMenu::get_item_tooltip(int p_idx) const {
|
|
|
return items[p_idx].tooltip;
|
|
|
}
|
|
|
|
|
|
-Ref<ShortCut> PopupMenu::get_item_shortcut(int p_idx) const {
|
|
|
- ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<ShortCut>());
|
|
|
+Ref<Shortcut> PopupMenu::get_item_shortcut(int p_idx) const {
|
|
|
+ ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Shortcut>());
|
|
|
return items[p_idx].shortcut;
|
|
|
}
|
|
|
|
|
@@ -970,7 +970,7 @@ void PopupMenu::set_item_tooltip(int p_idx, const String &p_tooltip) {
|
|
|
control->update();
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::set_item_shortcut(int p_idx, const Ref<ShortCut> &p_shortcut, bool p_global) {
|
|
|
+void PopupMenu::set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bool p_global) {
|
|
|
ERR_FAIL_INDEX(p_idx, items.size());
|
|
|
if (items[p_idx].shortcut.is_valid()) {
|
|
|
_unref_shortcut(items[p_idx].shortcut);
|
|
@@ -1209,7 +1209,7 @@ Array PopupMenu::_get_items() const {
|
|
|
return items;
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::_ref_shortcut(Ref<ShortCut> p_sc) {
|
|
|
+void PopupMenu::_ref_shortcut(Ref<Shortcut> p_sc) {
|
|
|
if (!shortcut_refcount.has(p_sc)) {
|
|
|
shortcut_refcount[p_sc] = 1;
|
|
|
p_sc->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update));
|
|
@@ -1218,7 +1218,7 @@ void PopupMenu::_ref_shortcut(Ref<ShortCut> p_sc) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void PopupMenu::_unref_shortcut(Ref<ShortCut> p_sc) {
|
|
|
+void PopupMenu::_unref_shortcut(Ref<Shortcut> p_sc) {
|
|
|
ERR_FAIL_COND(!shortcut_refcount.has(p_sc));
|
|
|
shortcut_refcount[p_sc]--;
|
|
|
if (shortcut_refcount[p_sc] == 0) {
|