2023-01-05 20:25:55 +08:00
|
|
|
/**************************************************************************/
|
|
|
|
/* popup_menu.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 07:50:27 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
#ifndef POPUP_MENU_H
|
|
|
|
#define POPUP_MENU_H
|
|
|
|
|
2021-08-22 23:37:22 +08:00
|
|
|
#include "core/input/shortcut.h"
|
2020-08-29 20:05:59 +08:00
|
|
|
#include "scene/gui/margin_container.h"
|
2014-02-10 09:10:30 +08:00
|
|
|
#include "scene/gui/popup.h"
|
2020-08-29 20:05:59 +08:00
|
|
|
#include "scene/gui/scroll_container.h"
|
2020-09-03 19:22:16 +08:00
|
|
|
#include "scene/resources/text_line.h"
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
class PopupMenu : public Popup {
|
2017-01-03 10:03:46 +08:00
|
|
|
GDCLASS(PopupMenu, Popup);
|
2016-03-09 07:00:52 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
struct Item {
|
2019-06-12 02:43:37 +08:00
|
|
|
Ref<Texture2D> icon;
|
2023-04-01 03:17:59 +08:00
|
|
|
int icon_max_width = 0;
|
2022-12-19 13:38:08 +08:00
|
|
|
Color icon_modulate = Color(1, 1, 1, 1);
|
2014-02-10 09:10:30 +08:00
|
|
|
String text;
|
2017-01-10 03:43:44 +08:00
|
|
|
String xl_text;
|
2020-09-03 19:22:16 +08:00
|
|
|
Ref<TextLine> text_buf;
|
|
|
|
Ref<TextLine> accel_text_buf;
|
|
|
|
|
|
|
|
String language;
|
|
|
|
Control::TextDirection text_direction = Control::TEXT_DIRECTION_AUTO;
|
|
|
|
|
2021-02-10 01:24:36 +08:00
|
|
|
bool checked = false;
|
2018-03-24 04:55:40 +08:00
|
|
|
enum {
|
|
|
|
CHECKABLE_TYPE_NONE,
|
|
|
|
CHECKABLE_TYPE_CHECK_BOX,
|
|
|
|
CHECKABLE_TYPE_RADIO_BUTTON,
|
|
|
|
} checkable_type;
|
2021-02-10 01:24:36 +08:00
|
|
|
int max_states = 0;
|
|
|
|
int state = 0;
|
|
|
|
bool separator = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool dirty = true;
|
|
|
|
int id = 0;
|
2014-02-10 09:10:30 +08:00
|
|
|
Variant metadata;
|
|
|
|
String submenu;
|
|
|
|
String tooltip;
|
2021-08-14 05:31:57 +08:00
|
|
|
Key accel = Key::NONE;
|
2021-02-10 01:24:36 +08:00
|
|
|
int _ofs_cache = 0;
|
|
|
|
int _height_cache = 0;
|
2022-08-01 17:28:16 +08:00
|
|
|
int indent = 0;
|
2020-09-10 03:53:24 +08:00
|
|
|
Ref<Shortcut> shortcut;
|
2021-02-10 01:24:36 +08:00
|
|
|
bool shortcut_is_global = false;
|
|
|
|
bool shortcut_is_disabled = false;
|
2020-02-24 05:23:34 +08:00
|
|
|
bool allow_echo = false;
|
2016-03-09 07:00:52 +08:00
|
|
|
|
2020-08-29 20:05:59 +08:00
|
|
|
// Returns (0,0) if icon is null.
|
|
|
|
Size2 get_icon_size() const {
|
|
|
|
return icon.is_null() ? Size2() : icon->get_size();
|
|
|
|
}
|
|
|
|
|
2017-01-05 20:16:00 +08:00
|
|
|
Item() {
|
2021-06-18 06:03:09 +08:00
|
|
|
text_buf.instantiate();
|
|
|
|
accel_text_buf.instantiate();
|
2018-03-24 04:55:40 +08:00
|
|
|
checkable_type = CHECKABLE_TYPE_NONE;
|
2017-01-05 20:16:00 +08:00
|
|
|
}
|
2014-02-10 09:10:30 +08:00
|
|
|
};
|
2016-03-09 07:00:52 +08:00
|
|
|
|
2020-09-07 20:57:50 +08:00
|
|
|
bool close_allowed = false;
|
2022-04-13 14:58:38 +08:00
|
|
|
bool activated_by_keyboard = false;
|
2020-09-07 20:57:50 +08:00
|
|
|
|
|
|
|
Timer *minimum_lifetime_timer = nullptr;
|
2022-04-04 21:06:57 +08:00
|
|
|
Timer *submenu_timer = nullptr;
|
2014-02-10 09:10:30 +08:00
|
|
|
List<Rect2> autohide_areas;
|
|
|
|
Vector<Item> items;
|
2023-01-08 07:55:54 +08:00
|
|
|
BitField<MouseButtonMask> initial_button_mask;
|
2021-02-10 01:24:36 +08:00
|
|
|
bool during_grabbed_click = false;
|
|
|
|
int mouse_over = -1;
|
|
|
|
int submenu_over = -1;
|
2020-09-03 19:22:16 +08:00
|
|
|
String _get_accel_text(const Item &p_item) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
int _get_mouse_over(const Point2 &p_over) const;
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual Size2 _get_contents_minimum_size() const override;
|
2020-08-29 20:05:59 +08:00
|
|
|
|
2023-05-24 21:58:50 +08:00
|
|
|
int _get_item_height(int p_idx) const;
|
2020-08-29 20:05:59 +08:00
|
|
|
int _get_items_total_height() const;
|
2023-05-24 21:58:50 +08:00
|
|
|
Size2 _get_item_icon_size(int p_idx) const;
|
2020-08-29 20:05:59 +08:00
|
|
|
|
2023-05-24 21:58:50 +08:00
|
|
|
void _shape_item(int p_idx);
|
2020-09-03 19:22:16 +08:00
|
|
|
|
2021-08-22 23:37:22 +08:00
|
|
|
virtual void gui_input(const Ref<InputEvent> &p_event);
|
2022-04-13 14:58:38 +08:00
|
|
|
void _activate_submenu(int p_over, bool p_by_keyboard = false);
|
2014-02-10 09:10:30 +08:00
|
|
|
void _submenu_timeout();
|
|
|
|
|
2020-09-19 02:45:59 +08:00
|
|
|
uint64_t popup_time_msec = 0;
|
2021-02-10 01:24:36 +08:00
|
|
|
bool hide_on_item_selection = true;
|
|
|
|
bool hide_on_checkable_item_selection = true;
|
|
|
|
bool hide_on_multistate_item_selection = false;
|
2015-01-04 03:52:37 +08:00
|
|
|
Vector2 moved;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2022-05-13 21:04:37 +08:00
|
|
|
HashMap<Ref<Shortcut>, int> shortcut_refcount;
|
2016-06-05 08:31:29 +08:00
|
|
|
|
2020-09-10 03:53:24 +08:00
|
|
|
void _ref_shortcut(Ref<Shortcut> p_sc);
|
|
|
|
void _unref_shortcut(Ref<Shortcut> p_sc);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2022-09-26 21:21:04 +08:00
|
|
|
void _shortcut_changed();
|
|
|
|
|
2021-02-10 01:24:36 +08:00
|
|
|
bool allow_search = true;
|
|
|
|
uint64_t search_time_msec = 0;
|
|
|
|
String search_string = "";
|
2019-05-12 00:32:53 +08:00
|
|
|
|
2022-04-04 21:06:57 +08:00
|
|
|
MarginContainer *margin_container = nullptr;
|
|
|
|
ScrollContainer *scroll_container = nullptr;
|
|
|
|
Control *control = nullptr;
|
2020-03-12 20:37:40 +08:00
|
|
|
|
2023-02-10 00:25:56 +08:00
|
|
|
const float DEFAULT_GAMEPAD_EVENT_DELAY_MS = 0.5;
|
|
|
|
const float GAMEPAD_EVENT_REPEAT_RATE_MS = 1.0 / 20;
|
|
|
|
float gamepad_event_delay_ms = DEFAULT_GAMEPAD_EVENT_DELAY_MS;
|
|
|
|
|
2022-09-01 18:38:08 +08:00
|
|
|
struct ThemeCache {
|
|
|
|
Ref<StyleBox> panel_style;
|
|
|
|
Ref<StyleBox> hover_style;
|
|
|
|
|
|
|
|
Ref<StyleBox> separator_style;
|
|
|
|
Ref<StyleBox> labeled_separator_left;
|
|
|
|
Ref<StyleBox> labeled_separator_right;
|
|
|
|
|
|
|
|
int v_separation = 0;
|
|
|
|
int h_separation = 0;
|
|
|
|
int indent = 0;
|
|
|
|
int item_start_padding = 0;
|
|
|
|
int item_end_padding = 0;
|
2023-04-01 03:17:59 +08:00
|
|
|
int icon_max_width = 0;
|
2022-09-01 18:38:08 +08:00
|
|
|
|
|
|
|
Ref<Texture2D> checked;
|
|
|
|
Ref<Texture2D> checked_disabled;
|
|
|
|
Ref<Texture2D> unchecked;
|
|
|
|
Ref<Texture2D> unchecked_disabled;
|
|
|
|
Ref<Texture2D> radio_checked;
|
|
|
|
Ref<Texture2D> radio_checked_disabled;
|
|
|
|
Ref<Texture2D> radio_unchecked;
|
|
|
|
Ref<Texture2D> radio_unchecked_disabled;
|
|
|
|
|
|
|
|
Ref<Texture2D> submenu;
|
|
|
|
Ref<Texture2D> submenu_mirrored;
|
|
|
|
|
|
|
|
Ref<Font> font;
|
|
|
|
int font_size = 0;
|
|
|
|
Ref<Font> font_separator;
|
|
|
|
int font_separator_size = 0;
|
|
|
|
|
|
|
|
Color font_color;
|
|
|
|
Color font_hover_color;
|
|
|
|
Color font_disabled_color;
|
|
|
|
Color font_accelerator_color;
|
|
|
|
int font_outline_size = 0;
|
|
|
|
Color font_outline_color;
|
|
|
|
|
|
|
|
Color font_separator_color;
|
|
|
|
int font_separator_outline_size = 0;
|
|
|
|
Color font_separator_outline_color;
|
|
|
|
} theme_cache;
|
|
|
|
|
2020-08-29 20:05:59 +08:00
|
|
|
void _draw_items();
|
|
|
|
void _draw_background();
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2020-09-07 20:57:50 +08:00
|
|
|
void _minimum_lifetime_timeout();
|
|
|
|
void _close_pressed();
|
2022-08-01 17:28:16 +08:00
|
|
|
void _menu_changed();
|
2020-09-07 20:57:50 +08:00
|
|
|
|
2020-03-12 20:37:40 +08:00
|
|
|
protected:
|
2022-08-01 17:28:16 +08:00
|
|
|
virtual void add_child_notify(Node *p_child) override;
|
|
|
|
virtual void remove_child_notify(Node *p_child) override;
|
2023-09-09 03:00:10 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void _notification(int p_what);
|
2021-11-03 10:08:58 +08:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
2016-03-09 07:00:52 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2020-02-24 05:23:34 +08:00
|
|
|
#ifndef DISABLE_DEPRECATED
|
|
|
|
void _add_shortcut_bind_compat_36493(const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
|
|
|
void _add_icon_shortcut_bind_compat_36493(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
2023-07-28 01:50:31 +08:00
|
|
|
void _clear_bind_compat_79965();
|
2020-02-24 05:23:34 +08:00
|
|
|
static void _bind_compatibility_methods();
|
|
|
|
#endif
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
public:
|
2021-08-01 13:53:36 +08:00
|
|
|
// ATTENTION: This is used by the POT generator's scene parser. If the number of properties returned by `_get_items()` ever changes,
|
|
|
|
// this value should be updated to reflect the new size.
|
|
|
|
static const int ITEM_PROPERTY_SIZE = 10;
|
|
|
|
|
2022-06-09 16:59:01 +08:00
|
|
|
virtual void _parent_focused() override;
|
|
|
|
|
2021-08-14 05:31:57 +08:00
|
|
|
void add_item(const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
|
|
|
void add_icon_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
|
|
|
void add_check_item(const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
|
|
|
void add_icon_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
|
|
|
void add_radio_check_item(const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
|
|
|
void add_icon_radio_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id = -1, Key p_accel = Key::NONE);
|
2019-05-09 17:21:49 +08:00
|
|
|
|
2021-08-14 05:31:57 +08:00
|
|
|
void add_multistate_item(const String &p_label, int p_max_states, int p_default_state = 0, int p_id = -1, Key p_accel = Key::NONE);
|
2019-10-08 14:28:26 +08:00
|
|
|
|
2020-02-24 05:23:34 +08:00
|
|
|
void add_shortcut(const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false, bool p_allow_echo = false);
|
|
|
|
void add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false, bool p_allow_echo = false);
|
2020-09-10 03:53:24 +08:00
|
|
|
void add_check_shortcut(const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
|
|
|
void add_icon_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
|
|
|
void add_radio_check_shortcut(const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
|
|
|
void add_icon_radio_check_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id = -1, bool p_global = false);
|
2019-05-09 17:21:49 +08:00
|
|
|
|
2019-10-08 14:28:26 +08:00
|
|
|
void add_submenu_item(const String &p_label, const String &p_submenu, int p_id = -1);
|
2017-11-23 05:29:27 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void set_item_text(int p_idx, const String &p_text);
|
2020-09-03 19:22:16 +08:00
|
|
|
|
|
|
|
void set_item_text_direction(int p_idx, Control::TextDirection p_text_direction);
|
|
|
|
void set_item_language(int p_idx, const String &p_language);
|
2019-06-12 02:43:37 +08:00
|
|
|
void set_item_icon(int p_idx, const Ref<Texture2D> &p_icon);
|
2023-04-01 03:17:59 +08:00
|
|
|
void set_item_icon_max_width(int p_idx, int p_width);
|
2022-12-19 13:38:08 +08:00
|
|
|
void set_item_icon_modulate(int p_idx, const Color &p_modulate);
|
2016-03-09 07:00:52 +08:00
|
|
|
void set_item_checked(int p_idx, bool p_checked);
|
2019-05-09 17:21:49 +08:00
|
|
|
void set_item_id(int p_idx, int p_id);
|
2021-08-14 05:31:57 +08:00
|
|
|
void set_item_accelerator(int p_idx, Key p_accel);
|
2014-02-10 09:10:30 +08:00
|
|
|
void set_item_metadata(int p_idx, const Variant &p_meta);
|
|
|
|
void set_item_disabled(int p_idx, bool p_disabled);
|
|
|
|
void set_item_submenu(int p_idx, const String &p_submenu);
|
|
|
|
void set_item_as_separator(int p_idx, bool p_separator);
|
|
|
|
void set_item_as_checkable(int p_idx, bool p_checkable);
|
2018-03-24 04:55:40 +08:00
|
|
|
void set_item_as_radio_checkable(int p_idx, bool p_radio_checkable);
|
2014-02-10 09:10:30 +08:00
|
|
|
void set_item_tooltip(int p_idx, const String &p_tooltip);
|
2020-09-10 03:53:24 +08:00
|
|
|
void set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bool p_global = false);
|
2022-08-01 17:28:16 +08:00
|
|
|
void set_item_indent(int p_idx, int p_indent);
|
2017-12-12 10:37:37 +08:00
|
|
|
void set_item_multistate(int p_idx, int p_state);
|
|
|
|
void toggle_item_multistate(int p_idx);
|
2018-06-07 23:46:14 +08:00
|
|
|
void set_item_shortcut_disabled(int p_idx, bool p_disabled);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-10-01 21:50:54 +08:00
|
|
|
void toggle_item_checked(int p_idx);
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
String get_item_text(int p_idx) const;
|
2023-06-27 22:22:58 +08:00
|
|
|
String get_item_xl_text(int p_idx) const;
|
2020-09-03 19:22:16 +08:00
|
|
|
Control::TextDirection get_item_text_direction(int p_idx) const;
|
|
|
|
String get_item_language(int p_idx) const;
|
2017-07-14 16:45:24 +08:00
|
|
|
int get_item_idx_from_text(const String &text) const;
|
2019-06-12 02:43:37 +08:00
|
|
|
Ref<Texture2D> get_item_icon(int p_idx) const;
|
2023-04-01 03:17:59 +08:00
|
|
|
int get_item_icon_max_width(int p_idx) const;
|
2022-12-19 13:38:08 +08:00
|
|
|
Color get_item_icon_modulate(int p_idx) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
bool is_item_checked(int p_idx) const;
|
2017-08-07 18:17:31 +08:00
|
|
|
int get_item_id(int p_idx) const;
|
2019-05-09 17:21:49 +08:00
|
|
|
int get_item_index(int p_id) const;
|
2021-08-14 05:31:57 +08:00
|
|
|
Key get_item_accelerator(int p_idx) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
Variant get_item_metadata(int p_idx) const;
|
|
|
|
bool is_item_disabled(int p_idx) const;
|
2017-08-12 03:10:05 +08:00
|
|
|
String get_item_submenu(int p_idx) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
bool is_item_separator(int p_idx) const;
|
|
|
|
bool is_item_checkable(int p_idx) const;
|
2018-03-24 04:55:40 +08:00
|
|
|
bool is_item_radio_checkable(int p_idx) const;
|
2018-06-07 23:46:14 +08:00
|
|
|
bool is_item_shortcut_disabled(int p_idx) const;
|
2022-08-01 17:28:16 +08:00
|
|
|
bool is_item_shortcut_global(int p_idx) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
String get_item_tooltip(int p_idx) const;
|
2020-09-10 03:53:24 +08:00
|
|
|
Ref<Shortcut> get_item_shortcut(int p_idx) const;
|
2022-08-01 17:28:16 +08:00
|
|
|
int get_item_indent(int p_idx) const;
|
|
|
|
int get_item_max_states(int p_idx) const;
|
2017-11-23 05:29:27 +08:00
|
|
|
int get_item_state(int p_idx) const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2022-09-06 21:51:14 +08:00
|
|
|
void set_focused_item(int p_idx);
|
|
|
|
int get_focused_item() const;
|
2021-11-03 10:08:58 +08:00
|
|
|
|
|
|
|
void set_item_count(int p_count);
|
2014-02-10 09:10:30 +08:00
|
|
|
int get_item_count() const;
|
|
|
|
|
2023-05-24 21:58:50 +08:00
|
|
|
void scroll_to_item(int p_idx);
|
2022-02-06 10:47:00 +08:00
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
bool activate_item_by_event(const Ref<InputEvent> &p_event, bool p_for_global_only = false);
|
2023-05-24 21:58:50 +08:00
|
|
|
void activate_item(int p_idx);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
void remove_item(int p_idx);
|
2016-03-09 07:00:52 +08:00
|
|
|
|
2020-12-27 20:18:47 +08:00
|
|
|
void add_separator(const String &p_text = String(), int p_id = -1);
|
2016-03-09 07:00:52 +08:00
|
|
|
|
2023-07-28 01:50:31 +08:00
|
|
|
void clear(bool p_free_submenus = true);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
virtual String get_tooltip(const Point2 &p_pos) const;
|
|
|
|
|
|
|
|
void add_autohide_area(const Rect2 &p_area);
|
|
|
|
void clear_autohide_areas();
|
|
|
|
|
2016-12-23 22:43:45 +08:00
|
|
|
void set_hide_on_item_selection(bool p_enabled);
|
2017-11-23 05:29:27 +08:00
|
|
|
bool is_hide_on_item_selection() const;
|
2015-01-04 03:52:37 +08:00
|
|
|
|
2017-04-14 19:49:00 +08:00
|
|
|
void set_hide_on_checkable_item_selection(bool p_enabled);
|
2017-11-23 05:29:27 +08:00
|
|
|
bool is_hide_on_checkable_item_selection() const;
|
|
|
|
|
2017-12-12 10:37:37 +08:00
|
|
|
void set_hide_on_multistate_item_selection(bool p_enabled);
|
|
|
|
bool is_hide_on_multistate_item_selection() const;
|
2017-04-14 19:49:00 +08:00
|
|
|
|
2018-07-09 20:16:06 +08:00
|
|
|
void set_submenu_popup_delay(float p_time);
|
|
|
|
float get_submenu_popup_delay() const;
|
|
|
|
|
2019-05-12 00:32:53 +08:00
|
|
|
void set_allow_search(bool p_allow);
|
|
|
|
bool get_allow_search() const;
|
|
|
|
|
2021-03-30 20:42:50 +08:00
|
|
|
virtual void popup(const Rect2i &p_bounds = Rect2i()) override;
|
2018-03-28 05:41:27 +08:00
|
|
|
|
2020-03-20 10:32:09 +08:00
|
|
|
void take_mouse_focus();
|
|
|
|
|
2016-03-09 07:00:52 +08:00
|
|
|
PopupMenu();
|
2014-02-10 09:10:30 +08:00
|
|
|
~PopupMenu();
|
|
|
|
};
|
|
|
|
|
2022-07-24 05:41:51 +08:00
|
|
|
#endif // POPUP_MENU_H
|