feat: updated engine
This commit is contained in:
parent
cbe99774ff
commit
f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions
|
|
@ -30,9 +30,11 @@
|
|||
|
||||
#include "button.h"
|
||||
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
||||
#include "scene/theme/theme_db.h"
|
||||
#include "servers/display/accessibility_server.h"
|
||||
|
||||
Size2 Button::get_minimum_size() const {
|
||||
Ref<Texture2D> _icon = icon;
|
||||
|
|
@ -151,23 +153,28 @@ Ref<StyleBox> Button::_get_current_stylebox() const {
|
|||
return stylebox;
|
||||
}
|
||||
|
||||
String Button::_get_accessibility_name() const {
|
||||
const String &ac_name = Control::_get_accessibility_name();
|
||||
if (!xl_text.is_empty() && ac_name.is_empty()) {
|
||||
return xl_text;
|
||||
} else if (!xl_text.is_empty() && !ac_name.is_empty() && ac_name != xl_text) {
|
||||
return ac_name + ": " + xl_text;
|
||||
} else if (xl_text.is_empty() && ac_name.is_empty() && !get_tooltip_text().is_empty()) {
|
||||
return get_tooltip_text(); // Fall back to tooltip.
|
||||
} else {
|
||||
return ac_name;
|
||||
}
|
||||
}
|
||||
|
||||
void Button::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
||||
const String &ac_name = get_accessibility_name();
|
||||
if (!xl_text.is_empty() && ac_name.is_empty()) {
|
||||
DisplayServer::get_singleton()->accessibility_update_set_name(ae, xl_text);
|
||||
} else if (!xl_text.is_empty() && !ac_name.is_empty() && ac_name != xl_text) {
|
||||
DisplayServer::get_singleton()->accessibility_update_set_name(ae, ac_name + ": " + xl_text);
|
||||
} else if (xl_text.is_empty() && ac_name.is_empty() && !get_tooltip_text().is_empty()) {
|
||||
DisplayServer::get_singleton()->accessibility_update_set_name(ae, get_tooltip_text()); // Fall back to tooltip.
|
||||
}
|
||||
AcceptDialog *dlg = Object::cast_to<AcceptDialog>(get_parent());
|
||||
if (dlg && dlg->get_ok_button() == this) {
|
||||
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_DEFAULT_BUTTON);
|
||||
AccessibilityServer::get_singleton()->update_set_role(ae, AccessibilityServerEnums::AccessibilityRole::ROLE_DEFAULT_BUTTON);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
@ -180,6 +187,7 @@ void Button::_notification(int p_what) {
|
|||
_shape();
|
||||
|
||||
update_minimum_size();
|
||||
update_configuration_warnings();
|
||||
queue_accessibility_update();
|
||||
queue_redraw();
|
||||
} break;
|
||||
|
|
@ -598,6 +606,7 @@ void Button::set_text(const String &p_text) {
|
|||
xl_text = translated_text;
|
||||
_shape();
|
||||
|
||||
update_configuration_warnings();
|
||||
queue_accessibility_update();
|
||||
queue_redraw();
|
||||
update_minimum_size();
|
||||
|
|
@ -807,7 +816,7 @@ void Button::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("is_expand_icon"), &Button::is_expand_icon);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_button_icon", "get_button_icon");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, Texture2D::get_class_static()), "set_button_icon", "get_button_icon");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
|
||||
|
||||
ADD_GROUP("Text Behavior", "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue