Adding a tray icon.

This commit is contained in:
2026-04-29 14:34:12 +02:00
parent 964a0439e6
commit 97acd18a88
4 changed files with 238 additions and 6 deletions
+53
View File
@@ -51,6 +51,12 @@
rkt-webview-version
rkt-webview-set-loglevel
rkt-webview-info
; tray specific
rkt-webview-tray-create
rkt-webview-tray-set-icon!
rkt-webview-tray-set-tooltip!
rkt-webview-tray-show-message
rkt-webview-tray-set-menu!
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -466,6 +472,25 @@
(define-rktwebview rkt_webview_message_box
(_fun _int _string/utf-8 _string/utf-8 _string/utf-8 _rkt_messagetype_t -> _rkt_result_t))
;RKTWEBVIEW_QT_EXPORT rktwebview_t rkt_webview_tray_create(const char *icon_file, const char *tooltip);
(define-rktwebview rkt_webview_tray_create
(_fun _string/utf-8 _string/utf-8 -> _int))
;RKTWEBVIEW_QT_EXPORT result_t rkt_webview_tray_set_icon( rktwebview_t tray, const char *icon_file);
(define-rktwebview rkt_webview_tray_set_icon
(_fun _int _string/utf-8 -> _rkt_result_t))
;RKTWEBVIEW_QT_EXPORT result_t rkt_webview_tray_set_tooltip(rktwebview_t tray, const char *tooltip);
(define-rktwebview rkt_webview_tray_set_tooltip
(_fun _int _string/utf-8 -> _rkt_result_t))
;RKTWEBVIEW_QT_EXPORT result_t rkt_webview_tray_show_message(rktwebview_t tray, const char *title, const char *message);
(define-rktwebview rkt_webview_tray_show_message
(_fun _int _string/utf-8 _string/utf-8 -> _rkt_result_t))
;RKTWEBVIEW_QT_EXPORT result_t rkt_webview_tray_set_menu(rktwebview_t tray, const char *menu_json);
(define-rktwebview rkt_webview_tray_set_menu
(_fun _int _string/utf-8 -> _rkt_result_t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Initialize and start library
@@ -840,6 +865,34 @@
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tray specific
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (rkt-webview-tray-create icon-file tooltip evt-callback)
(let* ((evt-queue (make-queue))
(tray (rkt_webview_tray_create icon-file tooltip))
(handle (make-rkt-wv tray evt-queue evt-callback #t (lambda () #t))))
(hash-set! evt-cb-hash tray (lambda (evt) (evt-callback handle evt)))
(hash-set! rkt-wv-store tray handle)
handle))
(define (rkt-webview-tray-set-icon! tray icon-file)
(rkt_webview_tray_set_icon (rkt-wv-win tray) icon-file))
(define (rkt-webview-tray-set-tooltip! tray tooltip)
(rkt_webview_tray_set_tooltip (rkt-wv-win tray) tooltip))
(define (rkt-webview-tray-show-message tray title message)
(rkt_webview_tray_show_message (rkt-wv-win tray) title message))
(define (rkt-webview-tray-set-menu! tray menu-json)
(rkt_webview_tray_set_menu (rkt-wv-win tray) menu-json))
;; Furthermore: rkt-webview-close, rkt-webview-valid?, rkt-webview-show and rkt-webview-hide apply also to tray
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Administration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;