godot/scene/gui/popup_menu.cpp

/**************************************************************************/
/*  popup_menu.cpp                                                        */
/**************************************************************************/
/*                         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.                 */
/**************************************************************************/

#include "popup_menu.h"
#include "popup_menu.compat.inc"

#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/string/translation.h"
#include "scene/gui/menu_bar.h"
#include "scene/theme/theme_db.h"

HashMap<NativeMenu::SystemMenus, PopupMenu *> PopupMenu::system_menus;

bool PopupMenu::_set_item_accelerator(int p_index, const Ref<InputEventKey> &p_ie) {}

void PopupMenu::_set_item_checkable_type(int p_index, int p_checkable_type) {}

int PopupMenu::_get_item_checkable_type(int p_index) const {}

RID PopupMenu::bind_global_menu() {}

void PopupMenu::unbind_global_menu() {}

bool PopupMenu::is_system_menu() const {}

void PopupMenu::set_system_menu(NativeMenu::SystemMenus p_system_menu_id) {}

NativeMenu::SystemMenus PopupMenu::get_system_menu() const {}

String PopupMenu::_get_accel_text(const Item &p_item) const {}

Size2 PopupMenu::_get_item_icon_size(int p_idx) const {}

Size2 PopupMenu::_get_contents_minimum_size() const {}

int PopupMenu::_get_item_height(int p_idx) const {}

int PopupMenu::_get_items_total_height() const {}

int PopupMenu::_get_mouse_over(const Point2 &p_over) const {}

void PopupMenu::_activate_submenu(int p_over, bool p_by_keyboard) {}

void PopupMenu::_parent_focused() {}

void PopupMenu::_submenu_timeout() {}

void PopupMenu::_input_from_window(const Ref<InputEvent> &p_event) {}

void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {}

void PopupMenu::_mouse_over_update(const Point2 &p_over) {}

void PopupMenu::_draw_items() {}

void PopupMenu::_minimum_lifetime_timeout() {}

void PopupMenu::_close_pressed() {}

void PopupMenu::_shape_item(int p_idx) {}

void PopupMenu::_menu_changed() {}

void PopupMenu::add_child_notify(Node *p_child) {}

void PopupMenu::remove_child_notify(Node *p_child) {}

void PopupMenu::_notification(int p_what) {}

/* Methods to add items with or without icon, checkbox, shortcut.
 * Be sure to keep them in sync when adding new properties in the Item struct.
 */

#define ITEM_SETUP_WITH_ACCEL

void PopupMenu::add_item(const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_icon_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_check_item(const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_icon_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_radio_check_item(const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_icon_radio_check_item(const Ref<Texture2D> &p_icon, const String &p_label, int p_id, Key p_accel) {}

void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int p_default_state, int p_id, Key p_accel) {}

#define ITEM_SETUP_WITH_SHORTCUT

void PopupMenu::add_shortcut(const Ref<Shortcut> &p_shortcut, int p_id, bool p_global, bool p_allow_echo) {}

void PopupMenu::add_icon_shortcut(const Ref<Texture2D> &p_icon, const Ref<Shortcut> &p_shortcut, int p_id, bool p_global, bool p_allow_echo) {}

void PopupMenu::add_check_shortcut(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) {}

void PopupMenu::add_radio_check_shortcut(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) {}

void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, int p_id) {}

void PopupMenu::add_submenu_node_item(const String &p_label, PopupMenu *p_submenu, int p_id) {}

#undef ITEM_SETUP_WITH_ACCEL
#undef ITEM_SETUP_WITH_SHORTCUT

/* Methods to modify existing items. */

void PopupMenu::set_item_text(int p_idx, const String &p_text) {}

void PopupMenu::set_item_text_direction(int p_idx, Control::TextDirection p_text_direction) {}

void PopupMenu::set_item_language(int p_idx, const String &p_language) {}

void PopupMenu::set_item_icon(int p_idx, const Ref<Texture2D> &p_icon) {}

void PopupMenu::set_item_icon_max_width(int p_idx, int p_width) {}

void PopupMenu::set_item_icon_modulate(int p_idx, const Color &p_modulate) {}

void PopupMenu::set_item_checked(int p_idx, bool p_checked) {}

void PopupMenu::set_item_id(int p_idx, int p_id) {}

void PopupMenu::set_item_accelerator(int p_idx, Key p_accel) {}

void PopupMenu::set_item_metadata(int p_idx, const Variant &p_meta) {}

void PopupMenu::set_item_disabled(int p_idx, bool p_disabled) {}

void PopupMenu::set_item_submenu(int p_idx, const String &p_submenu) {}

void PopupMenu::set_item_submenu_node(int p_idx, PopupMenu *p_submenu) {}

void PopupMenu::toggle_item_checked(int p_idx) {}

String PopupMenu::get_item_text(int p_idx) const {}

String PopupMenu::get_item_xl_text(int p_idx) const {}

Control::TextDirection PopupMenu::get_item_text_direction(int p_idx) const {}

String PopupMenu::get_item_language(int p_idx) const {}

int PopupMenu::get_item_idx_from_text(const String &text) const {}

Ref<Texture2D> PopupMenu::get_item_icon(int p_idx) const {}

int PopupMenu::get_item_icon_max_width(int p_idx) const {}

Color PopupMenu::get_item_icon_modulate(int p_idx) const {}

Key PopupMenu::get_item_accelerator(int p_idx) const {}

Variant PopupMenu::get_item_metadata(int p_idx) const {}

bool PopupMenu::is_item_disabled(int p_idx) const {}

bool PopupMenu::is_item_checked(int p_idx) const {}

int PopupMenu::get_item_id(int p_idx) const {}

int PopupMenu::get_item_index(int p_id) const {}

String PopupMenu::get_item_submenu(int p_idx) const {}

PopupMenu *PopupMenu::get_item_submenu_node(int p_idx) const {}

String PopupMenu::get_item_tooltip(int p_idx) const {}

Ref<Shortcut> PopupMenu::get_item_shortcut(int p_idx) const {}

int PopupMenu::get_item_indent(int p_idx) const {}

int PopupMenu::get_item_max_states(int p_idx) const {}

int PopupMenu::get_item_state(int p_idx) const {}

void PopupMenu::set_item_as_separator(int p_idx, bool p_separator) {}

bool PopupMenu::is_item_separator(int p_idx) const {}

void PopupMenu::set_item_as_checkable(int p_idx, bool p_checkable) {}

void PopupMenu::set_item_as_radio_checkable(int p_idx, bool p_radio_checkable) {}

void PopupMenu::set_item_tooltip(int p_idx, const String &p_tooltip) {}

void PopupMenu::set_item_shortcut(int p_idx, const Ref<Shortcut> &p_shortcut, bool p_global) {}

void PopupMenu::set_item_indent(int p_idx, int p_indent) {}

void PopupMenu::set_item_max_states(int p_idx, int p_max_states) {}

void PopupMenu::set_item_multistate(int p_idx, int p_state) {}

void PopupMenu::set_item_shortcut_disabled(int p_idx, bool p_disabled) {}

void PopupMenu::toggle_item_multistate(int p_idx) {}

bool PopupMenu::is_item_checkable(int p_idx) const {}

bool PopupMenu::is_item_radio_checkable(int p_idx) const {}

bool PopupMenu::is_item_shortcut_global(int p_idx) const {}

bool PopupMenu::is_item_shortcut_disabled(int p_idx) const {}

void PopupMenu::set_focused_item(int p_idx) {}

int PopupMenu::get_focused_item() const {}

void PopupMenu::set_item_count(int p_count) {}

int PopupMenu::get_item_count() const {}

void PopupMenu::scroll_to_item(int p_idx) {}

void PopupMenu::set_prefer_native_menu(bool p_enabled) {}

bool PopupMenu::is_prefer_native_menu() const {}

bool PopupMenu::is_native_menu() const {}

bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_for_global_only) {}

void PopupMenu::_about_to_popup() {}

void PopupMenu::_about_to_close() {}

void PopupMenu::activate_item(int p_idx) {}

void PopupMenu::remove_item(int p_idx) {}

void PopupMenu::add_separator(const String &p_text, int p_id) {}

void PopupMenu::clear(bool p_free_submenus) {}

void PopupMenu::_ref_shortcut(Ref<Shortcut> p_sc) {}

void PopupMenu::_unref_shortcut(Ref<Shortcut> p_sc) {}

void PopupMenu::_shortcut_changed() {}

// Hide on item selection determines whether or not the popup will close after item selection
void PopupMenu::set_hide_on_item_selection(bool p_enabled) {}

bool PopupMenu::is_hide_on_item_selection() const {}

void PopupMenu::set_hide_on_checkable_item_selection(bool p_enabled) {}

bool PopupMenu::is_hide_on_checkable_item_selection() const {}

void PopupMenu::set_hide_on_multistate_item_selection(bool p_enabled) {}

bool PopupMenu::is_hide_on_multistate_item_selection() const {}

void PopupMenu::set_submenu_popup_delay(float p_time) {}

float PopupMenu::get_submenu_popup_delay() const {}

void PopupMenu::set_allow_search(bool p_allow) {}

bool PopupMenu::get_allow_search() const {}

String PopupMenu::get_tooltip(const Point2 &p_pos) const {}

void PopupMenu::add_autohide_area(const Rect2 &p_area) {}

void PopupMenu::clear_autohide_areas() {}

bool PopupMenu::_set(const StringName &p_name, const Variant &p_value) {}

void PopupMenu::_bind_methods() {}

void PopupMenu::popup(const Rect2i &p_bounds) {}

void PopupMenu::set_visible(bool p_visible) {}

PopupMenu::PopupMenu() {}

PopupMenu::~PopupMenu() {}