#lang scribble/manual @(require (for-label racket/base racket/class racket/contract "../wv-tray.rkt" "../menu.rkt")) @title{Tray Icons} @author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]] @defmodule[(file "../wv-tray.rkt")] The @racketmodname[(file "../wv-tray.rkt")] module provides the @racket[wv-tray%] class. A tray object represents a native system tray icon backed by the webview runtime. @defclass[wv-tray% object% ()]{ Creates a native tray icon. @bold{Initialization fields} @itemlist[#:style 'compact @item{@racket[icon] — mandatory} @item{@racket[tooltip] — default @racket[""]} @item{@racket[menu] — default @racket[#f]}] If a menu is provided, it is installed during initialization. @bold{Events} These methods can be overridden. @defmethod[(activated [reason symbol?]) any/c]{ Called when the tray icon is activated. The @racket[reason] is derived from the native event. } @defmethod[(message-clicked) any/c]{ Called when a tray message is clicked. } @defmethod[(menu-item-chosen [id symbol?]) any/c]{ Called when a menu item is chosen without a registered callback. } @defmethod[(unhandled-event [evt hash?]) any/c]{ Called for unhandled native events. } @bold{Commands} @defmethod[(show) (is-a?/c wv-tray%)]{ Shows the tray icon and returns the tray object. } @defmethod[(hide) (is-a?/c wv-tray%)]{ Hides the tray icon and returns the tray object. } @defmethod[(close) (is-a?/c wv-tray%)]{ Closes the tray icon and returns the tray object. } @defmethod[(set-icon! [icon-file path-string?]) (is-a?/c wv-tray%)]{ Changes the tray icon and returns the tray object. } @defmethod[(set-tooltip! [text string?]) (is-a?/c wv-tray%)]{ Changes the tooltip and returns the tray object. } @defmethod[(show-message [title string?] [message string?]) (is-a?/c wv-tray%)]{ Shows a native tray message and returns the tray object. } @defmethod[(set-menu! [menu-def any/c]) (is-a?/c wv-tray%)]{ Installs a tray menu and returns the tray object. } @defmethod[(connect-menu! [id symbol?] [callback procedure?]) (is-a?/c wv-tray%)]{ Registers a callback for a menu item and returns the tray object. } @defmethod[(disconnect-menu! [id symbol?]) (is-a?/c wv-tray%)]{ Removes a menu callback and returns the tray object. } @defmethod[(handle) any/c]{ Returns the native tray handle. } }