; April 2010
; Written by Luis with PB 4.41
; A Traybar Icon implementation for PureBasic (OOP)
; The "main" icon is always set with TrayIcon_Create() or with SetIcon()
; The icons used in the animations are "secondary" icons and when the animation stops
; the icon in the tray bar reverts to the "main" icon.
; The icons are never copied internally to the object. TrayIcon always reference the icons
; defined in your program, so don't free them while they're in use.
; The "helper" procedure TrayIcon_GetIconFromRGBA() can be used to convert an RGBA
; PureBasic's image to icon format. This can be useful to draw an icon at runtime using the
; PB drawings commands and than convert the image into an icon to be used with a TrayIcon object.
; See the sample program for more info about it.
; The code should be Ascii and Unicode compatible.
; The code should be 32 and 64 bit compatible.
Code: Select all
Interface TrayIcon
; destroy the tray icon and free the object
Destroy()
; set the text tooltip for the icon
SetTooltip (sText.s)
; show a balloon tooltip with title, text and optionally a system defined icon
ShowBalloon (sTitle.s, sText.s, iIconType = #TRAY_ICON_NONE)
; remove the text tooltip
RemoveTooltip()
; remove the balloon tooltip
RemoveBalloon()
; change the icon
; ignored if animation is active
SetIcon (hIcon)
; enable / disable the blinking of the icon
; ignored if animation is active
Blink (flgStatus)
; set the number of frames to be used to animate the icon
; ignored if animation is active
SetAnimationFrames (iFrames)
; set the time to wait in ms. between each frame
; ignored if animation is active
SetAnimationDelay (iDelay)
; load the specified icon in a frame slot (0 based)
; ignored if animation is active
LoadFrameIcon (iFrame, hIcon)
; start the animation and play it forever (-1) or n times (1...n)
; disable blinking if is active
StartAnimation (iCycles)
; stop the animation and discard the animation data freeing memory
StopAnimation()
; hide/show the icon in the tray keeping all the states active
Hide (flgStatus)
; return 0/1 if blinking is inactive/active
IsBlinking()
; return 0/1 if animation is inactive/active
IsAnimated()
; return 0/1 if the tray icon is visible/hidden
IsHidden()
EndInterface
Bye
