Autodoc headers unified to avoid misinterpretation by the build script.
[cake.git] / workbench / libs / desktop / getmenuitemlist.c
blob5d62f881c60a88353c789f1a2321b5d1302ea8d7
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/types.h>
9 #include <exec/memory.h>
10 #include <intuition/classusr.h>
11 #include <libraries/desktop.h>
12 #include <libraries/mui.h>
13 #include <utility/tagitem.h>
15 #include <proto/exec.h>
16 #include <proto/intuition.h>
17 #include <proto/muimaster.h>
18 #include <proto/utility.h>
20 #include "desktop_intern.h"
21 #include "support.h"
23 #include "iconclass.h"
24 #include "iconobserver.h"
25 #include "iconcontainerclass.h"
26 #include "iconcontainerobserver.h"
27 #include "observer.h"
29 #define DEBUG 1
30 #include <aros/debug.h>
32 /*****************************************************************************
34 NAME */
36 #include <proto/desktop.h>
38 AROS_LH1(struct DesktopOperationItem *, GetMenuItemList,
40 /* SYNOPSIS */
42 AROS_LHA(ULONG, operationType, D0),
44 /* LOCATION */
46 struct DesktopBase *, DesktopBase, 10, Desktop)
48 FUNCTION
50 INPUTS
52 RESULT
54 NOTES
56 EXAMPLE
58 BUGS
60 SEE ALSO
62 INTERNALS
64 HISTORY
66 *****************************************************************************
69 AROS_LIBFUNC_INIT
70 struct DesktopOperationItem *doi = NULL;
71 struct DesktopOperation *dop,
72 *subdop;
73 LONG items = 0,
74 index = 0,
75 subindex = 0;
76 //LONG itemNumber = 1;
78 dop = (struct DesktopOperation *) DesktopBase->db_OperationList.lh_Head;
79 while (dop->do_Node.ln_Succ)
81 items++;
82 dop = (struct DesktopOperation *) dop->do_Node.ln_Succ;
85 if (items)
87 doi =
88 (struct DesktopOperationItem *)
89 AllocVec(sizeof(struct DesktopOperationItem) * (items + 1),
90 MEMF_ANY);
92 else
93 return doi;
95 dop = (struct DesktopOperation *) DesktopBase->db_OperationList.lh_Head;
96 while (dop->do_Node.ln_Succ)
98 if (dop->do_Code & operationType)
100 doi[index].doi_Code = dop->do_Code;
101 doi[index].doi_Number = dop->do_Number;
102 doi[index].doi_Name = dop->do_Name;
104 doi[index].doi_Flags = 0;
105 if (dop->do_Flags & DOF_CHECKED)
106 doi[index].doi_Flags |= DOIF_CHECKED;
107 if (dop->do_Flags & DOF_CHECKABLE)
108 doi[index].doi_Flags |= DOIF_CHECKABLE;
109 if (dop->do_Flags & DOF_MUTUALEXCLUDE)
110 doi[index].doi_Flags |= DOIF_MUTUALEXCLUDE;
112 doi[index].doi_MutualExclude = dop->do_MutualExclude;
114 // this bit does the subitem array... at the moment only
115 // one level of subitems are supported.. it would be
116 // a nice option to have more, so this part will have to be changed
117 // to be recursive
118 items = 0;
119 subindex = 0;
120 // subdop=DesktopBase->db_OperationList.lh_Head;
121 subdop = (struct DesktopOperation *) dop->do_SubItems.lh_Head;
122 if (subdop->do_Node.ln_Succ)
123 items++;
124 while (subdop->do_Node.ln_Succ)
126 if (subdop->do_Code & operationType)
127 items++;
128 subdop = (struct DesktopOperation *) subdop->do_Node.ln_Succ;
131 if (items)
133 doi[index].doi_SubItems =
134 (struct DesktopOperationItem *)
135 AllocVec(sizeof(struct DesktopOperationItem) * (items),
136 MEMF_ANY);
138 subdop = (struct DesktopOperation *) dop->do_SubItems.lh_Head;
139 while (subdop->do_Node.ln_Succ)
141 doi[index].doi_SubItems[subindex].doi_Code =
142 subdop->do_Code;
143 doi[index].doi_SubItems[subindex].doi_Number =
144 subdop->do_Number;
145 doi[index].doi_SubItems[subindex].doi_Name =
146 subdop->do_Name;
147 doi[index].doi_SubItems[subindex].doi_MutualExclude =
148 subdop->do_MutualExclude;
149 doi[index].doi_SubItems[subindex].doi_Flags = 0;
150 if (subdop->do_Flags & DOF_CHECKED)
151 doi[index].doi_SubItems[subindex].doi_Flags |=
152 DOIF_CHECKED;
153 if (subdop->do_Flags & DOF_CHECKABLE)
154 doi[index].doi_SubItems[subindex].doi_Flags |=
155 DOIF_CHECKABLE;
156 if (subdop->do_Flags & DOF_MUTUALEXCLUDE)
157 doi[index].doi_SubItems[subindex].doi_Flags |=
158 DOIF_MUTUALEXCLUDE;
159 doi[index].doi_SubItems[subindex].doi_SubItems = NULL;
161 subdop =
162 (struct DesktopOperation *) subdop->do_Node.ln_Succ;
163 subindex++;
166 doi[index].doi_SubItems[subindex].doi_Number = 0;
167 doi[index].doi_SubItems[subindex].doi_Code = 0;
168 doi[index].doi_SubItems[subindex].doi_Name = NULL;
170 else
171 doi[index].doi_SubItems = NULL;
173 index++;
176 dop = (struct DesktopOperation *) dop->do_Node.ln_Succ;
179 doi[index].doi_Number = 0;
180 doi[index].doi_Code = 0;
181 doi[index].doi_Name = NULL;
183 // kprintf("set doi[%d] to NULL\n", index);
185 // ///////////
187 { LONG numberWindowItems=0, subs=0;
189 while(doi[numberWindowItems].doi_Code!=0 &&
190 doi[numberWindowItems].doi_Name!=NULL) { kprintf("processing [%d] (addr):
191 %d\n", numberWindowItems, doi[numberWindowItems].doi_Name);
192 if(doi[numberWindowItems].doi_SubItems) { subs=0; kprintf("subitem.code
193 is: %d\n", doi[numberWindowItems].doi_SubItems[subs].doi_Code);
194 while(doi[numberWindowItems].doi_SubItems[subs].doi_Code!=0) { kprintf("
195 processing sub (addr): %d\n",
196 doi[numberWindowItems].doi_SubItems[subs].doi_Name); subs++;
197 kprintf("subitem.code is: %d\n",
198 doi[numberWindowItems].doi_SubItems[subs].doi_Code); } if(subs) subs++; }
199 numberWindowItems++; } }
201 // ///////////
204 return doi;
206 AROS_LIBFUNC_EXIT
207 } /* CreateWorkbenchObjectA */