As of Workbench V44, it is possible to invoke menu actions for
AppIcon
s just like they were normal icons. You have to tell
Workbench which menu items your icon responds to using the tag item
list you provide to AddAppIconA()
. When one of the supported
menu items is invoked, you will receive an AppMessage
with
the am_Class
entry set to a value out of
AMCLASSICON_Open
..AMCLASSICON_EmptyTrash
, corresponding
to the menu item used.
The following BOOL
tags are provided by AddAppIconA()
to
control which menu commands are supported by an AppIcon
:
WBAPPICONA_SupportsOpen
WBAPPICONA_SupportsCopy
WBAPPICONA_SupportsRename
WBAPPICONA_SupportsInformation
WBAPPICONA_SupportsSnapshot
WBAPPICONA_SupportsUnSnapshot
WBAPPICONA_SupportsLeaveOut
WBAPPICONA_SupportsPutAway
WBAPPICONA_SupportsDelete
WBAPPICONA_SupportsFormatDisk
WBAPPICONA_SupportsEmptyTrash
The new tag WBAPPICONA_RenderHook
takes a pointer to a struct Hook
that will be invoked when rendering your AppIcon. With this hook
and WorkbenchControlA()
you can create dynamic or animated
AppIcon
s. Your hook will be called with the following
parameters and has to return a result value:
result = hookFunc(hook, reserved, arm) D0 A0 A2 A1 LONG hookFunc(struct Hook *hook, APTR reserved, struct AppIconRenderMsg *arm); struct AppIconRenderMsg { struct RastPort * arm_RastPort; struct DiskObject * arm_Icon; STRPTR arm_Label; struct TagItem * arm_Tags; WORD arm_Left; WORD arm_Top; WORD arm_Width; WORD arm_Height; ULONG arm_State; };
The reserved parameter will be set to NULL
. The render
message contents are as follows:
arm_RastPort
arm_Icon
arm_Label
arm_Tags
icon.library/DrawIconStateA()
, should you
call this routine.
arm_Left
arm_Top
arm_Width
arm_Height
arm_State
icon.library/DrawIconStateA()
.
Note that all the data in the render message is read-only.
If your hook code returns TRUE
, the AppIcon
's regular
image will be drawn. If your code returns FALSE
, the regular
image will not be drawn; this allows you to do all the icon's
on-screen rendering with the exception of the icon image used when
dragging the icon on the screen.
The new WBAPPICONA_PropagatePosition
tag allows
the AppIcon's position to be propagated back to the
original DiskObject
you passed to AddAppIconA()
. By
default, Workbench will make a copy of that DiskObject
's
icon imagery, allowing the application to free the it.
But if you specify WBAPPICONA_PropagatePosition,TRUE
,
Workbench will assume that you will not free the DiskObject
and that the AppIcon
's current position should be stored
in its do_CurrentX/do_CurrentY
members.
The new tag WBAPPICONA_NotifySelectState
causes the application
to be be notified whenever the AppIcon becomes selected or unselected.
You will hear only state transitions, i.e. changes from selected to
unselected state and the other way round. On a state transition you
will receive AppMessage
s with the AppMessage->am_Class
member set to AMCLASSICON_Selected
or AMCLASSICON_Unselected
,
respectively.
Go to the first, previous, next, last section, table of contents.