Implement support for application status indicators (tray icons).

This commit is contained in:
bruvzg
2023-08-03 12:45:56 +03:00
parent dfe226b933
commit 8da36031e4
15 changed files with 827 additions and 1 deletions

View File

@ -587,6 +587,27 @@ void DisplayServer::set_icon(const Ref<Image> &p_icon) {
WARN_PRINT("Icon not supported by this display server.");
}
DisplayServer::IndicatorID DisplayServer::create_status_indicator(const Ref<Image> &p_icon, const String &p_tooltip, const Callable &p_callback) {
WARN_PRINT("Status indicator not supported by this display server.");
return INVALID_INDICATOR_ID;
}
void DisplayServer::status_indicator_set_icon(IndicatorID p_id, const Ref<Image> &p_icon) {
WARN_PRINT("Status indicator not supported by this display server.");
}
void DisplayServer::status_indicator_set_tooltip(IndicatorID p_id, const String &p_tooltip) {
WARN_PRINT("Status indicator not supported by this display server.");
}
void DisplayServer::status_indicator_set_callback(IndicatorID p_id, const Callable &p_callback) {
WARN_PRINT("Status indicator not supported by this display server.");
}
void DisplayServer::delete_status_indicator(IndicatorID p_id) {
WARN_PRINT("Status indicator not supported by this display server.");
}
int64_t DisplayServer::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {
WARN_PRINT("Native handle not supported by this display server.");
return 0;
@ -825,6 +846,12 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_native_icon", "filename"), &DisplayServer::set_native_icon);
ClassDB::bind_method(D_METHOD("set_icon", "image"), &DisplayServer::set_icon);
ClassDB::bind_method(D_METHOD("create_status_indicator", "icon", "tooltip", "callback"), &DisplayServer::create_status_indicator);
ClassDB::bind_method(D_METHOD("status_indicator_set_icon", "id", "icon"), &DisplayServer::status_indicator_set_icon);
ClassDB::bind_method(D_METHOD("status_indicator_set_tooltip", "id", "tooltip"), &DisplayServer::status_indicator_set_tooltip);
ClassDB::bind_method(D_METHOD("status_indicator_set_callback", "id", "callback"), &DisplayServer::status_indicator_set_callback);
ClassDB::bind_method(D_METHOD("delete_status_indicator", "id"), &DisplayServer::delete_status_indicator);
ClassDB::bind_method(D_METHOD("tablet_get_driver_count"), &DisplayServer::tablet_get_driver_count);
ClassDB::bind_method(D_METHOD("tablet_get_driver_name", "idx"), &DisplayServer::tablet_get_driver_name);
ClassDB::bind_method(D_METHOD("tablet_get_current_driver"), &DisplayServer::tablet_get_current_driver);
@ -851,6 +878,7 @@ void DisplayServer::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_TEXT_TO_SPEECH);
BIND_ENUM_CONSTANT(FEATURE_EXTEND_TO_TITLE);
BIND_ENUM_CONSTANT(FEATURE_SCREEN_CAPTURE);
BIND_ENUM_CONSTANT(FEATURE_STATUS_INDICATOR);
BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
@ -865,6 +893,7 @@ void DisplayServer::_bind_methods() {
BIND_CONSTANT(MAIN_WINDOW_ID);
BIND_CONSTANT(INVALID_WINDOW_ID);
BIND_CONSTANT(INVALID_INDICATOR_ID);
BIND_ENUM_CONSTANT(SCREEN_LANDSCAPE);
BIND_ENUM_CONSTANT(SCREEN_PORTRAIT);