Documentation
¶
Index ¶
Constants ¶
const ( BI_NONE win32.HICON = win32.HICON(sys.NIIF_NONE) BI_INFO win32.HICON = win32.HICON(sys.NIIF_INFO) BI_WARNING win32.HICON = win32.HICON(sys.NIIF_WARNING) BI_ERROR win32.HICON = win32.HICON(sys.NIIF_ERROR) )
const CallbackMessage = appmsg.NOTIFY_ICON_CALLBACK
CallbackMessage is the message sent to the window when mouse or keyboard interaction occurs in the bounding rectangle of the icon. Process this message manually or use Spec.OnEvent.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event is the interaction event occurs in the bounding rectangle of the icon.
const ( NIN_SELECT Event = (win32.WM_USER + 0) // Notify icon is selected by mouse or keyboard. NINF_KEY Event = 0x1 NIN_KEYSELECT Event = (NIN_SELECT | NINF_KEY) // Notify icon is selected by or keyboard. NIN_BALLOONSHOW Event = (win32.WM_USER + 2) NIN_BALLOONHIDE Event = (win32.WM_USER + 3) NIN_BALLOONTIMEOUT Event = (win32.WM_USER + 4) NIN_BALLOONUSERCLICK Event = (win32.WM_USER + 5) NIN_POPUPOPEN Event = (win32.WM_USER + 6) // Tooltip is needed. NIN_POPUPCLOSE Event = (win32.WM_USER + 7) MIN_CONTEXTMENU Event = win32.WM_CONTEXTMENU // Action to trigger the shortcut menu(i.e. right click). )
func ParseCallback ¶
func ParseCallback(wParam win32.WPARAM, lParam win32.LPARAM) (id win32.WORD, event Event, eventX win32.SHORT, eventY win32.SHORT)
ParseCallback parses the parameters of CallbackMessage. id is the identifier of notify icon. event is the interaction event occurred. eventX/Y is the event coordinates.
type Modifier ¶
type Modifier struct {
// contains filtered or unexported fields
}
Modifier is used to modify notify icon. A typical usage is a
modifier.SetXXX(...).SetXXX(...).Apply()
See [StartModify].
func (*Modifier) SetNotify ¶
func (m *Modifier) SetNotify(spec *NotifySpec) *Modifier
SetNotify sets the ballon notification.
type NotifyIcon ¶
type NotifyIcon struct {
// contains filtered or unexported fields
}
NotifyIcon is an icon in taskbar's status area.
func New ¶
New adds an icon to taskbar's status area. An NotifyIcon is identified by a window and an ID.
func (*NotifyIcon) ID ¶
func (icon *NotifyIcon) ID() win32.UINT
func (*NotifyIcon) SetFocus ¶
func (icon *NotifyIcon) SetFocus() error
SetFocus returns focus to the taskbar notification area. Notification area icons should use this method when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, this method to return focus to the notification area.
func (*NotifyIcon) StartModify ¶
func (icon *NotifyIcon) StartModify() *Modifier
StartModify returns a Modifier which can be used to modify the notify icon identified by w and id.
type NotifySpec ¶
type NotifySpec struct {
// Icon of notification. BI_xxx or a real HICON
// If Title is empty string, the icon is not shown.
Icon win32.HICON
// Title of notification.
Title string
// Message of notification.
Message string
// Do not play the notifications sound.
NoSound bool
// Use (SM_CXICON x SM_CYICON) instead of (SM_CXSMICON x SM_CYSMICON) icon dimension.
LargeIcon bool
// If the notification cannot be displayed immediately, discard it.
RealTime bool
// Do not display the balloon notification if the current user is in "quiet time"
RespectQuietTime bool
}
type Spec ¶
type Spec struct {
// Icon in system tray.
Icon win32.HICON
// Tool tip string. if Tip is "", [NIN_POPUPOPEN] event is sent to allow showing application-drawn tooltip.
Tip string
// The ballon notification.
Notify *NotifySpec
// Optional callback to receive events.
OnEvent func(id win32.WORD, event Event, eventX win32.SHORT, eventY win32.SHORT)
}