1 #define MUIMASTER_YES_INLINE_STDARG
3 #include <exec/types.h>
4 #include <exec/memory.h>
5 #include <intuition/classusr.h>
6 #include <libraries/desktop.h>
7 #include <libraries/gadtools.h>
8 #include <utility/tagitem.h>
10 #include <proto/exec.h>
11 #include <proto/intuition.h>
12 #include <proto/muimaster.h>
13 #include <proto/utility.h>
15 #include "desktop_intern.h"
16 #include "desktop_intern_protos.h"
20 #include <aros/debug.h>
22 /*****************************************************************************
26 #include <proto/desktop.h>
28 AROS_LH0(struct NewMenu
*, BuildDesktopMenus
,
34 struct DesktopBase
*, DesktopBase
, 11, Desktop
)
54 *****************************************************************************
58 struct DesktopOperationItem
*doiD
,
63 ULONG numberDesktopItems
= 0,
64 numberWindowItems
= 0,
67 ULONG numberMenuItems
= 0;
68 struct NewMenu
*menuDat
;
70 // first, count the number of menu items in each menu
71 doiD
= GetMenuItemList(DOC_DESKTOPOP
);
74 while (doiD
[numberDesktopItems
].doi_Code
!= 0
75 && doiD
[numberDesktopItems
].doi_Name
!= NULL
)
77 if (doiD
[numberWindowItems
].doi_SubItems
)
80 while (doiD
[numberWindowItems
].doi_SubItems
[subs
].doi_Code
!=
82 && doiD
[numberWindowItems
].doi_SubItems
[subs
].
94 if (numberDesktopItems
)
98 doiW
= GetMenuItemList(DOC_WINDOWOP
);
101 while (doiW
[numberWindowItems
].doi_Code
!= 0)
103 if (doiW
[numberWindowItems
].doi_SubItems
)
106 while (doiW
[numberWindowItems
].doi_SubItems
[subs
].doi_Code
!=
116 if (numberWindowItems
)
120 doiI
= GetMenuItemList(DOC_ICONOP
);
123 while (doiI
[numberIconItems
].doi_Code
!= 0
124 && doiI
[numberIconItems
].doi_Name
!= NULL
)
126 if (doiI
[numberIconItems
].doi_SubItems
)
129 while (doiI
[numberIconItems
].doi_SubItems
[subs
].doi_Code
!= 0
130 && doiI
[numberIconItems
].doi_SubItems
[subs
].doi_Name
!=
145 (struct NewMenu
*) AllocVec(sizeof(struct NewMenu
) *
146 (numberMenuItems
+ 1), MEMF_ANY
);
148 // create the Desktop menu
149 if (numberDesktopItems
> 0)
151 menuDat
[i
].nm_Type
= NM_TITLE
;
152 menuDat
[i
].nm_Label
= "AROS";
153 menuDat
[i
].nm_CommKey
= 0;
154 menuDat
[i
].nm_Flags
= 0;
155 menuDat
[i
].nm_MutualExclude
= 0;
156 menuDat
[i
].nm_UserData
= 0;
160 while (doiD
[j
].doi_Code
!= 0 && doiD
[j
].doi_Name
!= NULL
)
161 processOperationItem(&i
, &j
, doiD
, menuDat
);
164 if (numberWindowItems
> 0)
166 menuDat
[i
].nm_Type
= NM_TITLE
;
167 menuDat
[i
].nm_Label
= "Window";
168 menuDat
[i
].nm_CommKey
= 0;
169 menuDat
[i
].nm_Flags
= 0;
170 menuDat
[i
].nm_MutualExclude
= 0;
171 menuDat
[i
].nm_UserData
= 0;
175 while (doiW
[j
].doi_Code
!= 0 && doiW
[j
].doi_Name
!= NULL
)
176 processOperationItem(&i
, &j
, doiW
, menuDat
);
179 if (numberIconItems
> 0)
181 menuDat
[i
].nm_Type
= NM_TITLE
;
182 menuDat
[i
].nm_Label
= "Icon";
183 menuDat
[i
].nm_CommKey
= 0;
184 menuDat
[i
].nm_Flags
= 0;
185 menuDat
[i
].nm_MutualExclude
= 0;
186 menuDat
[i
].nm_UserData
= 0;
190 while (doiI
[j
].doi_Code
!= 0 && doiI
[j
].doi_Name
!= NULL
)
191 processOperationItem(&i
, &j
, doiI
, menuDat
);
194 doExclude(doiD
, menuDat
, 1);
195 doExclude(doiW
, menuDat
, numberDesktopItems
+ 1);
196 doExclude(doiI
, menuDat
, numberDesktopItems
+ numberWindowItems
+ 1);
198 menuDat
[i
].nm_Type
= NM_END
;
199 menuDat
[i
].nm_Label
= NULL
;
200 menuDat
[i
].nm_CommKey
= 0;
201 menuDat
[i
].nm_Flags
= 0;
202 menuDat
[i
].nm_MutualExclude
= 0;
203 menuDat
[i
].nm_UserData
= 0;
206 while (menuDat
[i
].nm_Type
!= NM_END
)
213 } /* BuildDesktopMenus */