|
@@ -2369,7 +2369,10 @@ void LineEdit::menu_option(int p_option) {
|
|
|
if (editable) {
|
|
|
insert_text_at_caret(String::chr(0x00AD));
|
|
|
}
|
|
|
- }
|
|
|
+ } break;
|
|
|
+ case MENU_EMOJI_AND_SYMBOL: {
|
|
|
+ show_emoji_and_symbol_picker();
|
|
|
+ } break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2381,6 +2384,22 @@ bool LineEdit::is_context_menu_enabled() {
|
|
|
return context_menu_enabled;
|
|
|
}
|
|
|
|
|
|
+void LineEdit::show_emoji_and_symbol_picker() {
|
|
|
+ _update_ime_window_position();
|
|
|
+ DisplayServer::get_singleton()->show_emoji_and_symbol_picker();
|
|
|
+}
|
|
|
+
|
|
|
+void LineEdit::set_emoji_menu_enabled(bool p_enabled) {
|
|
|
+ if (emoji_menu_enabled != p_enabled) {
|
|
|
+ emoji_menu_enabled = p_enabled;
|
|
|
+ _update_context_menu();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+bool LineEdit::is_emoji_menu_enabled() const {
|
|
|
+ return emoji_menu_enabled;
|
|
|
+}
|
|
|
+
|
|
|
bool LineEdit::is_menu_visible() const {
|
|
|
return menu && menu->is_visible();
|
|
|
}
|
|
@@ -2709,6 +2728,11 @@ void LineEdit::_generate_context_menu() {
|
|
|
menu_ctl->add_item(ETR("Word Joiner (WJ)"), MENU_INSERT_WJ);
|
|
|
menu_ctl->add_item(ETR("Soft Hyphen (SHY)"), MENU_INSERT_SHY);
|
|
|
|
|
|
+ if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
|
|
|
+ menu->add_item(ETR("Emoji & Symbols"), MENU_EMOJI_AND_SYMBOL);
|
|
|
+ menu->add_separator();
|
|
|
+ }
|
|
|
+
|
|
|
menu->add_item(ETR("Cut"), MENU_CUT);
|
|
|
menu->add_item(ETR("Copy"), MENU_COPY);
|
|
|
menu->add_item(ETR("Paste"), MENU_PASTE);
|
|
@@ -2764,6 +2788,9 @@ void LineEdit::_update_context_menu() {
|
|
|
m_menu->set_item_checked(idx, m_checked); \
|
|
|
}
|
|
|
|
|
|
+ if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
|
|
|
+ MENU_ITEM_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, !editable || !emoji_menu_enabled)
|
|
|
+ }
|
|
|
MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
|
|
|
MENU_ITEM_ACTION(menu, MENU_COPY, "ui_copy")
|
|
|
MENU_ITEM_ACTION_DISABLED(menu, MENU_PASTE, "ui_paste", !editable)
|
|
@@ -2859,6 +2886,8 @@ void LineEdit::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("is_menu_visible"), &LineEdit::is_menu_visible);
|
|
|
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
|
|
|
ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled);
|
|
|
+ ClassDB::bind_method(D_METHOD("set_emoji_menu_enabled", "enable"), &LineEdit::set_emoji_menu_enabled);
|
|
|
+ ClassDB::bind_method(D_METHOD("is_emoji_menu_enabled"), &LineEdit::is_emoji_menu_enabled);
|
|
|
ClassDB::bind_method(D_METHOD("set_virtual_keyboard_enabled", "enable"), &LineEdit::set_virtual_keyboard_enabled);
|
|
|
ClassDB::bind_method(D_METHOD("is_virtual_keyboard_enabled"), &LineEdit::is_virtual_keyboard_enabled);
|
|
|
ClassDB::bind_method(D_METHOD("set_virtual_keyboard_type", "type"), &LineEdit::set_virtual_keyboard_type);
|
|
@@ -2917,6 +2946,7 @@ void LineEdit::_bind_methods() {
|
|
|
BIND_ENUM_CONSTANT(MENU_INSERT_ZWNJ);
|
|
|
BIND_ENUM_CONSTANT(MENU_INSERT_WJ);
|
|
|
BIND_ENUM_CONSTANT(MENU_INSERT_SHY);
|
|
|
+ BIND_ENUM_CONSTANT(MENU_EMOJI_AND_SYMBOL);
|
|
|
BIND_ENUM_CONSTANT(MENU_MAX);
|
|
|
|
|
|
BIND_ENUM_CONSTANT(KEYBOARD_TYPE_DEFAULT);
|
|
@@ -2936,6 +2966,7 @@ void LineEdit::_bind_methods() {
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_editing_on_text_submit"), "set_keep_editing_on_text_submit", "is_editing_kept_on_text_submit");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand_to_text_length"), "set_expand_to_text_length_enabled", "is_expand_to_text_length_enabled");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled");
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emoji_menu_enabled"), "set_emoji_menu_enabled", "is_emoji_menu_enabled");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "virtual_keyboard_enabled"), "set_virtual_keyboard_enabled", "is_virtual_keyboard_enabled");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "virtual_keyboard_type", PROPERTY_HINT_ENUM, "Default,Multiline,Number,Decimal,Phone,Email,Password,URL"), "set_virtual_keyboard_type", "get_virtual_keyboard_type");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clear_button_enabled"), "set_clear_button_enabled", "is_clear_button_enabled");
|