2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Accesses AppIcon information from workbench.library.
9 #include <exec/types.h>
10 #include <exec/ports.h>
11 #include <utility/tagitem.h>
13 #include <graphics/gfx.h>
15 #include <proto/utility.h>
17 #include "workbench_intern.h"
18 #include <workbench/workbench.h>
21 #include <aros/debug.h>
22 /*****************************************************************************
25 #include <proto/workbench.h>
27 AROS_LH2(struct DiskObject
*, GetNextAppIcon
,
29 AROS_LHA(struct DiskObject
*, lastdiskobj
, A0
),
30 AROS_LHA(char *, text
, A1
),
33 struct WorkbenchBase
*, WorkbenchBase
, 10, Workbench
)
37 Accesses AppIcon information from workbench.library. This function
38 is meant for iterations through wblibs´ AppIcon storage as needed
40 Initialised with a NULL as the first argument, it iterates
41 through all AppIcons stored in workbench.library by returning the
42 pointer to the next AppIcon´s DiskObject structure and copies the
43 name of the given AppIcon to the given array. The function returns
44 a NULL if the end of AppIcon list was reached or if no AppIcons
49 lastdiskobj -- NULL (initial value) or pointer to a DiskObject
50 structure stored in workbench.library
51 text -- char array pointer to store AppIcon´s name in
55 A pointer to an DiskObject structure -- which should be used within
56 the next function call to access the next AppIcon -- or NULL if no
57 AppIcons were found or end of list was reached.
63 struct DiskObject *_nb_dob = NULL;
66 while ( _nb_dob = GetNextAppIcon(_nb_dob, &text) )
68 printf("appicon found: %s \n", text);
76 AddAppIconA(), RemoveAppIcon(), WorkbenchControlA(), icon.library/DrawIconStateA()
80 ******************************************************************************/
84 /* get wblibs list of appicons */
85 struct List
*appiconlist
= NULL
;
86 appiconlist
= &WorkbenchBase
->wb_AppIcons
;
89 /* return NULL if list empty or argument dob is already from last appicon in list*/
90 if ( !IsListEmpty(appiconlist
) )
92 /* return NULL if last entry reached */
93 if (lastdiskobj
== ((struct AppIcon
*)(appiconlist
->lh_TailPred
))->ai_DiskObject
) return NULL
;
95 struct Node
*currentnode
= appiconlist
->lh_Head
;
96 currentnode
= GetHead(appiconlist
);
98 /* iterations through the list */
101 /* check if given DiskObject was found and return it´s successor */
102 if ( ((struct AppIcon
*)currentnode
)->ai_DiskObject
== lastdiskobj
)
104 currentnode
= GetSucc(currentnode
);
106 bug("[getnextappicon] appicon found: %s \n", ((struct AppIcon
*)currentnode
)->ai_Text
);
108 strcpy(text
, ((struct AppIcon
*)currentnode
)->ai_Text
);
109 return ((struct AppIcon
*)currentnode
)->ai_DiskObject
;
113 } while ((currentnode
= GetSucc(currentnode
)));
115 /* return first entry if NULL was given or DiskObject could not be found */
116 strcpy(text
, ((struct AppIcon
*)(appiconlist
->lh_Head
))->ai_Text
);
117 return ((struct AppIcon
*)(appiconlist
->lh_Head
))->ai_DiskObject
;
124 } /* GetNextAppIcon() */