[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


New AppIcon functionality
=========================

Responding to menu commands
---------------------------

   As of Workbench V44, it is possible to invoke menu actions for
AppIcons 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
Custom AppIcon rendering hook
-----------------------------

   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 AppIcons. 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
     A pointer to the RastPort to render into.

arm_Icon
     A pointer to the Icon to be rendered.

arm_Label
     A pointer to the label text to be printed below the icon.

arm_Tags
     Further control tags which you should pass on to
     icon.library/DrawIconStateA(), should you call this routine.

arm_Left
arm_Top
     Rendering origin; note that these coordinates DO NOT take the
     embossing border sizes into account.

arm_Width
arm_Height
     Size of the Icon's image area; you should limit your drawing to
     this area.

arm_State
     An icon drawing state, such as used by
     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.

AppIcon positioning
-------------------

   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.

AppIcon selection
-----------------

   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 AppMessages with the AppMessage->am_Class member set to
AMCLASSICON_Selected or AMCLASSICON_Unselected, respectively.